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
 If..Else.. Command Window vs Script Panel
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cdrozdowski111

USA
247 Posts

Posted - 12/04/2012 :  07:02:50 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 9.0.0 (Student Version), Win7 64-bit, running in VMware Fusion 5.0.2

1) Start a new, virgin worksheet, no data, just A & B columns.

Why does the following code output "it doesn't exist" when run in the Command Window but not in the Script Panel for the worksheet (when entered manually and Execute button clicked)?

if (exist(col(C)) > 0) {type -b "it exists";} else {type -b "it doesn't exist";}

cpyang

USA
1406 Posts

Posted - 12/05/2012 :  12:39:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I don't really know why but you will be better off by using a button to run your script in the worksheet.

Maybe this is useful?

http://wiki.originlab.com/~originla/wiki/index.php?title=Script:From_Graphical_Objects

You can also place the button on the top of the worksheet, above the heading area, so that if your sheet has more columns(thus no empty space on the right), you can still see your buttons,

1. From main menu Format:Worksheet
2. Choose Size tab and find Worksheet Measurement:Gap From Top
3. enter 20, this is in pixel units.

You can now add a button in this region and not having to worry about having many columns. You can further set the color of this region by the following Labtalk code:

page.BASECOLOR=color(224,224,224)

CP
Go to Top of Page

cdrozdowski111

USA
247 Posts

Posted - 12/05/2012 :  1:06:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
My point, and I mean this positively, is why does one method to run LabTalk choke on a very basic conditional statement that others methods don't.

If I run the following code in the workbook script panel, the conditional works correctly:

if (exist(col(A)) > 0) {type -b "it exists";} else {type -b "it doesn't exist";}

So why doesn't:

if (exist(col(C)) > 0) {type -b "it exists";} else {type -b "it doesn't exist";}

I am not aware of how to access any sort of online bug database to search in case such things might be a bug.
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