Jump to content

iTunes script working with Lion but not with OSX 10.5.8 PPC


Rich20
 Share

8 posts in this topic

Recommended Posts

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

Link to comment
Share on other sites

Thanks for your reply eep357!

 

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!

Link to comment
Share on other sites

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:

 

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

  • Like 1
Link to comment
Share on other sites

Hi5! A nice, simple, clean script really is a beautiful thing :thumbsup_anim:

 

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

Link to comment
Share on other sites

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! :) ++++

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...