This is a common mistake. When you run a script using OSAScript from the shell, how you do it, you must tell the application to show any "display dialogs" or "select list dialogs" or anything that requires user interaction. OSAScript cannot show them, so tell the application, like Finder, to show them. Use this code ...
tell application "Finder" activate display dialog "Now it works!" end tell
Or from the command line this will not work ...
osascript -e 'display dialog "Now it will not work."'
But it will work, as we tell Finder to do this ...
osascript -e 'tell application "Finder"' -e 'activate' -e 'display dialog "Now it works!"' -e 'end tell'
So the bottom line is that somewhere in your iTune.scpt you are showing a dialog. In this script, just say iTunes or Finder to display them.
source share