The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 get_str after getpts?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

kmcelroy

USA
13 Posts

Posted - 03/30/2005 :  7:42:51 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Posted - 03/31/2005 :  10:46:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

See this article:
http://www.originlab.com/index.aspx?s=9&pid=541

Easwar
OriginLab



Go to Top of Page

kmcelroy

USA
13 Posts

Posted - 03/31/2005 :  2:03:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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?
Go to Top of Page

greg

USA
1380 Posts

Posted - 03/31/2005 :  2:38:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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;


Go to Top of Page

kmcelroy

USA
13 Posts

Posted - 03/31/2005 :  3:45:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
Go to Top of Page

easwar

USA
1965 Posts

Posted - 03/31/2005 :  3:52:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Go to Top of Page

kmcelroy

USA
13 Posts

Posted - 03/31/2005 :  4:20:05 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you. That looks like it will really help.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000