Jump to content

Rich20

Members
  • Content Count

    7
  • Joined

  • Last visited

Posts posted by Rich20


  1. Sucess!

     

    Correct script is

     

     

    on run

    set info to ""

    tell application "System Events"

    set runCount to count (every process whose name is "iTunes")

    end tell

    if runCount > 0 then

    tell application "iTunes"

    if player state is playing then

     

    set _lyrics to lyrics of current track

    set timetotal to duration of current track

    set midtime to timetotal / 2

    set thirdtime to timetotal / 3

     

     

    set par_count to (count paragraphs in _lyrics)

     

    if par_count ≥ 40 then

     

    set fParagraphs1 to paragraphs 10 thru 40 of _lyrics

    set fParagraphs2 to paragraphs 41 thru -1 of _lyrics

    set AppleScript's text item delimiters to return

    set fContents1 to fParagraphs1 as string

    set fContents2 to fParagraphs2 as string

    if player positionmidtime then

    set info to fContents1 as string

    else

    set info to fContents2 as string

     

     

    end if

     

     

    if par_count ≥ 90 then

     

    set fParagraphs1 to paragraphs 10 thru 40 of _lyrics

    set fParagraphs2 to paragraphs 41 thru 80 of _lyrics

    set fParagraphs3 to paragraphs 81 thru -1 of _lyrics

    set AppleScript's text item delimiters to return

    set fContents1 to fParagraphs1 as string

    set fContents2 to fParagraphs2 as string

    set fContents3 to fParagraphs3 as string

     

    if timetofinishthirdtime then

    set info to fContents1 as string

    if player position > thirdtime and player positionthirdtime * 2 then

    set info to fContents2 as string

    else

    set info to fContents3 as string

     

    end if

     

     

     

    if par_count < 40 then

    set fParagraphs to paragraphs 9 thru -1 of _lyrics

    set AppleScript's text item delimiters to return

    set fContentsNew to fParagraphs as string

    set info to fContentsNew as string

     

    end if

    end if

    end if

    end if

    end if

    end tell

    end if

    return info

    end run

     

     

    Thank you for having a look. Hope this helps someone.


  2. Hi everyone!

     

    I am trying to create a script that needs to

     

    -fetch lyrics of current song playing in iTunes-success

    -trim the first 10 lines of text in the lyrics-success

    -count the number of lines in the lyrics and split them in groups of 40 lines-success

    -Display the groups one after the other as the current song is playing-failure

     

    I will then use this script in a Geeklet.

     

    on run

    set info to ""

    tell application "System Events"

    set runCount to count (every process whose name is "iTunes")

    end tell

    if runCount > 0 then

    tell application "iTunes"

    if player state is playing then

     

    set _lyrics to lyrics of current track

    set timetotal to duration of current track

    set midtime to timetotal / 2

    set timetofinish to player position

     

     

    if paragraphs of _lyrics ≤ 40 then

     

    set fParagraphs to paragraphs 10 thru -1 of _lyrics

    set AppleScript's text item delimiters to return

    set fContentsNew to fParagraphs as string

    set info to fContentsNew as string

     

    else

     

    set fParagraphs1 to paragraphs 10 thru 40 of _lyrics

    set fParagraphs2 to paragraphs 41 thru -1 of _lyrics

    set AppleScript's text item delimiters to return

    set fContents1 to fParagraphs1 as string

    set fContents2 to fParagraphs2 as string

     

    if timetofinishmidtime then

    set info to fContents1 as string

    else

    set info to fContents2 as string

     

     

    end if

     

     

    end if

    end if

    end tell

    end if

    return info

    end run

     

     

     

    Even if the script compiles it is not working and I am a bit confused with the lyrics splitting part.

     

    Any help would be greatly appreciated! Thank you

     


  3. Hi all,

     

    with the help of eep357 in http://www.insanelym...h-osx-1058-ppc/

     

    I finally worked out my first script on PPC 10.5.8.

     

    the script opens iTunes and then does other stuff (see topic if interested).

     

    Of course I can't stop there :)

     

     

     

     

    So the first thing is very simple

     

     

    tell application "iTunes" to activate

     

     

    Now,

    at the bottom left of the iTunes window, sits the "selected item" panel. When you click on this built-in feature---if and only if a song selected from the main library is playing --- the artwork window pops up, it automatically resizes and positions itself exactly as you left it the last time you closed iTunes. and it automatically shows artwork according to the song that is played. If you then play songs from a playlist, the window stays there and keeps showing the artworks. It's gorgeous.

     

    I am desperately trying to have my script open that artwork window, then resize the iTunes main window to mini player.

     

    I have searched and found scripts allowing clicking at certain places on the screen, but Script Editor crashes when I try to compile them.

     

    Plus I am sure that there are much more simple ways.

     

    Thanks a million for submitting your ideas or tips, this activity is very time consuming and I appreciate the effort.

     

    Cheers :)


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


  5. 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!


  6. 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

×