Hi all,
I am trying to figure out what the correct syntax for renaming a file using Shane’s FileMangerLib.
Looking at the readme, it looks like it should be as simple as
set rename object theItem to (("hello") as string)
But that is probably a really gross line of code on my part.
Like I said I have looked at the readme, but there are no examples in that of using the rename command, in fact I can’t seem to find a single example online. So I have come here to seek guidance.
For reference, here is the entire script:
use scripting additions
use theLib : script "FileManagerLib" version "2.2.1"
set folderPath to POSIX path of (choose folder with prompt "Choose a folder:")
set theFolder to POSIX file folderPath as alias
set theContents to objects of theFolder
repeat with i from 1 to (count of items of theContents)
set theItem to item i of theContents
set aliasItem to (POSIX file theItem) as alias
set rename object aliasItem to (("hello" & i) as string)
end repeat
That gives me a stack overflow error when I try to run it from both Script Debugger 7 and Script Editor 2.10. I am running on 10.13.
Looking at examples for some of the other commands in FileManagerLib I realize that what I am trying to do is probably too simplistic, and the right way probably involves a bit more code.
Model: 2018 MBP 15"
Browser: Safari 605.1.15
Operating System: macOS 10.13