Otwórz adres URL i aktywuj Google Chrome za pomocą Applescript

Mam następujący AppleScript, który napisałem wiele lat temu. Używam tego kodu do programowania przycisków na moim uniwersalnym pilocie Harmony One, aby uzyskać dostęp do usług wideo online za pośrednictwem Google Chrome. Kod nie działa. Google Chrome nie uruchamia się. Uruchamiam Kod przez RemoteBuddy. Kod jest zgodny dobrze, ale nie działa.

Ktoś ma jakieś przemyślenia na temat tego, co może być problemem, lub Jak mogę poprawić skrypt, aby działał?

tell application "System Events" to set open_applications to (name of everyprocess)
if (open_applications contains "Google Chrome") is true then
        tell application "Google Chrome" to quit
else
        tell application "Google Chrome"
                activate
                open location "http://xfinitytv.comcast.net"
        end tell
        delay 1
        tell application "Google Chrome" to activate
end if
Author: ATLChris, 2014-03-01

2 answers

Spróbuj w ten sposób:

tell application "Google Chrome"
    if it is running then
        quit
    else
        activate
        open location "http://xfinitytv.comcast.net"
        delay 1
        activate
    end if
end tell



Uwaga: używa nowszego " ulepszonego modelu aplikacji "(druga linia), więcej informacji tutaj:
Jak sprawdzić w AppleScript, czy aplikacja jest uruchomiona, bez jej uruchamiania - za pomocą narzędzia osascript

 25
Author: Community,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-05-23 11:53:40
tell application "Google Chrome"
    open location "http://WEBSITEHERE.com"
end tell
 2
Author: Duckyy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-12-30 00:26:21