Advertisement
Guest User

AppleScript

a guest
Feb 28th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tell application "iTunes"
  2.     set sel to selection of front browser window
  3.     if sel is {} then
  4.         try
  5.             display dialog "Nothing is selected…" buttons {"Quit"} with icon 0
  6.         end try
  7.         return
  8.     end if
  9.    
  10.     set c to (count of sel)
  11.     set songName to (get name of item 1 of sel)
  12.    
  13.    
  14.     set userOptions to display dialog "Edit for Work name and then click OK." default answer songName --prompt for work name
  15.    
  16.     repeat with i from 1 to c --set the movement numbers
  17.         set thisTrack to item i of sel
  18.         try
  19.             set work of thisTrack to text returned of userOptions
  20.             set movement number of thisTrack to i
  21.             set movement count of thisTrack to c
  22.             set movement of thisTrack to my delRomNum(name of thisTrack) -- copy movement text from song name and delete roman numerals
  23.         end try
  24.     end repeat
  25.    
  26.    
  27. end tell
  28.  
  29. on delRomNum(t) -- the perl command search and delete any roman numeral (must be a word followed by the period and a space character)
  30.     do shell script "/usr/bin/perl -pe 's/\\b[IVXLCDM]+\\b. //g' <<< " & quoted form of t
  31. end delRomNum
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement