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
 Origin Forum
 Variables as master items (filename=%G,window name=%H)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Daniel Kabs

5 Posts

Posted - 04/25/2000 :  8:30:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello Forum,

I´d like to have the filename and
graph name in every Origin plot of
my project. To achieve this I use
the system variables %G and %H in
a text item.

To duplicate text on all graph windows
in one project one uses the "master page".

Thus I added a text field containing:

filename: %G (%H)

to the master page.

In Origin 5.0 w/o patches the text appears fine on all graph windows showing the file- and window-name.
Caused by a BUG in this version one cannot
print master items. The remedy is to patch ORIGIN to service release 2.

Doing so, I can now print master items
BUT the %H variable is now shown as "MASTER" on all pages instead being the window name of each individual graph plot.

Please help, what can I do to get the correct window name back?

Thanks for your help.
Cheers
Daniel Kabs
Germany

greg

USA
1379 Posts

Posted - 05/03/2000 :  8:55:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The scope of the expression of %H did change after the release of Origin 5.0. I think it makes more sense now (%H is always the active window - and the text object containing this %H is in the window named 'master'), but that leaves you with a problem.

The programmers will look at this and consider whether it should be changed back (in a future version of Origin - not in 5.0). In the meantime, you should look for a different solution - such as a new menu item that adds (and/or removes?) the text to any Graph window as needed. See the menu and label commands in the LabTalkTM Manual.
Go to Top of Page

CStorey

Canada
137 Posts

Posted - 05/03/2000 :  8:56:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Daniel,

If you are using graph templates you can add a script to each template which will add the information automatically. Here's what I do in Origin 6.0.

A) Create a text label somewhere on the graph with the word "temp".
This text will be replaced by the path info later so it's not
important.
B) Right click on the text and select LABEL CONTROL. A dialog box
should appear.
C) Add the following code.

%P="\v(%H from %X%G.OPJ)";
label -s -sa -d (.20*page.width) (.84*page.height) -n Path %P;

This code puts the current window name %H as well as the path %X and
project name %G into the the string %P then uses the label command
to display it at the desired co-ordinates.

D) Change the OBJECT NAME to "Path".
E) Finally you can select when you want this to happen from the
SCRIPT, RUN AFTER drop down listbox. I usually use 'After save'
because the path info and project name are correct that way. Then
when you print the graph you have a record of where everything is.

F) Save the template with the new text label.

I hope this helps. If you have any questions you can email me @ cstorey@canada.com.
Craig Storey

[This message has been edited by CStorey (edited 05-03-2000).]

Go to Top of Page

rtoomey

USA
184 Posts

Posted - 05/18/2000 :  2:44:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Daniel


The -s and -sa options included in the label command statement are designed to create a label which interprets and expresses any string variable prior to actually creating the label. That way the text that gets entered into the label reflects what is actually stored in your string variables, rather than displaying the string variable itself. In handling it this way, it becomes unnecessary to enable the "Link to Variables" check box.


That being said, you may still be wondering why your label does not get created correctly, hah? Well, I think that the label command line just needs to be tweaked a bit. Specifically:


  1. The string variables which contain the window title, path, and filename (%H, %X, and %G) do not require the extra % symbols since the first % symbol should get interpreted by the -s option before the text ever gets entered into the text label.
  2. The y component of the -d option is not completely enclosed in parentheses. It needs to have an opening one. I suspect this may have been a typo on your part.


What you end up with is the following:




%P="\v(%H from %X%G.OPJ)";
label -s -sa -d (.05*page.width) (0.98*page.height) -n myPath %P;
myPath.fsize=10;

Try it out and see if it works for you. Again, the correct label should show up without the need to check the "Link to Variables" check box. It should also not require a refresh.


Sincerely,
Ryan Toomey

[This message has been edited by rtoomey (edited 05-18-2000).]

[This message has been edited by rtoomey (edited 05-18-2000).]

Go to Top of Page

Daniel Kabs

5 Posts

Posted - 05/18/2000 :  8:43:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello again,

the answer to the missing "\" is the use of
the \v( ) notation (also mentioned in the LabTalk helpfile, section "string system variables"). This will retain the backslash.

Now I changed the script to:
%P="\v(%%H from %%X%%G.OPJ)";
label -s -sa -d (.05*page.width) 0.98*page.height) -n myPath %P;
myPath.fsize=10;

This way the label contains VARIABLES and not the content of the variables. Thus the label will reflect changes in the file- and windownames. Theres one drawback. One has to
enable "link to variables" in the label control box by hand and then refresh the display. Does anybody know how to do this with scripting?

Cheers for you help,
Daniel Kabs
Univ. Kaiserslautern
Germany

[This message has been edited by Daniel Kabs (edited 05-18-2000).]

Go to Top of Page

Daniel Kabs

5 Posts

Posted - 05/18/2000 :  8:55:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi CStorey,

thanks for your help. As I´m not using graph templates I´ll use your script code in the ScriptWindow to add a label to a graph window.

This works fine and also leaves the "\" in the path variable (%X). Strange, but the backslash is removed if I create this text label by hand.

Cheers
Daniel Kabs
Germany

Go to Top of Page

Daniel Kabs

5 Posts

Posted - 05/19/2000 :  8:34:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello rtoomey,

Thanks for trying to help out.
I´d like to comment on your statements as
I think I didn´t make my point clear.

1.
The %P="\v(%H from %X%G.OPJ)"; is the same command which CStorey (see above) used. And
that didn't work as the variables get interpreted. Having said that, it does of course work but not the way we want it to work:
Try
type %P;
Thats what you get in the label: the content of the variables. That´s not what we want! We want the variables themselves in the label. Therefore I used the second % to prevent the label command from resolving the variables.


Try my solution please. It does work. The only thing that´s left is to activate the "Link to variables" thingie. I don´t know how to do that in LabTalk. Maybe you know ?

2.
You are right. The missing bracket is a typo :-)


Cheers
Daniel Kabs
Dept. of Physics
Univ. Kaiserslautern
Germany

[This message has been edited by Daniel Kabs (edited 05-22-2000).]

Go to Top of Page

rtoomey

USA
184 Posts

Posted - 05/22/2000 :  12:22:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Daniel Kabs,

It is not currently possible to enable the Link to variables check box. I have added a suggestion to our database requesting this feature and have included your information in the suggestion in an effort to increase its priority.

In the meantime, since your methods rely on this setting, you would be better off utilizing graph templates (as was suggested earlier).

For instance, suppose you most often choose to plot line graphs. Line graphs are created by a graph template called Line.OTP. To add the label to Line.OTP, do the following:

  1. Open Line.OTP. To do so, click on the Open Template button on the Standard toolbar, navigate to the Origin installation folder, and double-click on the file called Line.OTP. If you aren't sure what the Open Template button looks like, here is is:

  2. Create a text label in the exact location you would like to see it appear (at all times) and enter \v(%H from %X%G.OPJ) in Text Control. Click OK.
  3. Alt + double-click on the text label to access Label Control.
  4. Select Window Activate from the 'Script, Run After' drop-down list and enable the 'Link to Variables' check box. Click OK.
  5. Choose File:Save Template As and overwrite the existing Line.OTP.

Once you have done this you can create line plots with your new label by selecting Plot:Line or by clicking on the Line Graph button on the 2D Graphs toolbar. Furthermore, every time you activate the graph, the label will update (if the graph, path, or filename has changed).

I apologize for any inconvenience this has caused you and hope that my suggestions prove helpful.

Sincerely,
Ryan Toomey

[This message has been edited by rtoomey (edited 05-22-2000).]

[This message has been edited by rtoomey (edited 05-22-2000).]

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