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
 import vs. worksheet script execution

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
juannim Posted - 03/23/2007 : 6:49:45 PM
Origin Version (Select Help-->About Origin): 7.5
Operating System:xp
Why does this script execute properly when I run it from a worksheet script window, but not when I set it to run automatically after import? Jonathan
loop(i,1,fdlog.multiopen.count) {
ii=5*(i-1);
fdlog.get(A,i,1);
wks.col$(ii+5).label$=%A;
};
wks.labels();

delete col(a)
delete col(b)
delete col(c)
delete col(d)
delete col(f)
delete col(g)
delete col(h)
delete col(i)
delete col(k)
delete col(l)
delete col(m)
delete col(n)
delete col(p)
delete col(q)
delete col(r)
delete col(s)
delete col(u)
delete col(v)
delete col(w)
delete col(x)
delete col(z1)
delete col(z2)
delete col(z3)
delete col(z4)
delete col(aa1)
delete col(aa2)
delete col(aa3)
delete col(aa4)
delete col(ab1)
delete col(ab2)
delete col(ab3)
delete col(ab4)
delete col(ac1)
delete col(ac2)
delete col(ac3)
delete col(ac4)
delete col(ad1)
delete col(ad2)
delete col(ad3)
delete col(ad4)
delete col(ae1)
delete col(ae2)
delete col(ae3)
delete col(ae4)
delete col(af1)
delete col(af2)
delete col(af3)
delete col(af4)
delete col(ag1)
delete col(ag2)
delete col(ag3)
delete col(ag4)
delete col(ah1)
delete col(ah2)
delete col(ah3)
delete col(ah4)
delete col(ai1)
delete col(ai2)
delete col(ai3)
delete col(ai4)
delete col(aj1)
delete col(aj2)
delete col(aj3)
delete col(aj4)
delete col(ak1)
delete col(ak2)
delete col(ak3)
delete col(ak4)
delete col(al1)
delete col(al2)
delete col(al3)
delete col(al4)

4   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 03/28/2007 : 9:52:53 PM
1. The col() function only accepts a column name or number as argument. If you need to identify a column by a variable use wcol() instead.

2. Deleting a column renumbers all subsequent columns and usually causes scripts like yours to fail.

Following script will delete all columns with indices that are not multiples of 5. (It counts backwards in order to maintain the numbering.)

for(i=wks.ncols;i>0;i--) {
if( mod(i,5) ) del wcol(i);
};

Mike Buess
Origin WebRing Member
juannim Posted - 03/28/2007 : 3:42:31 PM
Zachary,
Why won't this script for deleting the first 4 of every 5 columns work in custom.ogs?
loop(i,1,fdlog.multiopen.count)
{
ii=5*(i-1);
fdlog.get(A,i,1);
wks.col$(ii+5).label$=%A;
};
wks.labels();
loop(i,1,fdlogmultiopen.count)
{
ii=5*(i-1);
delete col(ii+4);
delete col(ii+3);
delete col(ii+2);
delete col(ii+1);
};
Jonathan

zachary_origin Posted - 03/23/2007 : 10:50:06 PM
Another point: why not use a loop to delete the columns? maybe you can try...

Zachary
OriginLab Technical Services.

Mike Buess Posted - 03/23/2007 : 10:17:20 PM
It doesn't execute from the script window because each of the delete commands must end with a semicolon. If you're executing at import from the Worksheet Script then it works for the same reason your Worksheet Script failed in your zeroing topic. Namely, scripts that run from the Worksheet Script dialog are executed one line at a time so semicolons are not necessary.

Mike Buess
Origin WebRing Member

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