【发布时间】:2011-01-23 08:19:09
【问题描述】:
我正在尝试制作一个基于 applescript 的应用程序,只需单击一下即可激活/停用网络和 Adium 代理设置。 Adium 部分完成。 我不能做的是做一个 switch/if_then_else 语句来选择: 网络/位置:“自动”和“uMinho”设置。 脚本应选择非活动选项。 有什么想法吗?
这是脚本:
-- Activate Location "uminho"
tell application "Finder" to activate
tell application "System Events"
tell process "Finder"
tell menu bar 1
tell menu bar item "Apple"
tell menu "Apple"
tell menu item "Location"
tell menu "Location"
-- Need to switch between "Automatic" and "uMinho"
-- Switch to the unactive one
click menu item "uMinho"
end tell
end tell
end tell
end tell
end tell
end tell
end tell
-- Activate adium proxy settings to all accounts
tell application "Adium" to activate
-- let's do this
tell application "System Events"
tell process "Adium"
-- open prefs
keystroke "," using command down
tell window 1
-- open the accounts pane
tell tool bar 1 to click button "Accounts"
repeat with i from 1 to count of rows of table 1 of scroll area 1
-- tell group 1
-- select the account
set selected of row i of table 1 of scroll area 1 to true
-- edit it
click button "Edit"
-- end tell
tell sheet 1
tell tab group 1
-- open the personal info pane
click radio button "Proxy"
-- change the name, if one was provided
click checkbox "Connect using proxy"
end tell
click button "OK"
end tell
end repeat
keystroke "w" using command down
end tell
end tell
end tell
【问题讨论】:
标签: user-interface proxy applescript switch-statement