Problem with 7.4.009 complex expression ?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
pasdad1
Junior Coder
Posts: 21
Joined: Wed Nov 17, 2004 1:09 am

Problem with 7.4.009 complex expression ?

Post by pasdad1 » Tue Feb 14, 2006 4:43 pm

I have reproduced the log file produced as the macro failed below.

Two message boxes popup one after the other, which have the following text and an "Ok" button.

The 1st reads:
"Incorrectly formed parameters"

and the second reads:
"3 not appropriate"

And then the macro stops.

I don't see the problem, and the messages don't seem to make any sense in this context.

Does anyone have a clue about this? The methods and code
I am using has been used successfully in other macros for a
long time now.


2/14/2006 11:19:32:636 - Started Macro : C:\Program Files\MJT Net Ltd\Macro Scheduler\Case Management\Cancel Transaction Entry.scp
2/14/2006 11:19:32:636 - // ************************************************************
2/14/2006 11:19:32:636 -
2/14/2006 11:19:32:636 - VBStart
2/14/2006 11:19:32:636 - VBEval>unescape("334Notes%20Entry*"),mywin
2/14/2006 11:19:32:636 -
2/14/2006 11:19:32:636 - Let>mypos={Pos("Notes","334Notes Entry*")}
2/14/2006 11:20:17:683 - Finished Macro : C:\Program Files\MJT Net Ltd\Macro Scheduler\Case Management\Cancel Transaction Entry.scp
2/14/2006 11:20:17:683 - Finished Macro : C:\Program Files\MJT Net Ltd\Macro Scheduler\Case Management\Test Open And Close All Case Mgt.scp
2/14/2006 11:20:17:683 - Finished Macro : A Case Management Master


Here is a snippet from the actual source code.

// ********************************
// ** Cancel Transaction Entry
// **
// ** This should work to cancel the add or edit mode of the
// ** similar transaction screens (notes, other1, other2,
// ** email, med specials, etc)
// **
// ** call it like this:
// ** Macro>Cancel Transaction Entry /mywin=Other 1 Entry*
// **
// *********************************

// Since parameters may contain the "/" character which is not
// allowed by macro scheduler syntax, the parameter is "escaped"
// prior to passing, and then "unescaped" to get it back to its
// original form
VBStart
VBEnd
VBEval>unescape("%mywin%"),mywin

Let>mypos={Pos("Notes","%mywin%")}
If>mypos>0
Let>Xcoord=NE001X
Let>YCoord=NE001Y
Endif

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

Post by Marcus Tettmar » Tue Feb 14, 2006 4:52 pm

Hi,

1) Syntax should be:

Let>mypos={Pos("Notes",%mywin%)}

2) Not sure why your comment says that "/" aren't allowed in Macro Scheduler syntax. Nothing wrong with them.

3) You will get problems if there is a " (double quote) character in the string since complex expressions use that to delimit the string. The solution is double quote:

StringReplace>mywin,","",mywin

I would add that line prior to the Pos line if you don't know what the string could contain. It avoids any issues with string delimiters inside the string.

4) But why don't you just do:

Pos>Notes,mywin,1,mypos

That avoids any problems with quote marks etc since it uses native Macro Scheduler syntax which doesn't care about string delimiters.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

pasdad1
Junior Coder
Posts: 21
Joined: Wed Nov 17, 2004 1:09 am

Why you can't pass "/" in parameters

Post by pasdad1 » Tue Feb 14, 2006 6:38 pm

2) Not sure why your comment says that "/" aren't allowed in Macro Scheduler syntax. Nothing wrong with them.
If you are passing a variable as a parameter to another macro as in this example:

Macro>Cancel Transaction Entry /mywin=Other 1 Entry*

It will fail if your variable contains the "/" character like so:

Macro>Cancel Transaction Entry /mywin=Other / Misc

So, therefore it is neccessary to use a process which will change it to some other character, and the vbscript functions "escape" and unescape" do nicely for this.

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

Post by Marcus Tettmar » Tue Feb 14, 2006 6:58 pm

Ah - that is true. I hadn't realised you were passing the values into another macro. I just thought you were were working in one macro and wondered why the comment.
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