Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Numpty advice re scriptmaster

Featured Replies

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

set a variable in a script

with the calculation - TheFunction( $params...)

remember that this needs to be proper O/S paths

  • Author

Thanks. I tried that but got a syntax error - see pic

 

script.jpeg

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.

  • 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

script.jpg

  • Author

 

Update: the function has returned zero, which means it thinks the folder already exists

Edited by Pete

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.

  • 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...

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)

 

Screen Shot 2018-09-18 at 08.15.24.png

  • 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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.