Kevin
Kevin

Reputation: 1106

AppleScript keystroke

I use an app, and I want to get a data from this app,

I found a button on the menu bar > Edit > Optionwanted

I also found that the option have a shortcut (C + COMD + CTRL + SHIFT)

I'm not sure this is the best approach but I tried :

activate application "App"

delay 1
tell application "System Events" to keystroke "C" using {control down, command down, shift}

but then the result is

System Events got an error: Can’t make {control down, command down, shift} into type constant or list of constant.

  1. is that the best approach to get text from an App ?

  2. I can I fix my script.

PS : when I run

tell application "System Events" to tell application process "App"
    set stuff to entire contents of front window
end tell
return stuff

I can see what I want there :

application process "App", static text "445511" of group 3 of group 1 of group 2 of group 5 of UI element 1 of scroll area 1 of group 2 of group 1 of group 2 of UI element 1 of scroll area 1 of splitter group 1 of window "The Title is actually not static"

That can be a another approach but the title and Text is dynamic and change all the time.

Upvotes: 0

Views: 3258

Answers (1)

StealthHydra
StealthHydra

Reputation: 46

You are close. This is what I got:

activate application "App"

delay 1
tell application "System Events" 
    keystroke "C" using {control down, command down, shift down}
end tell

Upvotes: 1

Related Questions