Hi all,
As a newbie I am only getting started with scripts and have written down a script that works with 10.8. (not perfectly though)
The script takes the genre of the song playing in iTunes, and changes the Desktop picture accordingly. If I try to run it on a PowerMac G5 it seems like it works on Script editor, no error message appears, only it doesn't change the picture.
Could you give me a few hints on how I could make this work on OSX 10.5.8 PPC?
repeat
tell application "iTunes"
if player state is playing then
set myAlbum to (get genre of current track)
tell application "System Events"
tell current desktop
set picture to file {"Untitled1:Users:raffle:Desktop:" & myAlbum & ".png"}
end tell
end tell
end if
if not application "iTunes" is running then exit repeat
end tell
end repeat
Thanks very much in advance.
Rich
iTunes script working with Lion but not with OSX 10.5.8 PPC
Started by Rich20, Nov 20 2012 09:04 PM
7 replies to this topic
#1
Posted 20 November 2012 - 09:04 PM
#2
Posted 21 November 2012 - 01:10 AM
my guess would be an error in the naming of your file path.
#3
Posted 21 November 2012 - 02:06 AM
I checked the path and it appears correct. I modified the script a bit.
I put a picture called Jazz.png in "Untitled 1/Styles/"
and played a song with genre set as "Jazz"
and run this:
tell application "iTunes"
if player state is playing then
set myAlbum to (get genre of current track)
tell application "System Events"
tell current desktop
set picture to file {"MacOSX:Untitled1:Styles:" & myAlbum & ".png"}
end tell
end tell
end if
end tell
...to no avail.
The event log reads:
tell application "iTunes"
get player state
playing
get genre of current track
"Jazz"
end tell
tell application "System Events"
set picture of current desktop to file {"MacOSXUntitled1:Styles:Jazz.png"} of current desktop
end tell
my first script had the effect of always bringing the default macOS purple-ish wallpaper and the new one doesn't.
if anyone has an idea, or even an old "change desktop picture" script working on PPC 10.5 so I can check how to complete this...
thanks for your help!
#4
Posted 21 November 2012 - 12:23 PM
Here, this should work as long as assisted devices are enabled in Universal Access. The file path will need minor adjustment for you, as I had a 2nd partition called Untitled 1 which was not my root partition, so assuming Untitled 1 were your root partition just remove Volumes and that's it:
The "as alias" part tripped me up for a while, doesn't work without it
repeat
tell application "iTunes"
if player state is playing then
set myAlbum to (get genre of current track)
set theFile to ("Volumes:Untitled 1:Styles:" & myAlbum & ".png")
tell application "Finder"
set desktop picture to theFile as alias
end tell
else
exit repeat
end if
end tell
end repeat
The "as alias" part tripped me up for a while, doesn't work without it
#5
Posted 21 November 2012 - 12:57 PM
eep357...it's working!
You solved this issue for me and I wish to thank you for the help you provided me!
You solved this issue for me and I wish to thank you for the help you provided me!
#6
Posted 21 November 2012 - 01:08 PM
Hi5! A nice, simple, clean script really is a beautiful thing 
A good little twist to it would be to have the script launch iTunes, so launching the script kills 2 birds so to speak, and don't really need the "else" other than to maybe kill it after you have reclosed iTunes. Otherwise it's gonna kill it's self if iTunes isn't running anyway, so what launches it?
could have it auto play a playlist or something on launch, or just have a delay before it would kill it's self giving you time to browse for a song to play
A good little twist to it would be to have the script launch iTunes, so launching the script kills 2 birds so to speak, and don't really need the "else" other than to maybe kill it after you have reclosed iTunes. Otherwise it's gonna kill it's self if iTunes isn't running anyway, so what launches it?
could have it auto play a playlist or something on launch, or just have a delay before it would kill it's self giving you time to browse for a song to play
#7
Posted 22 November 2012 - 01:39 AM
Hi,
following your idea, i have modified the script in order to lauch iTunes.
It is working and it shows a specific backgroud if the player is stopped.
tell application "iTunes" to activate
repeat
tell application "iTunes"
if not player state is playing then
tell application "Finder"
set desktop picture to ("Untitled 1:Styles:notplaying.png") as alias
end tell
end if
if player state is playing then
set myAlbum to (get genre of current track)
set theFile to ("Untitled 1:Styles:" & myAlbum & ".png")
tell application "Finder"
set desktop picture to theFile as alias
end tell
end if
end tell
end repeat
+++Reason for edit: issue resolved--though if anyone has a bit of code he wants to add, or an idea to make it better, jump in!
++++
following your idea, i have modified the script in order to lauch iTunes.
It is working and it shows a specific backgroud if the player is stopped.
tell application "iTunes" to activate
repeat
tell application "iTunes"
if not player state is playing then
tell application "Finder"
set desktop picture to ("Untitled 1:Styles:notplaying.png") as alias
end tell
end if
if player state is playing then
set myAlbum to (get genre of current track)
set theFile to ("Untitled 1:Styles:" & myAlbum & ".png")
tell application "Finder"
set desktop picture to theFile as alias
end tell
end if
end tell
end repeat
+++Reason for edit: issue resolved--though if anyone has a bit of code he wants to add, or an idea to make it better, jump in!
#8
Posted 22 November 2012 - 10:16 AM
I like it as is so long as it doesn't use CPU power running in the background after closing itunes
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users



Sign In
Create Account








