Purpose You want to let the user start a GuiXT InputScript by clicking a button in Excel |
Solution Example
If you
want to start a series of InputScripts with the button click, for
example one InputScript call for each Excel row, you need to
synchronize the InputScript execution in your Excel macro. Otherwise
a running InputScript could be interrupted by the next one and
deadlock situtations may occur.
A possible
approach for synchonization is to use an empty status file that is
written when the InputScript has terminated. In the Excel macro you
wait until you detect the status file:
' Wait for Status file to confirm that the InputScript has finished Do Application.Wait Now + TimeSerial(0, 0, 0.01) FindIt = Dir("C:\Guixt\excel_status_file.txt") Loop While FindIt = ""
' Now we can start the next InputScript
At the end
of the InputScript,
set a GuiXT status variable
Set V[excel_status_file] "C:\Guixt\excel_status_file.txt"
In the
GuiXT script that follows your InputScript you query the status variable, create the file and clear the
status variable:
if V[excel_status_file]
OpenFile
"&V[excel_status_file]"
-output
CloseFile
"&V[excel_status_file]"
Clear
V[excel_status_file]
endif
This way
your are sure that the InputScript has ended when you write the
status file.
|
Components |