I'm trying to pause/unpause QuickTime Player with a little dictation command:

on run
    activate application "QuickTime Player"
    tell application "System Events"
        click "play/pause" of window 1
    end tell
end run

When I test this, I get the error message Can’t get "play/pause" of window 1. Access not allowed. Is there any way around this?


  • Please post your code instead of a picture of it. Is there a particular reason you are trying to script the user interface instead of just using terms from QuickTime Player's scripting dictionary? – red_menace Apr 8 '19 at 12:43
  • Sorry, I just edited the question. And there is no reason I'm trying to script the UI, I was just unaware there is scripting dictionaries. Thank you! – th4t gi Apr 10 '19 at 0:48

I guess the answer to my question is to use the scripting dictionary for QTP instead of the using the UI. The website I got my code from is here and the code I'm using is below:

set movieFile to (path to me) & name of front window of application "QuickTime Player"

tell application "QuickTime Player"
        set isPlaying to get playing of document 1
    on error
        open movieFile
    end try
    if isPlaying is true then
        set the looping of document 1 to true
        play document 1
    end if
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .