Open file and continue scriptHi,
In a script I´m prompting a user to open a file:
LBSelect = Open( "file path",
Use Labels For Var Names( 1 )
);
This opens a folder and the user has to pick the correct file. When the file has been opened the script should continue with a series of actions based on that file.
How can I make the script wait until a file has been opened? I thought about wait() but that will just state how many seconds it has to wait and as these files tend to be very big this is not a good fit.
How can I make it wait for the file to open?
Can a modal window be used in any way?
Br Julie
Re: Open file and continue scriptAre you looking something like this?
Names Default To Here( 1 );
New Window( "Data and Limits file",
<<MODAL></MODAL>
Re: Open file and continue scriptWait(0)
... is a common method of waiting until a task is completed. Not sure I've ever had to use it in the context of opening files.
Re: Open file and continue scriptOk - I can see that.
Normally I do that when I prompt for a user to open a file (where they navigate to the file themselves). In this case I wanted to add the file path in there to reduce the amount of clicks and then I managed to confuse myself.
Now I´ve done this:
path = Pick File("Select lb", "file path");
LBSelect = Open( path,
Use Labels For Var Names( 1 )
);But it doesn´t seem to work. The lb file is opened as lb, not as LBSelect.
What am I doing wrong?
Re: Open file and continue scriptYou are confused. The Open() function opens a file. The Pick File() function presents a dialog and returns a full path to the selected file or missing. So you should call the Pick File() function and use the result to open the file with the Open() function, or call the Open() function without a path.
Re: Open file and continue scriptHi,
I have a couple of ideas.
1. try to use wait() with no number inside. It will wait until all previous commands are complete (I hope it is true)
2. make a loop with wait and try
For( i = 1, i <= 100, i++,
Try(
LBSelect << Bring Window to front();//run any command on table which will fail in case the table is not ready
Break();//if not failed - terminate the loop
,
Wait( 1 )
);//if failed - wait 1 second and try again
);