I found this script while searching around that scrolls a text field horizontally when a button is clicked. this is the script:
on clicked the_object
set object_name to name of the_object as Unicode text
if object_name = "scroll" then
tell text field "scroll_text" of window "main"
set the_string to string value
repeat with i from 1 to (count the_string)
set string value to the_string's text i thru -1
delay 0.1
end repeat
set string value to the_string
end tell
end if
end clicked
What I want it to do is scroll automatically if the text (the track, artist and album name) is too long. This is my method for handling all the track info, and it’s probably where the code will go.
on tracktext()
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to (name of the current track as string)
set cur_artist to (artist of the current track as string)
set cur_album to (album of the current track as string)
if (count artwork of current track) > 0 then
set cur_art to data of artwork 1 of the current track as picture
else
set cur_art to missing value
end if
else
set cur_song to "No song"
set cur_artist to "currently"
set cur_album to "playing"
set cur_art to missing value
end if
end tell
end using terms from
(* Update the Text Fields *)
tell tab view item "controller_tab" of tab view "my_tab" of window "mainWindow"
set content of text field "title_text" to cur_song-- I want this,
set content of text field "artist_text" to cur_artist--this,
set content of text field "album_text" to cur_album-- and this to scroll if they are longer than the text field
end tell
call method "displayArtworkInImageView:trackHasArtwork:" of class "ArtworkController" with parameters {imageView, (cur_art is not missing value)}
end tracktext
Thanks in advance!!