Created
May 28, 2020 11:54
-
-
Save mingsai/c23bef2caea8c4a7ca864612b1adea8c to your computer and use it in GitHub Desktop.
Applescript: Trim text front and back example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set whichFile to choose file with multiple selections allowed | |
repeat with aFile in whichFile | |
tell application "Finder" | |
set filename to name of aFile | |
set name of aFile to ((characters 4 thru -1 of filename) as string) --trim first 3 | |
--set name of whichFile to ((characters 1 thru -4 of filename) as string) --trim last 3 | |
end tell | |
end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How would you add a string at the end of the name and before the extension?
set name of aFile to ((characters 4 thru -1 of filename) & "text" as string)
However, this adds the "text" string after the extension. Thanks.