MidStr Woe

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

MidStr Woe

Post by armsys » Wed Feb 02, 2011 10:20 am

Can some Macro Scheduler gurus enlighten me why MidStr doesn't get along with {pos(%tab%,%Item%)-1}?

Code: Select all

VBSTART
VBEND
VBEval>chr(9),tab
Let>Item=12345%tab%67890
Let>pos={pos(%tab%,%Item%)-1}
MDL>pos
MidStr>ItemCmd0_0,1,{pos(%tab%,%Item%)-1},result

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Feb 02, 2011 11:15 am

It's the extra commas. Confuses the parser for MidStr.

Anyway, you don't need that VBScript. V12 has %TAB% built in.

So you can just do:

Let>Item=12345%tab%67890
Let>x={pos(%tab%,%Item%)-1}
MidStr>Item,1,x,result

Or even quicker:

Let>Item=12345%tab%67890
Let>result={Copy(%Item%,1,pos(%tab%,%Item%)-1)}
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Feb 02, 2011 11:18 am

Or even:

Let>Item=12345%tab%67890
RegEx>^.*(?=\t),Item,0,results,numfound,0
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts