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 for Programming
 LabTalk Forum
 Trying to change column order with Labtalk

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
OriginUser9 Posted - 04/11/2022 : 04:14:42 AM
Here is the code:
doc -ef W {
 doc -e LW {
 if(%H == "wks1" || %H == "wks2" || %H == "wks3")

{ 
colmove rng:=col(3):col(4) operation:=first;
}
}};


But I get an error:
Command Error!
. What's the problem?
3   L A T E S T    R E P L I E S    (Newest First)
aplotnikov Posted - 04/11/2022 : 07:31:33 AM
page.active is an integer value:
if (page.active == 1 || ...) {...}


Use page.active$ if you need to compare strings:
if (CompareNoCase(page.active$,"Sheet1") == 0 || ...) {...}


PS. If you need to run the script only for selected workbooks ("windows") it may be reasonable to check the condition within the corresponding loop to avoid unnecessary checks and to improve the readability of your code:
doc -ef W {
  if ("%H"=="Book1" || ...) {
    doc -e LW {...}
  }
}

OriginUser9 Posted - 04/11/2022 : 06:51:43 AM
Sorry, I wanted to say that I use windows name.
doc -ef W {
 doc -e LW {
 if(%H == "window1" || %H == "window2")

 {
       
	colmove rng:=col(3):col(4) operation:=first;
	  

   }
}};

But even when I change the code like you said, I get the same error.
doc -ef W {
 doc -e LW {
 if(%page.active == "wks1" || %page.active == "wks2")

 {
       
	colmove rng:=col(3):col(4) operation:=first;
	  

   }
}};

I tried to remove % from the code, but I still get the error.
aplotnikov Posted - 04/11/2022 : 06:23:09 AM
%H contains the window name, not the worksheet name. You can use the page.active value instead.

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