reposting (some of my messages seem to be getting lost again)
--- In [email protected], "quantiworks" <quanticwo...@...> wrote:
>
> I also found this:
>
> http://www.maximized.com/freeware/ScriptsForiTunes/
>
> I extracted the contents of the setup file and inspecting all the .vbs I see
> one for query the current state:
Well that one doesn't tell us if there is no track (there can be a current
track even when the player is stopped).
Try this one, GetTrack suppresses error messages and seems to work ok from a
bar button label.
Regards,
Sheri
Function GetTrack()
static iTunesApp Track
if (not anywindow("=iTunes")) do
if (iTunesApp == "") do
quit("iTunes is not running")
else
local com_status
com.release(iTunesApp)
com.unload
Track=""
iTunesApp=""
quit("iTunes is not running")
endif
endif
local com_status
if (iTunesApp=="")
inititunes()
_LastError_=""
Exec.OnError("none")
Track= iTunesApp.CurrentTrack
if (_LastError_!=="") do
_LastError_=""
Exec.OnError("display")
quit("N/A")
endif
local tname=Track.Name
if (_LastError_ !=="")
tname="N/A"
_LastError_=""
local tartist=Track.Artist
if (_LastError_ !=="")
tartist="N/A"
com.release(Track)
_LastError_=""
Exec.OnError("display")
Track=""
quit(tartist++"-"++tname)
;------------------------------
Function initItunes()
local com_status
iTunesApp = com.create_object("iTunes.Application")
quit
;------------------------------
Function Play()
if (not anywindow("=iTunes"))
quit
static itunesApp
if (itunesApp=="")
quit
local com_status
itunesApp.PlayPause
quit
;------------------------------
Function Next()
if (not anywindow("=iTunes"))
quit
static itunesApp
if (itunesApp=="")
quit
local com_status
itunesApp.NextTrack
quit
;------------------------------
Function Previous()
if (not anywindow("=iTunes"))
quit
static itunesApp
if (itunesApp=="")
quit
local com_status
itunesApp.PreviousTrack
quit
;------------------------------
Function Stop()
if (not anywindow("=iTunes"))
quit
static itunesApp
if (itunesApp=="")
quit
local com_status
itunesApp.Stop
quit
;------------------------------