• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: tell a script to tend to system process for X amount of time?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tell a script to tend to system process for X amount of time?


  • Subject: Re: tell a script to tend to system process for X amount of time?
  • From: "Patrick Collins" <email@hidden>
  • Date: Thu, 17 Mar 2005 02:49:06 -0800 (PST)
  • Organization: Collinator Studios

>>I mean: make a script with an idle handler such as:


on idle
dosomethingcool()
return 3
end idle

then you save it as an application in Script Editor and, ta-da, you have an applet with an idle handler.


Emmanuel
>>



ok as of now, I have done what you suggested..  I want two different pauses-- so I couldnt have an idle handler do both......  So I had to put one sleep event in there..  Is there another way I should handle this?

-patrick


on idle
    tell application "System Events"
        if (exists process "iChat") and (exists process "iTunes") then
            set theBand to "Unknown Artist"
            set theTitle to "Unknown Track"
            try
                tell application "iTunes"
                    if player state is playing then
                        if the artist of current track is not "" then
                            set theBand to artist of current track
                            set ichatMessage to "Artist: " & theBand
                        end if
                        if the name of the current track is not "" then
                            set theTitle to name of current track
                            set ichatMessage to ichatMessage & " - Title: " & theTitle
                        end if
                        tell application "iChat"
                            set status message to ichatMessage
                        end tell
                    end if
                    if player state is not playing then
                        if player state is paused then
                            set playerState to "paused"
                        end if
                        if player state is stopped then
                            set playerState to "stopped"
                        end if
                        if player state is fast forwarding then
                            set playerState to "skipping forward"
                        end if
                        if player state is rewinding then
                            set playerState to "skipping back"
                        end if
                        tell application "iChat"
                            set status message to "iTunes is " & playerState & "."
                        end tell
                    end if
                end tell
            end try
        end if
    end tell
    do shell script "sleep 15"
    tell application "System Events"
        if (exists process "iChat") and (exists process "iTunes") then
            set theBand to "Unknown Artist"
            set theTitle to "Unknown Track"
            try
                tell application "iTunes"
                    if player state is playing then
                        if the artist of current track is not "" then
                            set theBand to composer of current track
                            set ichatMessage to "Composer: " & theBand
                        end if
                        if the name of the current track is not "" then
                            set theTitle to album of current track
                            set ichatMessage to ichatMessage & " - Album: " & theTitle
                        end if
                        tell application "iChat"
                            set status message to ichatMessage
                        end tell
                    end if
                    if player state is not playing then
                        if player state is paused then
                            set playerState to "paused"
                        end if
                        if player state is stopped then
                            set playerState to "stopped"
                        end if
                        if player state is fast forwarding then
                            set playerState to "skipping forward"
                        end if
                        if player state is rewinding then
                            set playerState to "skipping back"
                        end if
                        tell application "iChat"
                            set status message to "iTunes is " & playerState & "."
                        end tell
                    end if
                end tell
            end try
        end if
    end tell
    return 5
end idle

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: tell a script to tend to system process for X amount of time?
      • From: Neil Faiman <email@hidden>
  • Prev by Date: Save image from raw data class variable
  • Next by Date: Re: display dialog
  • Previous by thread: Re: tell a script to tend to system process for X amount of time?
  • Next by thread: Re: tell a script to tend to system process for X amount of time?
  • Index(es):
    • Date
    • Thread