目前我有这个工作代码:
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) - 这将带回现场专辑的日期。我现在想取结果"返回相同文字1到10的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"
......有意义吗?任何帮助将不胜感激。谢谢!
答案 0 :(得分: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