String issues and hyphen/minus

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
pauldude
Newbie
Posts: 1
Joined: Fri Sep 28, 2007 9:36 pm

String issues and hyphen/minus

Post by pauldude » Fri Sep 28, 2007 9:49 pm

OK, I'm pulling my hair out.

I am attempting to create a string that contains letters, numbers, the { } characters, and the hyphen. Something like this:

{ABC12B-456-78432B}

However, I get the "B is not appropriate" error when doing this:

Let>thestring={ABC12B-456-78432B}

OK, so I tried putting quotes around it.
Let>thestring="{ABC12B-456-78432B}"

I got passed the "not appropriate error", but I'm attempting to send this string to an external DLL function. The problem is that the string has those quotes around it when the DLL function receives it. So again, no good. Instead of the DLL getting this:

{ABC12B-456-78432B}

It's getting this:

"{ABC12B-456-78432B}"

I just need a string, no quotes, that contains hyphens, and send this string to an external DLL function. I thought that if I remove the double quotes from this attempt:

Let>thestring="{ABC12B-456-78432B}"

And then call the function with theString, it would work, but again, the "B is not appropriate error comes up when calling the DLL function.

I've tried everything, but this on the surface should be so simple. I'm guessing that the hyphen is causing all the trouble. Can someone share some light on this? I can't believe it's so difficult just to declare a string with these characters (I couldn't find anything in the help that refers to special characters that need to be "escaped", similar to C and C++).

Paul

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Sep 29, 2007 12:01 am

MacroScheduler encloses complex expressions in {} so my guess is that it's interpreting the parts of your string as variables, but variables in complex expressions need to have %% around them, these don't, so it's confused.

Anyway try assigning the inner part of the string, and then add the {} around it, this works for me:

Let>mystring=ABC12B-456-78432B
Let>ms1={
Let>ms2=}

concat>ms1,mystring
concat>ms1,ms2
MDL>ms1

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

Post by Marcus Tettmar » Sat Sep 29, 2007 12:44 pm

As has been pointed out, the curly braces have a special meaning. So you need to do this:

Let>thestring={"{ABC12B-456-78432B}"}
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