Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript to trap when I insert my ipod?



This from Robert Nicholson - dated 28/10/06 12.20 am:

> Has anybody been able to get this one working?
> 
> On Oct 24, 2006, at 3:47 PM, Mr Tea wrote:
>> 
>> Use the folder action's ability to get information about the added
>> item...
>> 
>> on adding folder items to this_folder after receiving added_items
>>    tell application "Finder" to set theName to name of item 1 of
>> added_items
>>    if theName is "My_iPod_Name" then
>>          --do the iTunes stuff
>>    end if
>> end adding folder items to

FTR, I tested the above with audio CDs and disk images (worked fine), but
not with an iPod, because I don't have one. Yes. That's right. I don't have
an iPod. Hahahahaha! However, this should work...

property diskname : "My_iPod_Name"

on adding folder items to this_folder after receiving added_items
    try
        tell application "Finder"
            set theName to name of item 1 of added_items
        end tell
        
        if theName is diskname then
            tell application "iTunes"
                repeat 20 times
                    set diskloaded to exists source diskname
                    if diskloaded then
                        --do iPod stuff
                        exit repeat
                    end if
                    delay 1
                end repeat
            end tell
        end if
    on error msg
        display dialog msg
    end try
end adding folder items to


NB - The repeat loop is there in case there's a delay before iTunes 'sees'
the ipod

HTH

Nick
pp Mr Tea

--

"Let the pot stand for at least five minutes before serving."

http://www.theteacaddy.co.uk

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Applescript to trap when I insert my ipod? (From: Robert Nicholson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.