Character problem within a variable.
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 14
- Joined: Fri May 13, 2005 8:51 am
Character problem within a variable.
Hi guys, maybe you can help ..?
I have a macro that assignes the following to a variable %brief% :-
CFESJC02 has reported :- /usr/var/isis 94% full
When trying to pass this and other variables to another macro I am faced with a problem :
Macro>STKcreate.scp /impact=%impact% /brief=%brief% /msgtxt=%msgtxt%
The "/" characters in the variable %brief% aren't just being treated a meaningless text. I am assuming that MS is seeing :-
Macro>STKcreate.scp /impact=4 /brief=CFESJC02 has reported :- /usr/var/isis 94% full /msgtxt=load of message text
This is giving loads of pants errors. Is there a speech mark or bracket I can put round the var ?
Cheers.
I have a macro that assignes the following to a variable %brief% :-
CFESJC02 has reported :- /usr/var/isis 94% full
When trying to pass this and other variables to another macro I am faced with a problem :
Macro>STKcreate.scp /impact=%impact% /brief=%brief% /msgtxt=%msgtxt%
The "/" characters in the variable %brief% aren't just being treated a meaningless text. I am assuming that MS is seeing :-
Macro>STKcreate.scp /impact=4 /brief=CFESJC02 has reported :- /usr/var/isis 94% full /msgtxt=load of message text
This is giving loads of pants errors. Is there a speech mark or bracket I can put round the var ?
Cheers.
Could not find a way to make the text pass specifically but this technique might work as a workaround to the problem.
//Instead of
//Let>var=/abc /cbs /nbc
//Use
Let>var=~abc ~cbs ~nbc
deletefile>c:\grouptestmacro.scp
//then do a StringReplace in the to-be-run macro
Writeln>c:\grouptestmacro.scp,result,StringReplace>%passvar%,~,/,newpassvar
Writeln>c:\grouptestmacro.scp,result,MessageModal>%newpassvar%
Wait>2
macro>c:\grouptestmacro.scp /passvar=%var%
Hope this is helpful,
Dick
//Instead of
//Let>var=/abc /cbs /nbc
//Use
Let>var=~abc ~cbs ~nbc
deletefile>c:\grouptestmacro.scp
//then do a StringReplace in the to-be-run macro
Writeln>c:\grouptestmacro.scp,result,StringReplace>%passvar%,~,/,newpassvar
Writeln>c:\grouptestmacro.scp,result,MessageModal>%newpassvar%
Wait>2
macro>c:\grouptestmacro.scp /passvar=%var%
Hope this is helpful,
Dick
-
- Newbie
- Posts: 14
- Joined: Fri May 13, 2005 8:51 am
Cheers
Thank you for the reply, there is a little problem though, although I think you might be on to something with the string replace command. The text that I am assigning to %brief% is literally that, variable, the text is being copied from an alarm monitor and as you can imagine these alarms are different all the time. Sometimes they don't contain these characters, somethimes they do. My thought is that (another workaround) I could write the text to a file and instead of passing it to the next macro, just get the macro to read it.
-
- Newbie
- Posts: 14
- Joined: Fri May 13, 2005 8:51 am
stringreplace
I am doing both, your idea and mine, to see which works better, not that I think there will be much (if any) preformance issues with a line or two of text. I had never seent eh stringreplace command before, it is really helpful, there is a few macros that I am going to pop back and adjust with this new found command, thanks, I appreciate your time and thoughts.
-
- Newbie
- Posts: 14
- Joined: Fri May 13, 2005 8:51 am
vars
I am in agreement with your, ideally I would just be able to surround the variable with bracket or character of somesort and it be ignored as possible commands and just treated as text. The reason I posted on here is because I like my scripts to be "tidy"
Thanks again for your help.
Thanks again for your help.
See this thread to see how I solved this problem:
http://www.mjtnet.com/forum/viewtopic.p ... highlight=
adroege,
In your Feb. 23, 2005 post you said:
Hope this was helpful,
Dick
In your Feb. 23, 2005 post you said:
I just wanted to point out that you can replace your character with a string which would make it much less likely to exist in your input data. For example the "/" could be replaced by something like "~s~l~a~s~h~". How likely it is that a given odd text string will be produced in your data can probably be evaluated and controlled by you since you understand your data.I don't have control over the data which is being read in, so
having the "/" characters is always a possibility. The only alternative
I can think of is to try to replace "/" with something else prior to
passing it as a parameter, however there is no "safe" character to
replace it with that might not already exist in the input data.
Any ideas? Or is there a way to make this limitation go away?
Hope this was helpful,
Dick