Hello, the following AppleScript triggers the Default Folder X status menu
I would like to access sub-menu items shown below, trying to avoid the Default Folder X native Keyboard Shortcuts (I try to keep Keyboard Shortcuts in KM as much as possible)
What I tried after the script below and did not work:
- KM insert text by typing
- KM Press Button: found none
- tried to insert in AppleScript click menu item "Quick Search"
thank you very much
tell application id "com.stclairsoft.DefaultFolderX5" -- Default Folder X.app
ShowMenu -- directParamText optional menu type ('Computer', 'Favorites', 'Recent Folders', 'Recent Files', 'Finder Windows', 'All')
end tell
Screenshot (click to expand/collapse)
![2024-05-17_09-52-35](https://forum.keyboardmaestro.com/uploads/default/original/3X/8/7/8761938cda7a03a207936aa57d0ef9bdc76274fc.png)
Here is one easy way:
- Set a Default Folder X shortcut to a key combination that you would never want to press.
- Use a
Type a Keystroke
action with that combination, triggered by the hotkey that you do want.
I didn't find much on the St. Clair Software site about Applescript, but I use Default Folder X and I seem to recall that there would be more information there or on other sites if you want to look further. You can also open Default Folder X in Script Editor to see its Applescript dictionary. I just did so, and now understand the syntax that is mentioned in the comment after "ShowMenu" in that example script. ![:slight_smile: :slight_smile:](https://forum.keyboardmaestro.com/images/emoji/apple/slight_smile.png?v=12)
This will open the "Finder Windows" sub-menu:
tell application id "com.stclairsoft.DefaultFolderX5" -- Default Folder X.app
ShowMenu "Finder Windows"
end tell
The same pattern works for the other sub-menus. However, "Quick Search" is not a sub-menu.
1 Like
Superb. Exactly what I wanted. thanks very much !
1 Like
Technically, this isn't correct. Both apps get the keystrokes at the same time. macOS contains no methodology for prioritizing global keyboard shortcuts to one app over another app. You can easily confirm this if you have a second macro-creating app, and create two nearly identical macros with identical keyboard shortcuts, one in each app.
I was talking with Many Tricks' Peter (our founder and programmer) about just this yesterday, and he's the one that explained to me that every app with the same shortcut sees the keystrokes at the same time. I tested this with our app Butler, as it has a rudimentary macro facility. I set up these macros:
Butler: Type "This is a test in Butler"
KM: Type "This is a test in KM"
I gave them both the same shortcut, then switched to TextEdit and hit the hot key. The result:
ThisT ihs ia tsest lin KsM. a test in Butler
It was actually sorta funny to watch :). The moral of the story, though, is to be careful about assigning the same shortcut in multiple apps, because they get sent to all the apps, not just one of the apps.
-rob.
2 Likes
thank you very much @griffman . Very useful to know. and my apologies to @kevinb for a misleading post which I edited.
1 Like