| Author |
Topic  |
|
|
kmcelroy
USA
13 Posts |
Posted - 03/30/2005 : 7:42:51 PM
|
Origin Version (Select Help-->About Origin): 7 SR 4 Operating System: XP
I want to graph one dataset, pick points to mask, then plot the next dataset and repeat many times. Is there any way at all to get the other commands to wait for the getpts command to finish? Right now, all of the datasets get plotted immediately, then I get to pick points on one graph and then the program quits. |
|
|
easwar
USA
1965 Posts |
|
|
kmcelroy
USA
13 Posts |
Posted - 03/31/2005 : 2:03:09 PM
|
| I read that article before. Do you mean to say that there is no way around my problem, or that there is a solution in that article that I have missed? |
 |
|
|
greg
USA
1380 Posts |
Posted - 03/31/2005 : 2:38:33 PM
|
Since you state that all graphs plot, I think it's pretty clear you didn't understand the implications of the GETPTS article.
"getpts" puts the cursor into a special mode which you can program to do whatever you want. Once it executes, it doesn't wait for you to do anything ... it's done and the next line of code will immediately execute. It's your responsibility to write your code with this in mind.
This code illustrates the behavior : getpts; count=0; def pointproc { type $(X),$(Y); count++; if(count==5) dotool 0; } type -a Time waits for no man.;
The message will type immediately when you run the script - before you've had a chance to pick even one point. PointProc should be programmed to do what you need.
Normal technique is to define an endtoolbox macro and/or pointproc macro which will continue a script when the user completes the action. This gets complicated if your script then calls for more user input. Part of the complication is the automatic behavior of endtoolbox which undefines itself upon completion. Since you might want to define another procedure which itself re-defines endtoolbox, that can't be done within endtoolbox.
Here's a solution that wraps a procedure within an infinite loop and uses the endtoolbox or pointproc macro to determine when to exit the loop :
numpoints=2; create picked_b -c numpoints; for(done=0,waiting=0,idx=1;done==0; ) { sec -p .1; if(waiting==0) { dotool 3; def pointproc { picked_a[idx]=x; picked_b[idx]=y; idx++; if(idx>numpoints) { done=1; dotool 0; } } waiting=1; } } layer -e picked_b;
|
 |
|
|
kmcelroy
USA
13 Posts |
Posted - 03/31/2005 : 3:45:10 PM
|
| This is all LabTalk, which I am less comfortable with than C. I realized from the article that LabTalk commands in the script are executing without waiting for user input. I was more asking if there is a way to call a LabTalk script from within a C program so that the C program waits for user input. Or even if there is a C function I can use instead of the LabTalk getpts. |
 |
|
|
easwar
USA
1965 Posts |
Posted - 03/31/2005 : 3:52:34 PM
|
Hi,
Currently need to use LabTalk to get points etc. Please see the example "Read Screen Points" in this page: http://www.originlab.com/index.aspx?s=9&lm=71&pid=268 which shows how to call the necessary LT from Origin C. This example uses screen reader - you can replace with data reader etc.
Easwar OriginLab
|
 |
|
|
kmcelroy
USA
13 Posts |
Posted - 03/31/2005 : 4:20:05 PM
|
| Thank you. That looks like it will really help. |
 |
|
| |
Topic  |
|