Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 32

Thread: Auto-Play iTunes on Wake Up?

  1. #11
    FLAC sdashiki's Avatar
    Join Date
    Aug 2004
    Location
    Floreeda
    Posts
    1,084
    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.
    (0.0%-) starting over
    iPad 3G 64GB, RF 600.5 amp, JL10W0V2, 8 Infinity Components

  2. #12
    Variable Bitrate natedawgg's Avatar
    Join Date
    Jan 2007
    Location
    Dallas
    Posts
    365
    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

  3. #13
    Constant Bitrate
    Join Date
    Jul 2006
    Location
    London
    Posts
    129
    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.

  4. #14
    Variable Bitrate natedawgg's Avatar
    Join Date
    Jan 2007
    Location
    Dallas
    Posts
    365
    Quote 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

  5. #15
    Constant Bitrate
    Join Date
    Jul 2006
    Location
    London
    Posts
    129
    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.

  6. #16
    Constant Bitrate
    Join Date
    Feb 2006
    Posts
    125
    Alarm Clock 2 i use this as my alarm clock and its GREAT. alarm clock 2. it uses itunes library and playlists and stuff but i dont think itunes has to be open but i may be wrong.

  7. #17
    Variable Bitrate natedawgg's Avatar
    Join Date
    Jan 2007
    Location
    Dallas
    Posts
    365
    thats cool. but try that last bit of code and see if that helps your situation. let me know if it does

  8. #18
    Newbie Count_Fred's Avatar
    Join Date
    Sep 2006
    Location
    Corvallis, OR
    Posts
    5
    I use SleepWatcher (bb's Homepage ) to run various Applescripts at sleep and wake. One of them is to start iTunes playing.


    BugByte: Can you say more about how the idle loop is unstable? I'm about to start using it to pull values off an Arduino (microcontroller board) and haven't had any problems with the code on my test machine so far. Perhaps the instability will show up when I transfer the new code to the mini in the car.

    Cheers,
    JFS III

  9. #19
    Admin. Linux loser.
    Auto Apps:loading...
    Bugbyte's Avatar
    Join Date
    Sep 2004
    Location
    Corning, NY
    Posts
    7,364
    Blog Entries
    2
    Quote Originally Posted by Count_Fred View Post
    BugByte: Can you say more about how the idle loop is unstable? I'm about to start using it to pull values off an Arduino (microcontroller board) and haven't had any problems with the code on my test machine so far.
    Well, it becomes a problem when you have a full featured app programmed. What sealed it for us was that when you clicked a button on the screen, it would light up to show clicked, but it would never un-click. Until you pressed it a SECOND time.

    The way we had it set up, the idle handler was what got called whenever you pressed a button and then routed the action off to the proper script depending on what screen was displayed. This allowed us to reuse buttons from screen to screen and so forth.

    In any case, the idle handler makes it difficult to debug the script because it fires whenever it has time -sometimes in the middle of one of your other scripts running. So the debugger will be following through some code you're trying to debug and then shoots you off to the idle handler over and over. Makes it difficult to debug.

    As for the sleep/wake problem, we did solve that pretty easily. You have to program the script as an application. That allows you to read and write preferences. Once you can do that, you can set those prefs according to what's going on with the various apps on the screen or inputs from the keyboard.

    We had the same issue of not being able to pause iTunes. You get around it by setting a preference when you click a button onscreen or get some keyboard input. Your application 'sets' that preference to pause, then pauses iTunes. Next time through, you compare the application's pause pref with the iTunes state. If they are BOTH pause, then you stay paused.

    Then, when you click the button or hit the key, you set the app's pref to 'play' and next time through, the idle handler compares that to the iTunes state, which is paused. It starts iTunes playing at that point.

    I don't think you can read/write pref files through the script editor, although I could be wrong. You have to use XCode to build an applescript application.
    Quote Originally Posted by ghettocruzer View Post
    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

  10. #20
    Variable Bitrate natedawgg's Avatar
    Join Date
    Jan 2007
    Location
    Dallas
    Posts
    365
    ok everybody here is a script that i edited to help make itunes a bit more managable in the car. due to a battery issue that i have yet to fix in my car, my mac keeps shutting down instead of sleep so i did some searching and came up with this script and edited it a little. this script helps in the event of a reboot or whatever else that causes itunes to shutdown. it will keep an eye on what song you are currently listening to and then when and if itunes is shutdown it will start it back up playing the same song as before.

    ok here it is:

    property Song_To_Start : 1
    property Plist_To_Start : "Library"

    on idle
    tell application "iTunes"
    if player state is paused then
    play
    else if player state is playing then
    copy (name of container of current track) to Plist_To_Start
    copy index of current track to Song_To_Start
    else if player state is stopped then
    play track Song_To_Start of playlist Plist_To_Start
    end if
    end tell
    return 1
    end idle

    ok now as before make sure that you save it as an application and that the "stay open" box is checked.

    im not a 100% sure that all the bugs are fixed so be forwarned. hope this helps some.

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Auto Disconnect From Cell Phone Without Delay......Is This Possible?
    By jmciver in forum Wireless Communications
    Replies: 0
    Last Post: 12-16-2006, 12:56 PM
  2. Skin and auto play bug...
    By the_tiger in forum CF Bug Reports
    Replies: 0
    Last Post: 10-05-2006, 11:52 AM
  3. Winamp doesn't play, but the play sign is there
    By mbowler in forum Software & Software Development
    Replies: 0
    Last Post: 08-03-2000, 06:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •