'Assigned' does not work as expected

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

'Assigned' does not work as expected

Post by Jerry Thomas » Tue Nov 02, 2010 8:08 pm

I have subroutines that have optional parameters.

Code: Select all

GoSub>Test,,3

SRT>Test
  Assigned>Test_Var_1,bRslt
  If>bRslt=TRUE
    //do stuff
  Endif
End>Test
In the Watch List, Test_Var_1 shows as blank but bRslt=TRUE.

I have tried using

Code: Select all

Length>Test_Var_1,varLength
If>{(%varLength%>0) and (%varLength%<10)}
...
but this can be cumbersome.

Any suggestions?
Thanks,
Jerry

[email protected]

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Nov 02, 2010 8:43 pm

Something like this help?

Code: Select all

GoSub>Test,,3

SRT>Test
  If>%Test_Var_1%<>{""}
    //do stuff
  Endif
End>Test
See HERE for a similar issue and answer.

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Tue Nov 02, 2010 10:10 pm

Definitely cleaner than what I was doing.
Thanks!
Thanks,
Jerry

[email protected]

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 Nov 03, 2010 6:45 am

Assigned tests for whether the given variable name EXISTS. Since you can see it in the watch list it DOES exist. Hence you get true.

As JRL suggests it looks like you actually want to test whether or not the variable is an empty string.
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
Sign up to our newsletter for free automation tips, tricks & discounts