Working with the Pomodoro Menulet Application

I am in the long process of converting still QuicKeys macro's over and trying to figure out how to make Keyboard Maestro aware of applications that run without an interface or rather are not in the dock. A pomodoro app I run dozens of times a day has a pop up window where I enter text and when using a macro group that should only work when Pomodoro is in front Keyboard Maestro is not aware of the application, it is not even aware if I use the wait until window is in front as you can see in the attached screenshot.

Keyboard Maestro is not even aware the window exists.

1 Like

Keyboard Maestro pretty much only looks at foreground applications and regular windows. You will have to use a less direct way to interact with it, like the Found Image action.

Okay, thanks for the info, I guess you can’t win them all (at least the way hoped). I hope you reap much reward for Keyboard Maestro 7!

Hey Skillet,

Isn't that true for most things?   :sunglasses:

Just because Keyboard Maestro can't see something doesn't mean it can't be seen.

System Events can see the Dropbox menulet and click it, so it might be able to see your Pomodoro app.

User-Interface-Scripting is not for the faint of heart, but sometimes it’s the only available solution to a problem.

-Chris

Thanks for the suggestion Chris, I have used UI Browser quite a bit in the past for a lot of AppleScripts for AppleScript like Cubase and Pro Tools that do not natively support AppleScripting. I'll have to try it with this and see what I can get to work, especially since in the end I would like to just be running Keyboard Maestro and ditch QuicKeys, probably a year or three before I finally get there but I am sure I will!

Do you foresee this every changing Peter? Is it even something on your to do list or would that be too much of a hack to pull off?

Maybe. It’s not really a question of being a hack - although some windows are probably really hacky, most of them are legitimate normal panels that would probably be fine.

The problem is a lot more to do with the UI of selecting them, and differentiating them from regular windows, and confusion caused when non-foreground windows effectively hide foreground windows and such.

I wonder what QuicKeys does to work around this. I really want to just say goodby to QuicKeys forever but that one feature right now is holding me back. I have done some silly workarounds using a browswer that is outdated to post stuff to a google dock and have open so when I do key commands they only work if Camino is open but then it checks for the window in front for the Pomodoro app. I use this about 50x a day so it really is not something that I can just let go of and it is buggy and more error prone always making Camino come to the front before I run the commands.

It works but I still run QuicKeys on two machines soley for this feature since Keyboard Maestro doesn’t recongize the Window in the front for a background applicaiton. Thanks for your reply and bit of an explanation. Keep up the great work!

You might be able to do something with some AppleScript accessing the accessibility system…. I don’t know much about that though, but perhaps others can chime in.

Hey Skillet,

Install this macro:

Window Discovery Tool → Windows System Events Can See v1.0

Open your Pomodoro window and run the macro.

Look to see if it's listed in the report.

If it is then it's probably possible to find a work-around using Keyboard Maestro.

-Chris

Thanks Chris for making that and posting. The window did show up

Pomodoro

window → Pomodoro Name

So would AppleScript be the way you would use Keyboard Maestro to be window aware. What I have currently with QuicKeys is key commands that I use that work only when the Pomodoro window is open. For Keyboard Maestro it seems that I would have to always use a conflict pallet since those same key commands will overlap with other applications that Keyboard Maestro sees at the front.

I have tried to wrap my head around another way of doing this for a long time now. I have even considered making all the key commands always check for the window in front but that just slows down dozens of applications when I make Keyboard Maestro use that method and it is pretty kludgy.

Hey Skillet,

Not ideally – no.

What app?

-Chris

It’s called pomodoro, I am pretty sure it was free years ago when I fist got it but it is no longer being made and no app has come close to what it does you can download it here.

http://bit.ly/2htq9YS

Hey Skillet,

Having a copy to test with makes all the difference.

Open the Pomodoro dialog and run this from a global Keyboard Maestro Execute an AppleScript action.

--------------------------------------------------------------------------------
tell application "System Events"
   tell application process "Pomodoro"
      
      if (count of windows) = 1 then
         tell window "Pomodoro Name"
            
            tell combo box 1
               set focused to true
               set value of attribute "AXValue" to "This is a test!"
            end tell
            
            tell combo box 2
               set focused to true
               set value of attribute "AXValue" to "10"
            end tell
            
            tell button "OK"
               click
            end tell
            
            # tell button "Cancel"
            # 	click
            # end tell
            
         end tell
         
      else
         beep -- demonstrate that Pomodoro is NOT active.
      end if
      
   end tell
end tell
--------------------------------------------------------------------------------

Then run it without the Pomodoro window open.

The script tests to see if the Pomodoro window is open and beeps if it is NOT.

The beep is only for you to verify it's working and should be disabled to prevent irritation. :)

This script will open the Pomodoro Menulet.

--------------------------------------------------------------------------------
tell application "System Events"
   tell application process "Pomodoro"
      tell menu bar 2
         ignoring application responses
            tell first menu bar item
               perform action "AXPress"
            end tell
         end ignoring
      end tell
   end tell
end tell
--------------------------------------------------------------------------------

Unfortunately due to a long delay in returning control to the script it is not reasonably possible to select menu items using the script. This of course can be overcome by using Keyboard Maestro and type-select.

Then again there are built-in keyboard shortcut for most of the menu items, so that shouldn't be a big problem.

Finally here's a Typed-String Triggered macro that can tell the difference between a normal app and Pomodoro.

Typed-Trigger → Pomodoro Test v1.0.kmmacros (6.1 KB)

Perhaps these methods will give you some more options.

-Chris

1 Like

Thanks Chris this is pretty awesome and has sparked a lot of thought and workarounds for this problem. I’ll probably end up just using the the tyed string as you suggested instead of the key commands. I can’t think of anyway to have Keyboard Maestro not have to deal with the conflict pallet if the pomodoro window is open unless I put an “If Then Else” statement into every other application that uses the same keystroke. Just years of changing muscle memory, but that will keep me young I am sure ;).

What you gave me is huge and a major step forward, thank you very, very much!

Seems like I remember reading from another post as to why you have the last action here of %Delete%. Is it incase another macro runs and sees the variable “pomContinue” and does some action based on that?

I also didn’t realize you could use # to comment out things I always just used – or (* *) for longer text or to comment out code.
https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_lexical_conventions.html

Hey Skillet,

Another way would be to have a keystroke de-activate the front-app's Macro group and activate the Pomodoro group.

Keyboard Maestro keyboard shortcut does this and then types the keyboard shortcut for the Pomodoro action.

You run your macros as normal.

The final action in each Pomodoro macro would deactivate the Pomodoro group and reactivate the front-app group.

This is not ideal, but it might let you retain your muscle-memory.

-Chris

1 Like

That deletes the variable to prevent clutter and unintended side-effects.

The pound sign (#) has been available for commenting in AppleScript for a very long time now.

I use the two dash (--) prefix for inline comments and the hash tag prefix (#) for comments on their own line.

I simply find this modality easier to see.

-Chris

That is a pretty smart idea, I might end up implementing that. I have been working on this all day thanks to the great stuff you gave me, you even helped me further by what you posted elsewhere helping someone else. I feel like you have been with me through this whole transition (getting sentimental here :wink: ) and am beginning to see the light at the end of the tunnel. I owe you big time, I am excited to soon be able to not have QuicKeys and Keyboard Maestro active.

Thanks for the clarification and workflow tips!

Hey guys, I’ve been kind-of ignoring this topic because I don’t really care about “Menulet Awareness”, but just glancing through the posts, it seems like there’s much more being discussed here - things that look quite valuable.

Maybe you guys could come up with a topic title that better explains what you’ve been talking about?

I’m not complaining, by the way. I just think that this valuable information will get overlooked without a better topic title.

I'm happy to change it, what do you think would be a good title?

"Background Applications with a Foreground Window and Keyboard Maestro Not Recognizing It"