filemuker Posted April 10, 2007 Posted April 10, 2007 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
Genx Posted April 10, 2007 Posted April 10, 2007 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
Reed Posted April 11, 2007 Posted April 11, 2007 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.
filemuker Posted April 11, 2007 Author Posted April 11, 2007 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.
Genx Posted April 11, 2007 Posted April 11, 2007 :( 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.
filemuker Posted April 11, 2007 Author Posted April 11, 2007 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?
filemuker Posted April 11, 2007 Author Posted April 11, 2007 (edited) 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, 2007 by Guest
Genx Posted April 11, 2007 Posted April 11, 2007 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.
Recommended Posts
This topic is 6438 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 accountSign in
Already have an account? Sign in here.
Sign In Now