TCL : Is there any command or syntax for pause & play the script file while executing???
Hi,
I was new to this automation using TCL\TK language. I have a script file where I need to do some manual work into the HyperMesh window while executing the script. So is there any syntax or command we can give for partially pausing the script file for doing manual work & to play the script for rest of the process.
Thanks & regards,
Raja R.
Best Answer
-
RAJA R said:
Hi tinh,
Actually I need to pause\play the script execution temporarily(For example:10mins) for doing some manual operations in HyperMesh. So can you kindly help me out that how it can be done with a demo script???
Thanks & regards,
Raja R.
Tinh is right, using after is not a good idea because if you get interrupted, or the steps take longer, then you may have to start over. Or if you do it really fast then you may have to wait for the script.
The 2 ways I thought of is to just have to separate scripts: run one, do the manual steps then run the other one.
Or as in the attached you can have a dialog come up that will run more code when the user hits "ok".
Also as Tinh suggests, it may be even better to just incorporate the manual steps into your code. To get ideas for how to do this you could clear the command.tcl file, do the manual steps and then check the command.tcl for commands to incorporate the manual steps in your code. Even if it is mostly manual you have more control and can preserve any data you might need from those steps.
1
Answers
-
First thing that comes to mind for me is a dialog box where you could just hit a button when done. What are you doing though? Maybe the manual part could be semi-automated with user inputs. There is the after command too but that would only give you a set amount of time.
Attached is an example of a dialog box that could do this.
0 -
Ben Buchanan said:
First thing that comes to mind for me is a dialog box where you could just hit a button when done. What are you doing though? Maybe the manual part could be semi-automated with user inputs. There is the after command too but that would only give you a set amount of time.
Attached is an example of a dialog box that could do this.
Hello Ben,
Thanks for the information. I was doing an semi-automated script with user inputs. So as you told I will try with after command within sript.Thanks & Regards,
Raja
0 -
don't do that! to input something to script, you can use: hm_getint hm_getfloat hm_getstring *createmarkpanel ... the command "after" is just to delay without interaction, or to create timer for advance, you can use tkwait, then you can interact GUI, but careful if you modifying some entities that script will refer toRAJA R said:Hello Ben,
Thanks for the information. I was doing an semi-automated script with user inputs. So as you told I will try with after command within sript.Thanks & Regards,
Raja
2 -
tinh said:
don't do that! to input something to script, you can use: hm_getint hm_getfloat hm_getstring *createmarkpanel ... the command "after" is just to delay without interaction, or to create timer for advance, you can use tkwait, then you can interact GUI, but careful if you modifying some entities that script will refer to
Agreed. Sorry for the misleading suggestion.
0 -
tinh said:
don't do that! to input something to script, you can use: hm_getint hm_getfloat hm_getstring *createmarkpanel ... the command "after" is just to delay without interaction, or to create timer for advance, you can use tkwait, then you can interact GUI, but careful if you modifying some entities that script will refer to
Hi tinh,
Actually I need to pause\play the script execution temporarily(For example:10mins) for doing some manual operations in HyperMesh. So can you kindly help me out that how it can be done with a demo script???
Thanks & regards,
Raja R.
0 -
RAJA R said:
Hi tinh,
Actually I need to pause\play the script execution temporarily(For example:10mins) for doing some manual operations in HyperMesh. So can you kindly help me out that how it can be done with a demo script???
Thanks & regards,
Raja R.
Tinh is right, using after is not a good idea because if you get interrupted, or the steps take longer, then you may have to start over. Or if you do it really fast then you may have to wait for the script.
The 2 ways I thought of is to just have to separate scripts: run one, do the manual steps then run the other one.
Or as in the attached you can have a dialog come up that will run more code when the user hits "ok".
Also as Tinh suggests, it may be even better to just incorporate the manual steps into your code. To get ideas for how to do this you could clear the command.tcl file, do the manual steps and then check the command.tcl for commands to incorporate the manual steps in your code. Even if it is mostly manual you have more control and can preserve any data you might need from those steps.
1 -
Hi, I am sure that I have posted a sample script on this forum, if you could search with keyword "tkwait", it is good. a similar one is: ... #insert below lines anywhere you want to pause: #pause temporary: set ::pause 1 tkwait variable ::pause #now you can manually do something with hyper #if you want to continue script, open command window and enter: set ::pause 0RAJA R said:Hi tinh,
Actually I need to pause\play the script execution temporarily(For example:10mins) for doing some manual operations in HyperMesh. So can you kindly help me out that how it can be done with a demo script???
Thanks & regards,
Raja R.
1 -
sorry, i use a smarphone so i cannot type it clearly you can refer to tk manual for command tkwaittinh said:Hi, I am sure that I have posted a sample script on this forum, if you could search with keyword "tkwait", it is good. a similar one is: ... #insert below lines anywhere you want to pause: #pause temporary: set ::pause 1 tkwait variable ::pause #now you can manually do something with hyper #if you want to continue script, open command window and enter: set ::pause 0
0