interupt a script to do something in itunes


I wrote a script to help with replacing copies of tracks with their itunes match versions. The problem that the script shall solve is that when replacing a song, its lyrics and artworks are lost.
The script copies lyrics and artworks into a list, then halts by showing a dialog box. Now, the user can delete the songs and reload them from itunes match. After that, he clicks on the dialog box button and the lyrics and artworks are written to the replaced versions.

The script runs fine when started directly from the script editor when I do as follows:

tell application "iTunes"
	-- get lyrics  and cover art from selected tracks
end tell

-- user interaction: delete local copy and reload from icloud
set dialog_result to display dialog "Now delete the local copies of the tracks and reload from icloud" buttons {"Cancel", "Done. Files reloaded"} default button 2
set theButtonPressed to button returned of dialog_result
if theButtonPressed is "Cancel" then
	return 1
end if

tell application "iTunes"
       -- restore lyrics to reloaded tracks if necessary
end tell

Unfortunately, when I run the script from the itunes script menu, the dialog box blocks itunes, so I can’t do the replacing (as far as I know, replacing by script is not possible).

Any idea how I can interrupt a script without blocking itunes?

I wrote a tutorial for AppleScript-Studio some years ago. I think it can be used for your problem as well.

Thanks! Calling my Script via

do shell script "osascript -s s " & __pathToScript__ & " > /dev/null 2> /dev/null & echo $!"

did the trick