September 16, 20187 yr Hi all, I am an amateur FM user with trying to achieve something fairly simple. I have a DB of clients. When I add a new client, I want to create a folder on my Mac named with the client's ID number. I have Scriptmaster, I have registered the create folder function, which now shows up in my list of functions. My problem is how to write the script to create the folder? Which script command would I use to deploy the function? Or am I missing something important? thanks in advance Pete
September 16, 20187 yr set a variable in a script with the calculation - TheFunction( $params...) remember that this needs to be proper O/S paths
September 17, 20187 yr When you use literal text, you need to enclose it in quotes. So something along the lines of: CreateFolder ("/Macintosh HD/Users/pete/Tresors/P Medicolegal/Reports/" & $Folder ) Assuming that $Folder is the variable where you store the folder name.
September 17, 20187 yr Author Thanks so much. That has got rid of the syntax error. However the script seem to do anything, no error message. Is the 'set variable' command enough? Or does it need anything else. According to Scriptmaster it will return 1 or 0 depending on whether the folder already exists (it doesn't). see pic. P script.tiff sorry, attached now as jpeg
September 17, 20187 yr Author Update: the function has returned zero, which means it thinks the folder already exists Edited September 17, 20187 yr by Pete
September 17, 20187 yr Your parameter is missing a slash before Macintosh HD. If you're using FileMaker 17, you don't actually need a plugin to create a folder. You can use Export Records with a found set of 0 records and Create Directories on. If you set the export to export to a file called say "dummy.txt", a folder will be created but no actual file, since there are no records to export. Use Set Error Capture [On] at the beginning of the script to avoid error messages.
September 17, 20187 yr Author Thanks. I changed it to "/Macintosh HD...", but it returned an error. Then I used "filemac:/Macintosh HD...." and it returned 1, which means it was successfully created. But still no folder (anywhere on the hard drive). I'm using FMP 12 Advanced. It might be time to upgrade...
September 18, 20187 yr this won't work with a path that starts filemac: It needs to be an O/S system path, and while I know its not that helpful, works here (although I might have tweaked my version of the function a bit)
September 18, 20187 yr Author Hooray! it works. Thank you so much So what I did is ctrl-option-click the parent folder to get the path. Turns out that starting the path name with "/users..." did the trick, i.e. leaving off the "/Macintosh HD" part.
Create an account or sign in to comment