我正在尝试为iTunes创建一个简单的国际商店。
set country to (choose from list {"US", "CA", "UK"} with prompt "What country?")
if country = "US" then
tell application "iTunes"
activate
open location "itmss://itunes.apple.com/WebObjects/MZStore.woa/wa/switchToStoreFront?storeFrontId=143441"
end tell
end if
当我点击美国时,它对iTunes没有任何作用。我做错了什么?
答案 0 :(得分:1)
问题是choose from list
命令正在返回从列表中选择的项目列表。您可以执行以下操作:
set country to (choose from list {"US", "CA", "UK"} with prompt "What country?")
if country = {"US"} then
tell application "iTunes"
activate
open location "itmss://itunes.apple.com/WebObjects/MZStore.woa/wa/switchToStoreFront?storeFrontId=143441"
end tell
end if
或者,您可以说if item 1 of country = "US"
。
答案 1 :(得分:0)
尝试
if country as text = "US" then