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
 Origin Forum
 If..Else.. Command Window vs Script Panel

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
cdrozdowski111 Posted - 12/04/2012 : 07:02:50 AM
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";}
2   L A T E S T    R E P L I E S    (Newest First)
cdrozdowski111 Posted - 12/05/2012 : 1:06:56 PM
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.
cpyang Posted - 12/05/2012 : 12:39:43 PM
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

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