Mac版がに対応していますので、Wineを使用してMacにWarcraft3:TFTを最近インストールしました Lion。 AppleScriptを使ってワイン用のターミナルコマンドを実行してホットコーナーを無効にするスクリプトを書いたので、画面をナビゲートする際に問題はありません。AppleScriptはスクリプトとして実行されますが、アプリケーションとしては実行されません。
私はスクリプトを書いており、Applescript(コンパイル>実行)で正常に動作します。実際の問題は、スクリプトをアプリケーションとして保存しようとするときに発生します。
set settings1 to {"-", "Desktop", "Start Screen Saver", "Mission Control"}
set settings2 to {"-", "-", "-", "-"}
tell application "Terminal"
do script "/opt/local/bin/wine ~/.wine/drive_c/Program\\ Files/Warcraft\\ III/war3.exe"
end tell
tell application "System Preferences"
reveal pane id "com.apple.preference.expose"
activate
tell application "System Events"
tell window "Mission Control" of process "System Preferences"
click button "Hot Corners…"
tell sheet 1
tell group 1
set theSettings to settings2
set functionKeys to false
repeat with k from 1 to 4
set theValue to item k of theSettings
tell pop up button k
if value is not theValue then
click
click menu item theValue of menu 1
end if
end tell
end repeat
end tell
click button "OK"
end tell
end tell
end tell
quit
end tell
display alert "Done playing?" buttons {"Yes"}
set response to button returned of the result
if response is "Yes" then
--Start return to normal settings
tell application "System Preferences"
reveal pane id "com.apple.preference.expose"
activate
tell application "System Events"
tell window "Mission Control" of process "System Preferences"
click button "Hot Corners…"
tell sheet 1
tell group 1
set theSettings to settings1
set functionKeys to true
repeat with k from 1 to 4
set theValue to item k of theSettings
tell pop up button k
if value is not theValue then
click
click menu item theValue of menu 1
end if
end tell
end repeat
end tell
click button "OK"
end tell
end tell
end tell
quit
end tell
--End return to normal settings
--quit X11 and terminal
tell application "X11"
quit
end tell
tell application "Terminal"
quit
end tell
end if
:スクリプト自体がされてここ
:このエラーを取得する - 私は、アプリケーションとして保存してから(「フローズン・スローンウォークラフトIII」という名前の)アプリケーションを実行しよう
これは私がApplescriptで実際に書いた初めてのことなので、私が見ていない何らかのエラーがあるかもしれません。アドバイスやご意見をお寄せいただきありがとうございます!
レスポンスとライオンの公開情報に感謝します。私はちょっと混乱していますが、設定のいずれかがどこにでも保存されているとは思われません。正しい設定を復元しているかどうかはどのようにわかりますか? AppleScript:/ – wchristiansen
@Floofer:AppleScriptプロパティの設定を最初の行に保存しています。プロパティは、スクリプトの実行後に保持されます(スクリプトが再コンパイルされたときにのみ再初期化されます)。 [Apple Script Language Guide](https://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_variables.html#//apple_ref/doc/uid/TP40000983-CH223-SW10) )は、プロパティとそのスコープに関するすべての細部の細部を持っています。 – kopischke
@Floofer:ああ...ちょうどあなたの問題があります(別のコメントを追加して申し訳ありません.5分の編集ウィンドウが経過しました):スクリプトはあなたの現在の設定を上記のプロパティに保存します。つまり、これらをスクリプトにハードコードする必要はなく、スクリプトは常に見つかった状態に復元されます。 注意ハンドラのみを提供しました。 'do shell script'行と、提供された2つのハンドラへの呼び出しとquitコマンドを追加する必要があります(これは、一言で言えば'アプリケーションに通知して終了する 'X11)。 – kopischke