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
 recalculate not working in 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

jim67

6 Posts

Posted - 05/08/2014 :  2:02:59 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9.1.0 (32-bit) SR2
Operating System: Windows XP

I've been trying to automate running a number of origin project files that import from a database and create graphs. The data has unstacked columns which are set to Recalculate Mode: Auto. When running manually, all I have to do is load the project file and press the Database Import button and the raw data updates, the unstacked columns update and the graphs update.

To automate this, I created a batch file to run as a windows scheduled task.

The batch file, origin_batch.bat contains
"C:\Program Files\OriginLab\Origin91\Origin9.exe" -r (run.section(Test.OGS,main))

The labtalk script is in Test.OGS (resides in user files folder):
[Main]
doc -o "c:\origin\test.opj";
dbimport;
savepath$ = "c:\origin\test2.opj";
save %(savepath$);
document -s;
exit;

The script runs and creates the test2.opj project file. When I open it, the data has updated, but the unstacked columns tab is not updated and the graphs which are linked to the unstacked columns are not updated. Interestingly, the unstacked columns and the graph both show a green lock icon indicating that they are synched although they are not.

How can I get my script to recalculate the unstacked columns?

Castiel

343 Posts

Posted - 05/09/2014 :  08:41:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
To force all pending operations to update to completion:
run -p au;

To force a specific pending operation to update to completion:
run -p aui UID;
where UID can be found by clicking the lock and then "Show Info" item. For example, "Analysis(818): freqcounts", then UID=818.

妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

jim67

6 Posts

Posted - 05/09/2014 :  11:02:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I assume that the "run -p au;" command would be added to my test.ogs script after the "dbimport" command. I tried that and it had no effect.
Go to Top of Page

Castiel

343 Posts

Posted - 05/09/2014 :  11:45:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by jim67

I assume that the "run -p au;" command would be added to my test.ogs script after the "dbimport" command. I tried that and it had no effect.


You are right. "run -p au;" does not work. But "run -p aui UID;" does.

Edit: Well, it seems "run -p au;" sometimes works....

妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫

Edited by - Castiel on 05/09/2014 11:59:03 AM
Go to Top of Page

jim67

6 Posts

Posted - 05/09/2014 :  1:07:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I tried adding the UID to my script but it still doesn't work.

In my case, run -p aui 803;
Go to Top of Page

jim67

6 Posts

Posted - 06/05/2014 :  11:58:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Update:

It turns out that the run -p au command did update the unstacked data. I didn't notice this at first because I was looking at the graph to see if it had updated. The graph did not update. Oddly, I found that the graphs would update if I added the export to PowerPoint command to the script. Rather than using the PowerPoint command, using sec -p 2 to add a two second delay also works to get the graphs to update. It looks like it needs a delay for the graph updating to occur.
Go to Top of Page

jim67

6 Posts

Posted - 08/06/2014 :  2:36:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Update #2

It turns out that my previous solution doesn't work very often.

I have seemed to solve the problem by adding the following command after the line with "run -p au".

doc -e L {layer -a};

This causes all graphs to update.
Go to Top of Page

jim67

6 Posts

Posted - 08/19/2014 :  10:19:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The doc -e L {layer -a} script does update the graphs but I want to keep the axes from being rescaled. I've found that only the y-axis is rescaled, so I've modified the script to keep the y-axis scale the same:

doc -e LP
{
yv1=layer.Y.from;
yv2=layer.Y.to;
layer -a;
layer.Y.from=yv1;
layer.Y.to=yv2;
}
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