i need to create a folder with a random number as name, this is what I’ve been working with:
tell application "Finder"
set incomingID to random number from 1 to 9
make new folder at this_folder with properties {name:incomingID}
end tell
unfortunaltelly, it causes some uncontrolled chain reaction of creating folders… any idea how to make it work?
Is this part of a folder action script?
If so, there’s your problem - your script is creating an item in this folder, and therefore the folder action fires again to handle the newly-created folder, which triggers the folder action…
The only solution is to add checks to your folder action script to detect whether this is an auto-created folder. Depending on what you’re putting in this folder this may or may not be easy. For example it may be sufficient to check whether the added_item is a folder with a single-digit name, if so, assume it’s auto-created and don’t create another one.
Browser: Safari 412
Operating System: Mac OS X (10.3.7)