編輯:我試圖從使用AppleScript的Web代理調試應用程序Charles(http://www.charlesproxy.com/)保存會話文件。基本上,我選擇「導出」,輸入臨時名稱,然後保存。但是,在單擊組合框2(即「格式」區域)後,嘗試單擊彈出按鈕「XML會話文件(.xml)」後,Applescript編輯器會拋出一個錯誤,指出它找不到它。Charles和AppleScript(在輔助功能檢查器中缺失值)
目前我用下面的代碼入侵它,但由於某些原因,它只能在Applescript編輯器中工作,有時在Terminal /我的代碼中工作,特別是當我在同一時間執行其他操作時。
tell application "Charles"
activate
end tell
tell application "System Events"
tell process "Charles"
tell menu bar 1
click menu bar item "File"
tell menu "File"
click menu item "Export..."
end tell
end tell
tell window "Save"
keystroke "tempCharles"
delay 0.5
click combo box 2
delay 0.5
key code 125 -- down arrow
delay 0.2
key code 125
delay 0.2
key code 125
delay 0.2
key code 125
delay 0.2
keystroke return
delay 0.4
keystroke return
delay 0.4
keystroke return
end tell
end tell
end tell
我想我的代碼看起來像這樣
tell window "Save"
keystroke "tempCharles.xml"
delay 3
click combo box 2
tell combo box 2
click pop up button "XML Session File (.xml)"
end tell
click button "Save"
end tell
任何黑客是好的了。在發佈之前,嘗試在終端上運行「osascript」以檢查它是否通過AppleScript編輯器工作。