0

目前我有这个工作代码:

on run
set info to ""
tell application "System Events"
    set num to count (every process whose name is "iTunes")
end tell
if num > 0 then
    tell application "iTunes"
        if player state is playing then
            set albumName to (get album of current track)
        end if
    end tell
end if
return text 1 thru 10 of albumName
end run

如果正在运行的 iTunes 和现场专辑的格式正确(YYYY-MM-DD) - 这将带回现场专辑的日期。我现在想获取“返回 text 1 thru 10 of albumName”的结果并将其添加到此代码中:

tell application "Firefox" to activate
tell application "Firefox"
open location "http://someband.com/showID=" &  *[insert code for "text 1 thr 10 of albumName" variable]*
end tell

我知道“&”不正确,但我认为这是开始。这应该起作用的方式是,如果我正在收听“2013-03-12 Live on StackOverflow”,我希望脚本采用“2013-03-12”并将其附加到我的链接,以便 Firefox 打开网站地址:“ http: //someband.com/showID=2013-03-12 "

...说得通?任何帮助将不胜感激。谢谢!

4

1 回答 1

1

尝试:

if application "iTunes" is not running then return

tell application "iTunes"
    if player state is playing then
        set albumName to (get album of current track)
    end if
end tell

set myText to text 1 thru 10 of albumName

-- Assuming Firefox is your default browser…
open location "http://someband.com/showID=" & myText
于 2013-03-12T16:06:26.147 回答