SEPARATE> read NULL as zero

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
asdf@asdf
Newbie
Posts: 9
Joined: Thu Mar 09, 2006 2:43 pm

SEPARATE> read NULL as zero

Post by asdf@asdf » Thu Mar 09, 2006 2:54 pm

Hi
usally when I use the separate command on an empty string Like this:

separate>string,;,vars

It result in vars_1=Null and vars_count=0

and I do an:
IF>vars_count>0
Do Stuff
endif

But now separate return vars_1=0 and therefore vars_count is =1 which screws up my if statement.

can i somehow define how macro scheduler shall read empty string

I'm using MS 8.0.1 demo

update: It only happens in one of my script's. Weird

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

Post by Marcus Tettmar » Thu Mar 09, 2006 3:31 pm

It is obviously not an empty string. Try triming it:

VBSTART
VBEND
VBEval>Trim("%fubar%"),fubar
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

asdf@asdf
Newbie
Posts: 9
Joined: Thu Mar 09, 2006 2:43 pm

Post by asdf@asdf » Thu Mar 09, 2006 3:34 pm

the problem also occurs when declaring and empty varible like:

Let>myvar=

when MS read this it reads
LET>myvar=0

But only some declarations. in the SRT thats called just before I declare Myvar2=

no problems there.

asdf@asdf
Newbie
Posts: 9
Joined: Thu Mar 09, 2006 2:43 pm

Post by asdf@asdf » Thu Mar 09, 2006 4:00 pm

He
found the problem This gotta be a bug

When you execute a WRITELN command, it is no longer possible for varibles to hold Null values, they are converted to zero's

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

Post by Marcus Tettmar » Thu Mar 09, 2006 4:08 pm

I am unable to reproduce. Please can you post the code that does this?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

asdf@asdf
Newbie
Posts: 9
Joined: Thu Mar 09, 2006 2:43 pm

Post by asdf@asdf » Thu Mar 09, 2006 4:15 pm

here goes:

YEAR>YYYY
MONTH>MM
DAY>DD
LET>TodaysDate=%YYYY%%MM%%DD%
IFFILEEXISTS>%logfile%
filedate>%logfile%,logfiledate
IF>LogFileDateTodaysDate
DeleteFile>%LogFile%
GOSUB>WriteLogFileHeader
Else
GOSUB>WriteLogFileHeader
ENDIF
ELse
GOSUB>WriteLogFileHeader
ENDIF
SRT>WriteLogFileHeader
GetDate>day
GetTime>timestamp
WRITELN>%logfile%,hej mand
WRITELN>%logfile%,*** ***
WRITELN>%logfile%,*** Acms Log File Created %day% @ %timestamp% ***
WRITELN>%logfile%,*** ***
WRITELN>%logfile%,*************************************************************
END>WriteLogFileHeader

Then i declare

Let>newfile=

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

Post by Marcus Tettmar » Thu Mar 09, 2006 4:18 pm

Your syntax is wrong. You have missed out the second parameter in WriteLn - the result variable. The value is being seen as the result variable, which is therefore being set to zero. Please look at the help for WriteLn - it takes this syntax:

WriteLn>filename,RESULT,value_to_write
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

asdf@asdf
Newbie
Posts: 9
Joined: Thu Mar 09, 2006 2:43 pm

Post by asdf@asdf » Thu Mar 09, 2006 4:27 pm

thought you could just type a string.
it actually works for writting in the file
But putting the chars i a output variable dosn't help.

NULL is still converted to zero
Wait didn't read your post right sorry i'll just test

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

Post by Marcus Tettmar » Thu Mar 09, 2006 4:30 pm

Sorry, I don't understand. The syntax is:

WriteLn>filename,result,outputvalue

result is the return code. You want:

WRITELN>%logfile%,RES,hej mand
WRITELN>%logfile%,RES,*** ***
WRITELN>%logfile%,RES,*** Acms Log File Created %day% @ %timestamp% ***
WRITELN>%logfile%,RES,*** ***
WRITELN>%logfile%,RES,*************************************************************
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

asdf@asdf
Newbie
Posts: 9
Joined: Thu Mar 09, 2006 2:43 pm

Post by asdf@asdf » Thu Mar 09, 2006 4:34 pm

my bad I didn't read your post right.

And yes my syntaks was all wrong.

it works now

thanks a lot for the fast reply's

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