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


Click here to return to the 'Display last-connected-iPod's serial number in iTunes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Display last-connected-iPod's serial number in iTunes
Authored by: mark hunte on Jan 27, '06 11:34:26AM
You could also use this script to dump the info in a file. I have two iPods so this will get the SNumber and dates of both
set biglist to {}
set theSN to do shell script " defaults read com.apple.iPod | grep -i " & quote & "Serial Number" & 
	quote & "| awk -F= '{print $2}'" as string
set theCnd to do shell script " defaults read com.apple.iPod | grep -i " & quote & " Connected " & quote 
	& "| awk -F\\; '{print $1}' | awk -FConnected\\ \\= '{print $2}'" as string
set the_count to 0
set theconter to count paragraph of theSN
repeat theconter times
	set the_count to the_count + 1
	copy paragraph the_count of theSN & paragraph the_count of theCnd to the end of biglist
	do shell script "echo iPod Serial\\ Number\\: " & quoted form of item the_count of biglist & " >> ~/documents/iPod_Serial_Numbers.txt"
	do shell script "echo ---------------  >> ~/documents/iPod_Serial_Numbers.txt"
end repeat

---
mh

[ Reply to This | # ]

Display last-connected-iPod's serial number in iTunes
Authored by: sweth on Jan 27, '06 07:28:02PM
Or you could just accomplish the same thing with a single awk command and no applescript:

defaults read com.apple.iPod | awk -F= '/Connected/ { DATE=$2 }; /Serial Number/ { print $2, DATE }'


[ Reply to This | # ]
Display last-connected-iPod's serial number in iTunes
Authored by: mark hunte on Jan 28, '06 03:17:19AM

My god thats much less messy, I really have to read up on awk more

Thanks.

---
mh



[ Reply to This | # ]