I used the JavaScript for Automation on Mac (JXA) to create an iTunes script, that pulls your personal last.fm play counts.
This code works only with MAC OS X Yosemite and above (>=10.10), due to JavaScript being introduced just to this platform, yet. I will upload a build release for earlier OSX versions.
- Download the latest release, extract the .zip and copy the app somewhere on your Mac (Scripts in the Folder
~/Library/iTunes/Scripts/
will be displayed in the iTunes script menu). - Select the tracks you like to sync in iTunes.
- Start the app.
- You are asked to enter your last.fm username.
- The scripts runs through all the selected tracks. (Maybe the status window of the app is in the background)
The script causes a timeout when run directly in iTunes, when not build as an applet.
The script is written in vanilla JavaScript and cannot be directly opened in Script Editor. To run the script you can use the shell command osascript -l Javascript [file_name]
or build a .app file with osacompile -l JavaScript -o [script_name].app [file_name]
and run that in Script Editor or directly in iTunes.
If you like to work in Sublime Text, I created a package for the Build System: JXASublimeText.