Jump to content

Export to non-existant folder


This topic is 4076 days old. Please don't post here. Open a new topic instead.

Recommended Posts

OK... trying to figure if I've lost my mind, if the behavior's changed, or if there's some subtlety I'm missing here.

 

Last time I played around with Export Field Contents was back around 2008. If I remember right, when you built your own file path for an Export script step and one of the folders in the file path was missing, Filemaker would throw an error 100 (File not Found) on the export. I ran into this last with Export Records about a year and a half ago in FM11.

 

Right now, I'm building an image export script for a client; he wants to save the images to a predefined folder on the desktop, and alert the user if the folder isn't present. I thought I could trap for an Error 100 right after the Export Field Contents script step, and use that to trigger the alert. 

 

Instead, the script blithely goes through the Export Field Contents step without reporting an error. When I do a search for the image files, they show up in the Filemaker application folder.

 

I couldn't find this behavior documented in the Help file, or in a search on the Filemaker knowledge base, and it doesn't match the behavior I've seen before.

 

Any ideas?

 

As an alternative, I could try talking the client into putting the folder in the user's Documents folder, and use Get(DocumentsPathListing) to check for the folder's presence, but I want to try and do it the client's way if I can.

 

Many thanks!

Link to comment
Share on other sites

If you're on windows you can use send event to create the folder

 

The calculation would look something like this:

 

"cmd /c md " & Quote ( Right (Get ( DesktopPath ); Length (Get (DesktopPath))-1) & "Folder Name")

 

 

 

 

post-99156-0-04394000-1362423925_thumb.j

  • Like 1
Link to comment
Share on other sites

Thanks for the suggestion. What happens if the folder already exists? And can you check to see if the folder exists?

 

I can do something similar on the Mac side with Applescript (including checking for the folder), so if this works for Windows, that may be the answer.

 

Thanks again!

Link to comment
Share on other sites

The Windows version of FM doesn't offer the same easy OS integration like it does on the Mac with Applescript.  The OS technology is there, FM just doesn't support it.

 

So you can:

- use Send Event to produce a directory listing of the chosen folder to a text file and have FM import that then parse it to check for the folder (no need for a batch file here, one command line can produce the text file to import)

- produce a VBscript from FM and run it through the Send Event to do the checking and create the folder if does not exist.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Using the technique I siggested, if the folder already exists it just drops whatever file you're exporting into it. It doesn't overwrite anything or remove anything unless it's the file you're exporting which will of course overwrite the file in the folder if it exists. But basically, if the folder already exists, nothing happens, It just continues on it's merry way without any issues.

Link to comment
Share on other sites

This topic is 4076 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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