2017-09-15T03:27:19ZFluxBBhttps://macscripter.net/viewtopic.php?id=45923Bingo! Thanks so much for your help!]]>https://macscripter.net/profile.php?id=545052017-09-15T03:27:19Zhttps://macscripter.net/viewtopic.php?pid=191458#p191458Hi.

You have to tell either System Events or the Finder to get and set the folder's name:

Applescript:

set prepend to text -5 thru -1 of projCodetell application "System Events"toset name of projectFolder to (prepend & " - " & (get name of projectFolder))

]]>https://macscripter.net/profile.php?id=4572017-09-13T07:02:10Zhttps://macscripter.net/viewtopic.php?pid=191448#p191448Thanks for the quick response! Unfortunately I got an error stating that it couldn't get the name of the alias for the folder (followed by the full path name).]]>https://macscripter.net/profile.php?id=545052017-09-13T01:49:21Zhttps://macscripter.net/viewtopic.php?pid=191447#p191447Try:

Applescript:

set name of projectFolder to (prePend & " - " & (get name of projectFolder))

]]>https://macscripter.net/profile.php?id=17812017-09-13T01:32:54Zhttps://macscripter.net/viewtopic.php?pid=191446#p191446Thanks for the tips! However I think I mangled the follow-through. I got a stack overflow error when I tried:

Applescript:

set name of projectFolder to prePend & " - " & projectFolder as string

If all you want to do is get the last 5 characters of projCode, the following line will work if you insert it after the line that sets projCode.

Applescript:

set prePend to characters ((length of projCode) - 4) thru (length of projCode) of projCode as text

The following will also work.

Applescript:

set prePend to characters (-5) thru (-1) of projCode as text

haolesurferdude, neither of those is a good idea. They're inefficient -- you're making lists and then concatenating them -- and they're error-prone because the result will depend on the value of text item delimiters when you run it. Better to use this:

Applescript:

set prePend to text -5 thru -1 of projCode

]]>https://macscripter.net/profile.php?id=17812017-09-13T00:21:01Zhttps://macscripter.net/viewtopic.php?pid=191444#p191444If all you want to do is get the last 5 characters of projCode, the following line will work if you insert it after the line that sets projCode.

Applescript:

set prePend to characters ((length of projCode) - 4) thru (length of projCode) of projCode as text

The following will also work.

Applescript:

set prePend to characters (-5) thru (-1) of projCode as text

]]>https://macscripter.net/profile.php?id=311502017-09-12T22:49:44Zhttps://macscripter.net/viewtopic.php?pid=191441#p191441My current script uses the following as part of a larger workflow:

Applescript:

The user inputs projCode in the following format: ABCDEXY123. It's used to rename files using the same code with suffixes.

Is it possible to get just the "XY123" part of that code to prepend projectFolder's name as the final step in the overall script without having to add another step to input just that part projCode? Any insights would be appreciated. Thanks!