如何在不使用 Apple 腳本中的「按鍵」的情況下切換空格?

如何在不使用 Apple 腳本中的「按鍵」的情況下切換空格?

我想運行一個遵循以下步驟的蘋果腳本-

  1. 讓網頁瀏覽器全螢幕顯示
  2. 打開另一個禁用我的鍵盤的應用程式
  3. 返回網頁瀏覽器

當我使網頁瀏覽器全螢幕顯示時,它會移動到當前空間右側的一個空間。

如果我寫類似的東西tell applications Web Browser to activate,它將進入一個活動窗口,但不一定是全螢幕窗口。如果有任何其他視窗打開,那麼它將轉到該視窗。

這是我到目前為止的腳本

tell application "Firefox"
    activate
    tell application "System Events"
        keystroke "n" using {command down}
    end tell
end tell
    
tell application "Firefox"
    activate
    tell application "System Events"
        keystroke "f" using {command down, control down}
    end tell
end tell

tell application "KeyboardCleanTool"
    activate
end tell

我現在想返回 Firefox 視窗。

相關內容