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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 get_str after getpts?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
kmcelroy 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.
6   L A T E S T    R E P L I E S    (Newest First)
kmcelroy Posted - 03/31/2005 : 4:20:05 PM
Thank you. That looks like it will really help.
easwar 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 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.
greg 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 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?
easwar Posted - 03/31/2005 : 10:46:49 AM
Hi,

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

Easwar
OriginLab




The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000