makefolder ( new_folder ; pathTo )
Use the perform applescript script step with this function to perform new folder creation with applescript..
Average rating: 4.0 (37 votes) Log in to vote
Kenneth Durrum - Show more from this author
Released Solutions https://releasedsolutions.net |
if not (exists folder "yourFolder" in alias "your:path:to:" ) then
make new folder in folder "your:path:to:" with properties {name:"yourFolder"}
end if
end tell
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Use the perform applescript script step with this function to perform folder creation action.
Comments
Richard Hyams, New York Apr 13, 2009 |
||
Is something that uses apple script really a filemaker custom function? | ||
Lorne Walton, Maple Ridge, BC, Canada Apr 17, 2009 |
||
My answer: only if you use a Mac. These script steps: Set Variable ( $path ; Get ( DocumentsPath ) ) Perform AppleScript ( makefolder ( "vcard" ; $path ) ) generate an error -43 and the comment that my Documents folder cannot be found. It is in fact, right where it is intended to be. The folder "vcards" is not created. |
||
Craig Williams, Monument, CO May 3, 2009 |
||
The reason Get ( DocumentsPath ) is failing in the code above is because it returns a POSIX path and Finder needs a HFS path ( colon separated). "HardDrive:Users:user_name:Documents:" Make that adjustment and it should work fine. |
||
Lorne Walton, Maple Ridge, BC, Canada May 4, 2009 |
||
Tried that. Didn't work. This change to the CF worked: " set ASPath to \"" & pathTo & "\" ¶ tell application \"Finder\" ¶ if not (exists folder \"" & new_folder & "\"" & " in alias ASPath ) then ¶ make new folder in folder " & "\""& pathTo & "\" "& " with properties {name:" & "\"" & new_folder & "\"} ¶ end if ¶ end tell " |
||
Jack James, London May 6, 2009 |
||
It's bad practice to call Finder to perform operations such as this. Instead you should use: tell application " & Quote("System Events") &"¶ make new folder at end of pathTo¶ end tell¶ |
||
James Ducker, Swindon UK Jan 22, 2010 |
||
I find it more reliable -- and quicker -- to call a shell script: set variable $AppleScript to "do shell script " & quote ( "mkdir /Users/jamesducker/Desktop/whatever/" ) perform applescript $AppleScript |
||
Juan Cardona, Palma, Spain Oct 22, 2010 |
||
James Ducker, Perfect -SIMPLE- solution |
||
Paulo, Florianopolis, Brasil Feb 25, 2018 |
||
James Ducker, Perfect, but... how can i mkdir with space in its name? |
||
Paulo, Florianopolis, Brasil Feb 25, 2018 |
||
James Ducker, Perfect, but... how can i mkdir with space in its name? |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.