How to pass on variable or clipboard content to a shell script?


Thanks to @eurobubba, I am able to find the app ID of an app, and subsequently open the apple menu bar app's menu.

I created a macro which is basically simple:
user input→ variable (app name) → clipboard → shell script to find the app's app ID.

I am looking for a way to pass the app name to the shell script

thanks in advance for your time and help

I think you need to use KMVAR

1 Like
1 Like

thank you for the suggestion.

I am a bit frustrated because I basically just want a macro to click on a menu bar app icon.

@Tom's macro is excellent and I am grateful, but for many apps (KBM, Copy'emPaste, etc) once I get the Bundle ID and run the macro below you can only see those apps where clicking on the menu bar item is considered the equivalent of 'Show Menu'. For many apps. what you see when you click on the menu bar icon is not considered a 'menu'.

I cannot click by position because the location of the menu bar items changes.

Would you have any idea how to create the equivalent of clicking on the apple menu item?

thank you !

thanks very much !

1 Like

Hi @ronald, there are several factors to consider when using AppleScript.

The app you want to access must be able to use AppleScript!
At the place with the red arrow you always have to try if the app reacts to "1" or like here "2".

If you want to open the app and control it manually (arrow key), leave out the lower part of the script

If you have changing menu commands, you can replace "key code" in the script with the command "keystroke" and use the menu command "Cancel" as in my example. You have to pay attention to the correct spelling:

1 Like

thank you. I am still confused.

1- how do I watch your video ? it goes too fast and I have no pause or speed control

2- where does the script you show come from?

the script I was discussing was simply (for default folder X)

    tell application id "com.stclairsoft.DefaultFolderX5"
end tell

Sorry @ronald, I misunderstood and thought you already work with the AppleScript shown above.

The script is from @tom, unfortunately I can't find the post for it. Just an older post from me:

I do not use Default Folder. Maybe someone else can help you there.

How can I watch your videos slowly ? I am getting dizzy. thank you

if you open a GIF in Preview, you can see it frame-by-frame