hey everyone… new to applescript but I’ve done some coding in C before. I’m trying to make a script that will take what’s on the clipboard and remove “1998 Digital Remaster” from it. Or, any other year. here’s what I’ve tried:
set this_string to the clipboard
set OldDelim to AppleScript’s text item delimiters
set counter to 1970
repeat until counter = 2007
set AppleScript’s text item delimiters to " ( " & counter & " Digital Remaster)"
set AppleScript’s text item delimiters to OldDelim
set y to this_string
set the clipboard to y
if y contains “Digital Remaster” then
set counter to counter + 1
display dialog "counter = " & counter & " & y = " & y & " & item delimiters = " & OldDelim & “”
else
set counter to 2007
end if
end repeat
return y
My thoughts are that it would go through all the years, and when it finds one that matches the text, say “1998 Digital Remaster” it would get rid of that, end the loop and return the original clipboard string minus the “1998 Digital Remaster.” You can see I have a bit of debugging code in there to see what values I’m getting for my variable “OldDelim” but it’s always blank, even when the counter is the same as the year in the text. If anyone could help me out that would be great!
-Weston