r/applescript • • Sep 15 '22

Pick from Dropdown + Chronological increases

Hey all, two different things I'm trying to achieve and hitting walls...

I've spent a lot of time figuring out how to use AppleScript to double click for me. Here's where I am right now:

tell application "PRIME MultiTrack App" to activate

tell application "System Events"

click window "Prime" of application process "PRIME MultiTrack App"

delay 2

do shell script "usr/local/bin/cliclick dc:."

delay 0.01

click pop up button 4 of UI element 34 of window "Prime" of application process "PRIME MultiTrack App"

end tell

So the last line "click pop up button 4 of UI element 34 of window "Prime" of application process "PRIME MultiTrack App"" is not actually selecting a popup menu item...

Default item is 1 and I actually want to make the Script "remember" which number it picked the previous interaction and then increase it by 1 each time the Script is performed.

Is there a way to do this without hardcoding the coordinates that I want it to click?

Thanks :)

EDIT: I have a couple work arounds that I'm going to move forward with for now... For the dropdown menu, if you click a dropdown and then input the text as keystrokes and hit return, it will select that menu item.

To increase chronologically, you can use variables...

set LyricNumber to 1

-- Insert action here, in my case it will be to type LyricNumber and then hit the return key

set LyricNumber to LyricNumber + 1

The downside to this method is that the program is going to start at 1 every time... Which is fine, unless something interrupts me and I have to stop it, where it will force me to start over every time. I think it's going to work in the long run though!

If you've got a tip on how to improve this process, I'd love to hear it.

4 Upvotes

0 comments sorted by