• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is there a way to send a keystroke to a background app without an AppleScript dictionary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Jim Krenz via AppleScript-Users <email@hidden>
  • Date: Mon, 27 Apr 2020 18:55:01 -0700

Hello David,

In this case, it is for a menu shortcut (Skip 30 sec: ⇧⌘→).

Thank you for the idea. This seems to work:

tell application "System Events" to tell process "Podcasts"
        click (menu item 1 where its name starts with "Skip") of menu 1 of menu
bar item "Controls" of menu bar 1
end tell

Hooray! Thanks all!

Sincerely,

Jim

> On Apr 27, 2020, at 6:35 pm, David Gregg <email@hidden> wrote:
>
> Jim,
>
> If the command you are using is related to a menu shortcut then you might be
> able to use the actual menu triggering. I have found that menus and some
> window manipulation can be done without having to activate the app. Every
> other activity with System Events or GUI scripting requires you to have the
> app active.
>
> David
>
>> On Apr 27, 2020, at 6:30 PM, Jim Krenz via AppleScript-Users
>> <email@hidden> wrote:
>>
>> Hello Yvan,
>>
>> Thank you for the script. Unfortunately, it activates the Podcasts app,
>> which is something I don’t want to do. It even activates if I remove the
>> tell application "Podcasts" to activate line.
>>
>> As I mentioned in my request, I want to send the command to the Podcasts app
>> without activating it.
>>
>> Sincerely,
>>
>> Jim
>>
>>> On Apr 27, 2020, at 1:28 am, Yvan KOENIG via AppleScript-Users
>>> <email@hidden> wrote:
>>>
>>>
>>>> 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
>>
>> _______________________________________________
>> 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
>

 _______________________________________________
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

References: 
 >Is there a way to send a keystroke to a background app without an AppleScript dictionary? (From: Jim Krenz via AppleScript-Users <email@hidden>)
 >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>)
 >Re: Is there a way to send a keystroke to a background app without an AppleScript dictionary? (From: Jim Krenz via AppleScript-Users <email@hidden>)
 >Re: Is there a way to send a keystroke to a background app without an AppleScript dictionary? (From: David Gregg via AppleScript-Users <email@hidden>)

  • Prev by Date: Re: Is there a way to send a keystroke to a background app without an AppleScript dictionary?
  • Next by Date: Music app and play with once
  • Previous by thread: Re: Is there a way to send a keystroke to a background app without an AppleScript dictionary?
  • Next by thread: Music app and play with once
  • Index(es):
    • Date
    • Thread