I’m goofing off making an iTunes controller. (to learn)
Originally I had the progress bar as an indicator of the progression of the song, now I’m doing it with a slider. The slider works…kind of. I have to either drag the slider to where I want it, or double click it (I have to double click it juuuuust right) for it to go to where I want in the song. Otherwise, it just jumps back to the beginning of the song. This is annoying. I’ve tried everything, searched google, here, high and low.
Heres my code:
[code]else if the name of theObject = “placeSlider” then
tell application “System Events”
set iTunes to ((application processes whose (name is equal to “iTunes”)) count)
end tell
if iTunes is greater than 0 then
tell application “iTunes”
set j to (duration of current track)
end tell
set the maximum value of slider “placeSlider” of window “mainWindow” to j
set thePlace to the contents of slider “placeSlider” of window “mainWindow” as integer
tell application "iTunes"
set player position to thePlace
end tell
end if[/code]
and my code for getting the info (ignore the part about the volume)
on idle theObject
tell application "System Events"
set iTunes to ((application processes whose (name is equal to "iTunes")) count)
end tell
if iTunes is greater than 0 then
try
using terms from application "iTunes"
tell application "iTunes" to get player state as string
end using terms from
if result is not "stopped" then
tell application "iTunes"
set j to (duration of current track) / 60 as string
set k to (player position) / 60 as string
set l to name of current track
set m to artist of current track
set thevolume to sound volume
end tell
set contents of text field "songText" of box "songBox" of window "mainWindow" to l
set contents of text field "artistText" of box "songBox" of window "mainWindow" to m
set enabled of slider of window "mainWindow" to true
set the contents of slider "volumeslider" of window "mainWindow" to thevolume
set the maximum value of slider "placeSlider" of window "mainWindow" to j
set the contents of slider "placeSlider" of window "mainWindow" to k
end if
on error
return ""
end try
end if
return 1
end idle