Re: Is there a way to send a keystroke to a background app without an AppleScript dictionary?
Re: Is there a way to send a keystroke to a background app without an AppleScript dictionary?
- Subject: Re: Is there a way to send a keystroke to a background app without an AppleScript dictionary?
- From: Yvan KOENIG via AppleScript-Users <email@hidden>
- Date: Mon, 27 Apr 2020 10:28:03 +0200
> Le 27 avr. 2020 à 01:46, Jim Krenz via AppleScript-Users
> <email@hidden> a écrit :
>
> Hello all,
>
> Is there a way to send a keystroke to a background app without an AppleScript
> dictionary?
>
> From what I can tell, the Podcasts app does not have a AppleScript dictionary.
>
> What I want to do, is to send a keystroke (⌘ ⇧ →) to the Podcasts app,
> without activating it.
>
> Here is what I have thus far (but it does not work):
>
> tell application "System Events"
> tell process "Podcasts"
> key code 124 using {shift down, command down}
> end tell
> end tell
>
> Thanks for any ideas or suggestion on how to do the above.
>
> Sincerely,
>
> Jim
As far as I know GUI Scripting requires the target process to be active.
This code is supposed to work but I can't test as Podcasts is unavailable on my
system running 10.13.6.
tell application "Podcasts" to activate
tell application "System Events"
tell process "Podcasts"
set frontmost to true -- old habit used because some OS were
slow to put the process to front after 'activate'
key code 124 using {shift down, command down}
end tell
end tell
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 27
avril 2020 10:27:58
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden