• 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: Applescript to trap when I insert my ipod?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript to trap when I insert my ipod?


  • Subject: Re: Applescript to trap when I insert my ipod?
  • From: Mr Tea <email@hidden>
  • Date: Sun, 29 Oct 2006 18:00:27 +0100

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:
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>)

  • Prev by Date: BBEdit question...
  • Next by Date: Re: BBEdit question...
  • Previous by thread: Re: Applescript to trap when I insert my ipod?
  • Next by thread: ASS Books?
  • Index(es):
    • Date
    • Thread