Announcement

Collapse
No announcement yet.

Auto-Play iTunes on Wake Up?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Auto-Play iTunes on Wake Up?

    Hi. Quick question. Is there any way to have iTunes automatically play when the computer wakes up?

  • #2
    Maybe this will help: http://www.dougscripts.com/itunes/sc...essomeplaylist
    How to bring a laptop out of standby with WOL features

    Comment


    • #3
      Originally posted by timeshifter View Post
      im not sure if any of those scripts will help when just coming out of sleep. the only one there just starts itunes from boot up.

      is there any setting to allow or "force" itunes to start playing wherever it left off when put to sleep?
      Check out the new version of NAS, a cross platform music frontend here

      Comment


      • #4
        yeah thats what im looking to do as well. i could have sworn theres a way to do this with applescript but I havent touched applescript in about 6 or 7 years so Im clueless at this point.

        Comment


        • #5
          There is. I wrote a front end in Applescript and had to solve this problem straight away. However, you have to make the Applescript into an application and have it running all the time.

          Use the 'idle handler' which loops each time there are spare cycles on the CPU. Each time you loop, check the status of iTunes. If it is paused, tell it to play.

          Of course, the only way to pause iTunes once this app is running is to quit the app or quit iTunes. You can work around it if your app is a frontend or controller for iTunes but I don't think you can if it isn't.


          The code is something along these lines (I didn't test it). You can cut and paste it into the Applescript editor, then save it as an application.

          on idle
          tell application "iTunes"
          if player state is paused or player state is stopped then
          play
          end if
          end tell
          end idle

          ***Edit - wait, it's not that simple. I tested it and the idle handler doesn't work. I'll have to investigate further when I have some time***
          Originally posted by ghettocruzer
          I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
          Want to:
          -Find out about the new iBug iPad install?
          -Find out about carPC's in just 5 minutes? View the Car PC 101 video

          Comment


          • #6
            ok so i did some reading up on apple script and i finally got bugbyte's code to work. Here is what you need to do to make this work. in script editior enter in

            on idle
            tell application "iTunes"
            if player state is paused or player state is stopped then
            play
            end if
            end tell
            return 1
            end idle

            when you save this file make sure you save the script as an application and then check the "stay open" box at the bottom of the "save as" window.
            if you do everything correctly then you can run this app and it will check every second to see if itunes is paused. i checked it on my system and it seems to work great. if you have any problems pm me and i will see if i can help. thanks bug byte for your help on this.
            Check out the new version of NAS, a cross platform music frontend here

            Comment


            • #7
              Seems to work fine on the mac indoors, will add in the car tomorrow and test...!

              Just need it work within front row to be sure....!
              CLICK ME

              Smart Car due for completion beginning of march....

              Log with pictures to go online shortly after.

              Comment


              • #8
                Was THAT the problem?! Return 1?!

                You know, the on idle loop is a problem. It's not stable. That's the reason we stopped work on our applescript front end. It didn't behave predictably.
                Originally posted by ghettocruzer
                I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
                Want to:
                -Find out about the new iBug iPad install?
                -Find out about carPC's in just 5 minutes? View the Car PC 101 video

                Comment


                • #9
                  Well, the only problem i can actually see with it at the moment, is the fact that you cannot pause iTunes at all....!

                  So if you interrupt for a phone call it could cause a problem, is there a work around for the pause to still work...?
                  CLICK ME

                  Smart Car due for completion beginning of march....

                  Log with pictures to go online shortly after.

                  Comment


                  • #10
                    Originally posted by Bugbyte View Post
                    Was THAT the problem?! Return 1?!

                    You know, the on idle loop is a problem. It's not stable. That's the reason we stopped work on our applescript front end. It didn't behave predictably.
                    yeah actually your code worked you prob just didn't let it run long enough. while i was reading i noticed that the idle handler only checks every 30 seconds or so unless you add the "return" with the number of seconds you want the idle handler to wait before it checks again.
                    Check out the new version of NAS, a cross platform music frontend here

                    Comment


                    • #11
                      is there anyway to set a variable to change values when the machine sleeps?

                      going to sleep changes a variable to a new value.

                      you could have a script check this variable and if its found at the "slept" variable, it changes it back to normal for the next time, for instance:

                      var: 1 = machine slept
                      var: 0 = machine awoke

                      then it will only apply the pause thing when the var = 1. which only occurs for a millisecond after the machine wakes.

                      correct me if im wrong.
                      (All done)
                      iPad Mini 128GB, RF 600.5 amp, JL12W0V2, 8 Infinity Components

                      Comment


                      • #12
                        this sounds like it would work. once again i am just learning applescript. i wonder if there is actually an event handler that deals with sleep mode. if there is then it is def possible. i will do some checking and see what i can find
                        Check out the new version of NAS, a cross platform music frontend here

                        Comment


                        • #13
                          Sleep isn't an issue, it doesn't wake the machine, but some apps need to shut it by using pause, and if this is running it won;t...

                          As an example, if you are in front row listening to music, and come out to start a video, it is all good, the film starts the sound comes through, but the music will start again....
                          CLICK ME

                          Smart Car due for completion beginning of march....

                          Log with pictures to go online shortly after.

                          Comment


                          • #14
                            Originally posted by www.workingcars View Post
                            Sleep isn't an issue, it doesn't wake the machine, but some apps need to shut it by using pause, and if this is running it won;t...

                            As an example, if you are in front row listening to music, and come out to start a video, it is all good, the film starts the sound comes through, but the music will start again....

                            yeah this script was just intended to give a quick solution to ppl using itunes only. one solution for you is to just close the script whenever you need to use another program or use a "quit handler" to automatically quit the script on a certin event, or for your example what i would do is just add on to the script something like this (remember that i am new to applescript and the syntax here may not be correct, i havent had a chance to test this to see if it works or not)

                            if application "quicktime" (or anyother program you want) is open
                            then
                            tell application "itunes"
                            stop
                            end tell
                            end if

                            i would put this within the idle handler that already exists. this should check to first see if quicktime or something else is open then tell itunes to stop so you could play your movie, but this would also make sure that when you return from sleep that itunes will pickup and start playing

                            let me know if this works or if you need anything else

                            *edit - ok so that code is way off. give me some time and i will see if i can figure this out
                            Check out the new version of NAS, a cross platform music frontend here

                            Comment


                            • #15
                              I wasn't moaning, it's just that it seems to work well, now it would work even better if in front row it stopped if you went into movies...

                              I'm not that bothered it is easy enough to quit the script if i want to watch a film... Lol
                              CLICK ME

                              Smart Car due for completion beginning of march....

                              Log with pictures to go online shortly after.

                              Comment

                              Working...
                              X