Как поменять пространство с appleScript - PullRequest
1 голос
/ 04 августа 2011

У меня есть следующий appleScript, чтобы пропустить песни в spotify.Если я вызываю сценарий, когда полноэкранное приложение является передним, приложение не будет видно после завершения сценария.Это будет в другом пространстве.Есть ли способ, с помощью которого я могу снова сделать переднее приложение видимым с помощью applecript?

set front_app to (path to frontmost application as Unicode text)

tell application "Spotify"
   next track
end tell

tell application front_app to activate

Ответы [ 2 ]

2 голосов
/ 05 августа 2011

Это, вероятно, ни к чему вас не приведет, но вы можете использовать этот скрипт для циклического прохождения всех ваших пробелов, пока не увидите приложение, на которое вы нацелены ...

set front_application to current application
tell application "Spotify" to next track
tell application "Finder" to set collapsed of front_application to false --makes sure the app isn't minimized
repeat
    tell application "System Events" to keystroke (ASCII character 29) using {control down}
    display dialog "Correct space?" buttons{"OK"} default button 1 giving up after 4 --don't click 'OK' if the current space isn't showing the target application
    if gave up of the result is false then exit repeat
end repeat
1 голос
/ 04 августа 2011
set front_app to current application

tell application "Spotify"
   next track
end tell

tell front_app to activate
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...