April 10, 200718 yr Hello, a script runs the "send event" the dos-command xcopy ("cmd /c xcopy ....."). When xcopy has finished the next script-command should start (import files). Because the time xcopy needs differs from 1 to 100 seconds, a delay is not nice. I hope you can give me some advice for a better solution. thx
April 10, 200718 yr Set Error Capture[On] Sent Event[] Loop Import File['your file here'] Exit Loop If[Get(LastError) = 0 or $time=120] Pause / Resume Script[1] Set Variable[$time ; $time + 1] End Loop If[$time = 120] Show Custom Dialog[import failed] Else Show Custom Dialog[import Successful] End If
April 11, 200718 yr You could also use the shell plugin from abstrakt.com. Then the import script step could be right after the send event, and it wouldn't proceed until thte xcopy was finished. Or you could have your xcopy run inside a batch file which calls a vbscript when it's finished. The vbscript would trigger a scriptmaker script that did the import.
April 11, 200718 yr Author a) I can't see, how shell-plugin can do waiting for xcopy.. which shell-command can perform this? yes, I know. but vb should not be installed on the system. is it also possible with vba? (because I think, vba are implemented in xp) maybe you have a concrete idea of this command :-)), because its my first contact with vb or vba.
April 11, 200718 yr :( yes, I know. but vb should not be installed on the system VBScript - VBS i.e. a text file with a .vbs extension - the engine comes installed on every XP PC.
April 11, 200718 yr Author yes, I have it but, now, how can I start a script in filemaker (it is open) with vbs? which commands and so on? example: in the file fm-batch.bat are two lines: "xopy ......... " "rem if xcopy finished, than script" "start_script.vbs" and which vbs-lines must be in the file start_script.vbs?
April 11, 200718 yr Author Set Error Capture[On] Sent Event[] Loop Import File['your file here'] Exit Loop If[Get(LastError) = 0 or $time=120] Pause / Resume Script[1] Set Variable[$time ; $time + 1] End Loop If[$time = 120] Show Custom Dialog[import failed] Else Show Custom Dialog[import Successful] End If thanks very much for full code. but I am not shure if it solves my problem, because after line 2 "sent event" comes immediatly "import". or maybe I interpret the loop... in a wrong way. please could you spend a few words on it? :( Edited April 11, 200718 yr by Guest
April 11, 200718 yr Essentially... You send your event to do whatever it has to do - from your explanation i understand that eventually when it's finished doing what it has to do, FileMaker is to import the resulting file... So all the loop does is goes in circles trying to import the resulting file -- if the file doesn't yet exist, it throws an error after Import File[] -- so we wait one second and try again. The loop iterates 120 times in 1 second intervals and will exit either when it's gone through the full 120 cycles with no result... or If it manages to import the file.
Create an account or sign in to comment