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
 LabTalk Forum
 Poor thread handling of script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

peter.cook

UK
356 Posts

Posted - 10/16/2009 :  05:13:07 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 7.5 SR6
Operating System: Vista

Hi,

Recently come across annoying problem with script handling. I have a fairly complex application with alot of macros, OC functions, script sections and involving graph drawing. All the script is sequential and 'correct'. A manifestation of the problem is illustrated below :

run.section(Graph.ogs, HTDRGRaphSetup);
-- dataset creation, plotting etc that takes a couple of seconds
if(exist(HTDRGRaph) == 3) type OK;
type pete;

HTDRGraph should have been created but by the time the exist function is run it hasn't hence OK is not typed out. 'pete' is typed out.

if however, the code

if(exist(HTDRGRaph) == 3) type OK;
type pete;

is appended to the end of the section then it behaves as expected.

I'm not happy with the handling here and not sure how best to deal with this issue so any general advice would be appreciated, thanks.

Cheers,

pete

greg

USA
1378 Posts

Posted - 10/28/2009 :  1:40:16 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Without knowing what you have put in the HTDRGRaphSetup section, I cannot precisely answer your question.

Occasionally, Origin asks Windows to do something which we expect will be handled without error or delay and subsequent script may get ahead of expected results. A few workarounds are available.

Sometimes - not always - using the section return helps, as in
bret = run.section(Graph.ogs, HTDRGRaphSetup);
if(exist(HTDRGRaph) == 3) type OK;
You can also pad a little delay in the script to let things catch up:
run.section(Graph.ogs, HTDRGRaphSetup);
sec -p 1; // 1 second delay
if(exist(HTDRGRaph) == 3) type OK;
Or use the queue command:
run.section(Graph.ogs, HTDRGRaphSetup);
queue {if(exist(HTDRGRaph) == 3) type OK;}
doc -u; // This tells Origin to update, AFTER which the script runs

Hope this helps.
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