Hi, So I've been trying to set up this applescript which removes Emojis from filenames in my Download folder. Right now it's set up to work with a droplet, but for some reason I get an error message when running the script. This is my error message:
Can’t get name of alias "Macintosh HD:Users:<username>:Downloads:Armandocolor IDREAM - Alone RMX BURNAxBOY ❤️❤️❤️❤️❤️❤️.mp3".
This is my scriptcode:
-- Prompt user to choose files
set selectedFiles to choose file with prompt "Select files to remove emojis from:" with multiple selections allowed
processFiles(selectedFiles)
end run
on open theFiles
-- Called when files are dropped onto the droplet
processFiles(theFiles)
end open
on processFiles(fileList)
repeat with aFile in fileList
set fileName to name of aFile
set newName to removeEmojisFromText(fileName)
-- Check if the filename changed
if newName is not equal to fileName then
set name of aFile to newName
end if
end repeat
end processFiles
on removeEmojisFromText(inputText)
set outputText to ""
repeat with i from 1 to count characters of inputText
set thisChar to character i of inputText
if (thisChar is not in {"", return, tab}) then
try
set outputText to outputText & thisChar
end try
end if
end repeat
return outputText
end removeEmojisFromText
Can someone help me out with this code? I'm very much a noob still at applescripting...