samedi 24 février 2018

Applescript command encountering error after closing chrome window

So I have been working on a project to mess around with some of my coding friends. I am trying to make an AppleScript application that tells Chrome to go back a page when run and I want it to run all the time. I have had to base it off of whether or not chrome has an active window open or not, I managed to get it to work so far but when I put in the repeated "Go back" command it comes up with an error message saying can't get window 1.

This is the code I am using. I am using High Sierra if that makes a difference.

repeat
    if application "Google Chrome" is running then
        repeat
            tell application "Google Chrome"
                if exists (window 1 of application "Google Chrome") then
                    repeat while exists (window 1 of application "Google Chrome")
                        go back tab of window 1
                    end repeat
                end if
            end tell
        end repeat
    end if
end repeat

Aucun commentaire:

Enregistrer un commentaire