Just as an update. if i set a variable prior to exporting called $path and give it a value of Get ( DocumentsPath ) & "krames.txt", it will export the file to C:\Program Files\FileMaker\FileMaker Server\Data\Documents
Is this the only option when it comes to exporting from server?
Saw your post right after i tested it. Was not aware of this since this is the first time i've tried exporting from a server side script. I guess i will just move it from there. Thanks
There's only 2 folders you can export to when running server side scripts. They are mentioned in the Knowledge Base article referred to previously:
"Any specified file must be in the Documents folder, the temporary folder, or a child folder of either the Documents folder or the temporary folder. For example, the following are all valid paths for file.csv:
So it's either the Documents folder of the Temp folder.
FileMaker 12/11/10/9/8 Certified Developer
- - - - - - - - - - - - - - - - -
Phone: +61 2 9484 6565
Mobile: +61 418 468 103
You can use a plugin to then move the document from the Documents or Temporary folder to whatever location you want as long as you have the permissions set correctly. I personally use 360Works ScriptMaster and Monkey Bread Software plugins to do tasks like this. But there are several others that do this too. Remember that that plugin has to work on and in installed in the server's extension folder.
I already have scriptmaster so i may play around with that tomorrow. Would be wonderful if FileMaker Server tasks had the ability to run pre and post commands.
You can run before and after OS level scripts. Not sure when this came in, but it is in 11 and 12. When you create the server task, select Script, then select Sequence. Note that the before and after scripts are OS level, so on Windows it could be a batch/command file (.bat or .cmd), or VBScript (.vbs). Can likely run a powershell script since you are on Win2008.
The scripts have to live in the special scripts folder that is inside the Data folder. This is at the same level as the server documents folder referenced in the above threads.
I know i can do that but i would have to setup another schedule to run right after the export schedule.
What i was referring to is when you schedule a task, have it give you the option to run a command prior to the task and after. Basically all in one schedule.
If you want to use a FileMaker plugin, it is just a script step that you put at the end of the script. You don't have to schedule another task such as an OS level batch file.
Yeah i got that, i was just commenting on BowdenData's comment that this is how i currently have to do it. I'll dig into scriptmaster tomorrow and see what i can come up with.
No - a script SEQUENCE schedule does exactly this. See the script before and script after in the attached screenshot. I am only using a before script in this example.
What this means is that when it executes, it will run the before .vbs script and if that script runs successfully, it will then run the FM script SYS_01_import. If I had an after script, it would run after the FM script completed.
Was not aware of that, i will look into it today. Sorry for the confusion.
So i setup a Script Sequence and i am running into a new error.
I created a bat file with the following string:
ROBOCOPY "C:\Program Files\FileMaker\FileMaker Server\Data\Documents" Y:\eclchecks
If i run the bat file manually, everything works great and the file is copied to the correct location. When FileMaker Server executes the same bat file, it returns an error:
Schedule "Hourly Exports" aborted, system script "Move2FTP.bat" returned a non-zero status 16.
The script has been setup to run with the same user account that i am logged in with when i run it manually so i do not believe it is a permissions issue.
Did a search online for error 692 but did not come up with a whole lot of information.
Try putting the full path to the robocopy executable in the batch file. In theory, if the path to the robocopy.exe is in your environment variables, you should not have to do this, but...
In my example screen, the .vbs script that I am executing is also using robocopy, but I define the full path to it in the script.
Good on specifying the account to run the script under and that account works when logged in manually.
As for error checking, I think you need to look at code "16" as this is what the batch file is returning. Try doing a google/bing search for this and see what you find.