One option is not to use a server schedule but rather a "robot file". This is a file that is "run" by a system schedule instead of FileMaker server. It's a simple FileMaker file that has a script set to run when the file opens. The script performs your currency update script in the server hosted file. Since this takes place as a "client", you are not limited to server compatible script steps.
I suppose the other option is something like this:
Go To layout ...
Set Variable [$TimeStart ; value: Get ( CurrentTime ) ]
Exit Loop If [( Get ( CurrentTime ) - $TimeStart ) = 30 ]
Set Variable [$gcontent...
Thanks a lot for your help. Indeed, I think building the robot file will be the best alternative.
Please, can you give me more advice on how to do it?
Details depend on the server operating system. For a windows server, you'd use Windows Task Manager. On macs, I believe that there is something called "Cronos" that will do the same thing.
1 ) Create a New fileMaker file. No need to define tables or much of anything in it except:
a) in file options specify that the file open itself with an account name and password that matches an account name and password with sufficient privileges to run the script in the hosted file that you want to run. (This can be a very limited access password if the script is set to run with "full access privileges".)
b) a simple script also set in file options to run automatically when the robot file is opened:
Perform Script [Specify script in hosted file here]
Exit application ( or Close File if you want to keep FileMaker Pro launched on the robot machine.)
2 ) open the system task scheduler such as windows task manager and set it to "run" this robot file.
Note 1: The achilles heel of robot initiated scripts is the infinite loop. If your script contains a loop or uses recursion, check it over and test it very carefully before using it via robot file. If your robot performs a script that gets trapped in an infinite loop, it will start the script up and then quit, leaving the script looping forever. The only way I know to halt it is to use Server Admin to close and re-open the file.
Note 2: The fact that the robot file uses a password to open the hosted file could be a security risk. It's a good idea to use as limited a password as possible and to place the robot file on a physically secure machine. My robot file is located on the server itself and kicks off a script late at night when no one else is using the machine to move data around via import records--steps that will not work in a server schedule controlled script without adding quite a few more steps to the script.
Thank you very much Phil!
Please let me know if my understandings are correct:
1. I also need to have FMPro installed in the Server, right? I guess this is correct, since the task manager will open the file using FMPro (and not FMServer).
2. The robot file should be linked to the main file by adding a new connection, right?
3. Why did the robot file must have an account name and password that exactly matches a password in the main file? I think the password will be inserted in the moment I link these files (when I ask the robot file to perform a script in the main file). I understood I can use a limited access password and set the script in the main file to have "full access privileges".
4. Ok, the script will be set to run when the robot file opens. But, as you say, this robot file must have a user name and password tha exactly macthes the one I'm using in the main file, this is correct? This is a point I didn't understand.
5. Ok, the task manager will run the file. As I saw, the task manager can run this task on a daily basis. Is it possible (and safe) to execute this task every hour?
Thank you so much!
One more question... When setting up the robot script to run a script in the hosted file, should I set up a direct connection or a remote connection? I can't set up a direct connection while other users are accessing the file remotelly...
You can use open remote to open the hosted file and select a script defined in it for your robot to perform. ALWAYS access hosted files via Open Remote.
Thanks, it's working!