Re: Getting iPod Serial Number
Re: Getting iPod Serial Number
- Subject: Re: Getting iPod Serial Number
- From: Dave <email@hidden>
- Date: Tue, 3 Jun 2008 10:49:11 +0100
Hi,
Please see script below. It sometimes works (e.g. returns the iPod
Serial Number) and sometimes it doesn't work. Also I've had to insert
delays, which in the real script would make it unacceptably slow. Is
there any reliable way of getting the iPod Serial Number? Maybe using
a shell command? Basically all I need is a value that uniquely
identifies an iPod that works for both Mac and Windows, e.g. the same
number is returned on Mac and Windows. Any ideas greatly appreciated!
Thanks in advance
All the Best
Dave
on GetSerialNumber(theSourceIndex)
tell application "iTunes"
set the clipboard to ""
set mySourceName to ""
set myResult to ""
set mySourceKind to the kind of source theSourceIndex as text
if mySourceKind = "iPod" then
set mySourceName to the name of source theSourceIndex
set the view of window 1 to playlist mySourceName of source
theSourceIndex
activate
end if
end tell
if mySourceName is not equal to "" then
delay 1
beep
tell application "System Events" to tell application process
"iTunes" to keystroke "c" using {command down}
set myResult to the clipboard
tell application "Finder" to activate
delay 1
end if
beep
return mySourceName & " " & myResult
end GetSerialNumber
on run
set mySourceList to ""
repeat 5 times
tell application "iTunes"
set the collapsed of window 1 to false
set the visible of window 1 to true
delay 1
repeat with mySourceIndex from 1 to the count of sources
set myDeviceSerialNumber to my GetSerialNumber(mySourceIndex)
set mySourceList to mySourceList & myDeviceSerialNumber & " " &
mySourceIndex & return
end repeat
set the collapsed of window 1 to true
end tell
activate me
end repeat
return mySourceList
end run
On 30 May 2008, at 18:10, Joe wrote:
After playing with this a bit more, I discovered I was getting
inconsistent results (I think because iTunes needed a bit more time
to switch) so I added a delay to the script. So fat it works every
time.
tell application "iTunes"
set mySourceName to the name of source 2
set the view of window 1 to playlist mySourceName of source 2
activate
end tell
delay 2
tell application "System Events" to tell application process
"iTunes" to keystroke "c" using {command down}
set myResult to the clipboard
tell application "Finder" to activate
myResult
Joe
_______________________________________________
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/archives/applescript-users
This email sent to email@hidden