perl - Applescript, iTunes, and 'date' -
perl - Applescript, iTunes, and 'date' -
i've got applescript phone call song set play count , set lastly played date. these called perl script fetching info last.fm. unfortunately, whenever phone call lastly played date script, error message setituneslastplayed.scpt: execution error: itunes got error: descriptor type mismatch occurred. (-10001)
.
i'm calling this:
osascript /users/gms8994/setituneslastplayed.scpt "<artist>" "<title>" "wednesday, july 05, 2011 07:14:11 am"
i did notice if request value of lastly play itunes, comes without zero-padding days , hours, tried removing those, no avail.
here's script.
on run argv tell application "itunes" set theartist (item 1 of argv) set thetitle (item 2 of argv) set thelastplay (item 3 of argv) set thelastplay date thelastplay set results (every file track of playlist "library" artist contains theartist , name contains thetitle) repeat t in results tell t thelastplay set played date of t thelastplay end tell end repeat end tell end run
can point me fix?
the played date
property of track requires date
object, not date string. need convert date date object:
set newdate (current date) set month of newdate "july" set year of newdate "2011" (* can fill in rest *) set played date of t newdate
i don't think there way straight create date object given string, you'll have maintain function in case last.fm (or technology rely store , study dates) decides alter date format.
perl applescript itunes
Comments
Post a Comment