How do you declare a string, e.g. '1998-2004' ?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
tomasz
Newbie
Posts: 3
Joined: Wed May 19, 2004 4:26 pm
Location: san diego
Contact:

How do you declare a string, e.g. '1998-2004' ?

Post by tomasz » Wed May 19, 2004 5:03 pm

Let>text=1998-2004
MessageModal>%text%


will show the value of '-6' because the variable 'text'
automatically evaluates to an integer.
The following workarounds are ok within one script,
but when I pass the variable to another script, it gets
evaluated as an integer again.


// Workaround 1
Let>text=1
// ConCat makes the variable text into a string for this script
ConCat>text,998-2004
MessageModal>%text%
// But this makes it back into an integer
Macro>NextScript /var1=%text%




// Workaround 2
// The hidden character makes this into a string, ok for this script
Let>text=1998-2004%CR%
MessageModal>%text%
// But this makes it back into an integer
Macro>NextScript /var1=%text%



Thanks,
tomasz

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed May 19, 2004 11:08 pm

Let>text=1998-
Let>text=%text%2004
Message>%text%
works for me.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

tomasz
Newbie
Posts: 3
Joined: Wed May 19, 2004 4:26 pm
Location: san diego
Contact:

Post by tomasz » Wed May 19, 2004 11:53 pm

ok, but now when you pass it as a parameter to another Macro, it gets evaluated as an integer. For example:


Macro>NextScript /parameter=%text%


Is there any way to force a type, i.e. string type, in the MJT language?
tomasz

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu May 20, 2004 12:13 am

See reply moved to duplicate posting at:
http://www.mjtnet.com/forum/posting.php ... eply&t=961
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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