1

我正在尝试为 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 没有任何作用。我究竟做错了什么?

4

2 回答 2

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".

于 2012-10-30T21:02:52.023 回答
0

尝试

if country as text = "US" then
于 2012-10-30T18:53:31.627 回答