Apple Script で `keystroke` を使用せずにスペースを切り替えるにはどうすればよいですか?

Apple Script で `keystroke` を使用せずにスペースを切り替えるにはどうすればよいですか?

以下の手順でAppleスクリプトを実行したいと思います。

  1. ウェブブラウザを全画面にする
  2. キーボードを無効にする別のアプリケーションを開く
  3. ウェブブラウザに戻る

Web ブラウザを全画面にすると、現在のスペースの 1 つ右のスペースに移動します。

次のように記述すると、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 ウィンドウに戻りたいと思います。

関連情報