Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'an extention of this script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
an extention of this script
Authored by: kjell on Sep 30, '04 12:38:29PM

thanks a lot- this works great, except that it tries to eject the ipod while it's being updated. what do i put in there to give it a 5-10 second wait or something before it ejects the ipod?



[ Reply to This | # ]
an extention of this script
Authored by: jakacmar on Sep 30, '04 02:27:30PM

I've been trying to script this forever and always run into the same problem you have. Perhaps most annoying, even if you wrap the eject command in a try statement, the Finder will still pop up the "Disk in Use" dialog box for some strange reason making it basically impossible to work around and will usually result in an endless loop. I'm not sure there is a good way to do this short of convincing Apple to make checking whether an iPod is currently being updated scriptable.



[ Reply to This | # ]
an extention of this script
Authored by: jonesy on Sep 30, '04 04:31:49PM
Try wrapping it in a handler:

on update_pod()
	tell application "iTunes"
		try
			update "iPod"
		end try
	end tell
end update_pod

update_pod

tell application "Finder" to eject "iPod"

---
Grrrr!!!!!

[ Reply to This | # ]

an extention of this script
Authored by: kjell on Sep 30, '04 04:51:40PM
that's not working for me, it disconnects the ipod without updating it. but if i insert a 10 second delay in between the two parts of the script, it works alright. ten seconds is generally long enough for me, but you guys can replace it with whatever you want.
tell application "iTunes"
	try
		update "kjell_ipod"
	end try
end tell
delay 10
tell application "Finder" to eject "kjell_ipod"


[ Reply to This | # ]
delay x
Authored by: VRic on Sep 30, '04 05:30:14PM
what do i put in there to give it a 5-10 second wait or something before it ejects the ipod?
delay x where x is the number of seconds

For example:
tell application "iTunes" to update "iPod"
delay 10
tell application "Finder" to eject "iPod"


Of course this isn't really waiting for the update to complete. Unless there's a sanctionned way to do it, one needs a workaround; maybe something like this would do:
- create a dummy playlist in iTunes (it should be the last to be sent, I don't know in what order playlists are updated)
- delete the similarly named playlist from the iPod if there's one (leftover from a previous run of the script)
- update the ipod
- wait until the playlist is on the ipod by running a "repeat until" loop testing for that list or one of it's tracks and containing nothing or a "delay 1" statement for example (I have no iPod so I don't know if you can test for a playlist on the ipod without finding the one in iTunes instead but let's say it's possible)
- delete the playlist in iTunes
- then unmount the ipod

This would make sure the update is complete without waiting unnecessarily longer (assuming one can actually be certain the dummy playlist is updated last, which may or may not be predictable).

[ Reply to This | # ]
an extention of this script
Authored by: ever on Jan 01, '05 09:46:31AM

why not just create two separate scripts for each function? hit f11 to update the ipod, and when its done just hit f12 to eject? works for me and saves hassle.



[ Reply to This | # ]