Using Type a Keystroke does not open Bartender Search via hotkey

I tried another shortcut and it works without any problems from the macro.
Why and why do you need the search in Bartender? I control 99% of all hidden menu items with a UI AppleScript.

Here is an example once without Bartender and then with Bartender:

2019_09_16_Support_1

My advice might be incorrect because I don't have bartender, and because I can't see your KM code. I'm going to guess that your problem is that you didn't indicate in the Type Keystroke action that you wanted to send the keystroke to the bartender application. So that could easily explain why you are getting that sound. Are you aware of this feature of the Type Keystroke action? Did you already try that?

Thank you. the actual use case is disabling flux for one hour. good question about why I am searching bartender. I realize that was how I was doing this manually, but it sounds like a script might do the job more cleanly so I will go that way. still curious why this hotkey does not work. seems like it should but maybe menu shortcuts are different...

Thanks for the suggestion. I had not been aware of this feature and did give it a try but it doesn't solve the problem. @appleianer has pointed me towards what looks like a better solution but wondering if this issue is a bug worth reporting or perhaps just a misunderstanding on my part. thanks again!

I do not know whether it's a misunderstanding on your part. I haven't seen this action fail before as it is failing for you, so I'm unsure what to do. Actually, you probably should upload a screenshot of your macro so we can validate that it's not a misunderstanding on your part. So far we're just assuming everything you are saying accurately describes your macro. If you're going to submit it as a bug report you may need to upload an image too.

If it is a bug (or sometimes even if it isn't) you should probably open the KM Engine log file and check the timestamps at the time in question. There is an open log folder menu item under the Help menu in the KM Editor application. Sometimes this file tells you more about what's failing.

Thanks. Here are two images. the first shows the shortcut key I set for Bartender search. The second shows my macro. Note that this is just to test this one issue so does not include the actual thing I am trying to do.

I see that B3 also has other shortcuts. I would try one of them to see if it's limited to that one shortcut or if it's every one.

There is one more thing. You didn't show the options on the Macro Group which this macro is stored inside. The problem you have could be a setting over there. Are you willing to upload an image of the macro group's settings?

Another approach to solving this sort of issue is to add a beep statement inside the macro so that you can hear if the macro is being triggered. This approach will kind of prove a couple of things.

That's okay that you are keeping some things to yourself. No worries. But sometimes that makes it impossible for us to see the actual cause of the problem. For example, if you sent two keys to the B3 app, within a certain time period, that could cause one of the keys to fail. Since you have trimmed down the macro, we might not be able to see that kind of bug.

I am happy to share the whole macro. I just did this so I could isolate the problem and see if I could reproduce it. I'll take your various suggestions and upload more context when I have a moment. Thanks so much for your help with this!

Uploading the whole macro is good, but I guess I wasn't aware that you were saying that the short macro you uploaded was also failing. I thought the short macro was just meant to illustrate what you were trying to do. I should have asked for clarification on that. Since the short version also fails, I think that's the best path to finding the answer.

And in that case try my two ideas, which were trying one of the different shortcuts and checking the log file. And the beep. That's three ideas gave you.

Hi @geowyn, if you want to do without an additional shortcut, you can try the trigger "yy" and press "P" for pause :wink:

#F.lux Macros.kmmacros (62,7 KB)
ScreenFlow

If you blank out the F.lux App with the Bartender App, you won't see the process anymore. The activities will then only be the notifications on your screen.

Try it with a break of 0.2 seconds before the shortcut (CTRL + F). I already had it that it only works with this delay.

Sometimes I find putting a beep between different actions actually solves a problem because it can resolve certain timing issues.

1 Like

I have tried putting a break of .2 seconds and adding the beeps as @Sleepy suggested and also some messages. the messages appear but the hotkey is not recognized. interestingly, only one of the beeps is heard. the log seems clean. I can upload actual file if that is useful. just grabbed a shot of the relevant section. I will have a look at the script from @appleianer since that seems like a more direct approach!

@appleianer your scripts work beautifully.

question... (if you do not mind) how do you figure out what menu bar to call, etc. I tried to stumble on this by using the browser in Script Debugger but realize now I was looking for the lower level items when what you do is click the Flux item and then use keystrokes to navigate. thanks for any pointers and thanks for this wonderful solution!

one more follow up... it looks like the applescript works most of the time but sometimes I have to run it more than once. I assume this is par for the course with UI scripting. thanks again!

and one more thought. it is ironic that an easier way to do this is probably to have a macro that kills the flux app completely and then launches it an hour later. no UI scripting needed but seems kind of clunky.

not clunky @geowyn :wink:

05)Toggle.kmmacros (42,5 KB) 05)Toggle

Would you like to have an individual time (30 minutes, 1 hour or more)?
Since only one macro can be executed at a time, I have converted an AppleScript into a program for these cases. Are you interested?

1 Like

Yes @geowyndas happens unfortunately times. Is not regular. But when it is executed, it actually runs through me.

tell application "System Events"
	tell application process "Flux"
	    tell menu bar 2
			tell menu bar item 1

I always swap the 2 for a 1 in the script debugger and see if it works. I always get the process name from the activity indicator.

1 Like

wow, thank you! the approach I was looking at is here: Pause for a long time alternative and since I do not need a variable length like in this post, I could just have my second macro check every hour and disable itself on the first iteration. is that the approach you were going to take?

I would start with an hour delay and then adjust as needed.

I really appreciate your help with this!

Please execute this AppleScript:

tell application "Flux"
	launch
	activate
	delay 3
	tell application "System Events"
		activate
		set theTime to text returned of (display dialog "How long should F.lux remain activated?" with title "F.lux app" default answer "" buttons {"Cancel", "Start"} default button 2)
		delay theTime * 60
		tell application "Flux" to quit
	end tell
end tell

Test it with 1 = 1 minute.

Since I got problems with my palettes when executing such a time-based macro, I converted the AppleScript into an app.