PDA

View Full Version : getting " " to strings.. ?


Silo_97
03-04-2005, 12:02 AM
Ok.. im experimenting to "learn" for my project..
and here“s the problem ..


sRegfile = Dialog.FileBrowse(true,"test",_DesktopFolder,"Regfiles (*.reg)|*.reg|");
sWindir = _WindowsFolder
sRegedit = String.Concat(sWindir,"\\regedit.exe");
sExecute_me = String.Concat(" /s ",sRegfile[1]);
Dialog.Message("hej",sExecuteme);
Shell.Execute(sRegedit,"open",sExecute_me,"",SW_SHOWNORMAL);


yeah yeah .. i know theres possibly as many ways to do this as there are
users on this forum . ;)
but.. im a total newbie.. so thats the way i done it..

this works fine as long as sRegfile dont contain spaces..

so how can i get some " " in there..
eg.
c:\yada yada yada\more\regfile.reg
"c:\yada yada yada\more\regfile.reg"

some must know what im asking 'bout. ?

Worm
03-04-2005, 07:06 AM
enclose the variable in quotes.

Shell.Execute(sRegedit,"open","\""..sExecute_me.."\"","",SW_SHOWNORMAL);

Silo_97
03-04-2005, 09:17 AM
ok .. have to try that ..

thanx

csd214
03-04-2005, 09:31 AM
...or you can combine single and double quotation marks.

sMethod1 = "\"c:\\yada yada yada\\more\\regfile.reg\"";
sMethod2 = '"c:\\yada yada yada\\more\\regfile.reg"';

It might be easier to read than the escaped quotation; but it is just a habbit.

yeah yeah .. i know theres possibly as many ways to do this as there are
users on this forum .
However, there are more then two members... :p

Worm
03-04-2005, 09:34 AM
I'm glad I got in early. I'll be interested in seeing the 8,767th way of doing this :)

Brett
03-04-2005, 10:26 AM
Another real easy way of doing it is to use double square brackets:

MyText = [[This is my "Text"! See how I can use all sorts of \unescaped\ stuff! I can even put

Line breaks in it!

....

..

.
..

I say, 'this is fun']];

Absynthe
03-04-2005, 12:30 PM
Another real easy way of doing it is to use double square brackets:


That rocks!

I do have to wonder how we could have figured that out on our own from the help file though.

Silo_97
03-07-2005, 08:33 AM
I'm glad I got in early. I'll be interested in seeing the 8,767th way of doing this :)

... i did say POSSIBLY.... :p

Intrigued
03-07-2005, 08:57 AM
That rocks!

I do have to wonder how we could have figured that out on our own from the help file though.
It's stated in the Help file in AMS 5.

Do this to get to it:

Click the F1 key when AMS 5 is active with a project.

Then type in Bracket and then choose the Using Comments listing (the first one of two).

Then scroll a few lines and you will see it explained.

I hope that helps.

csd214
03-07-2005, 10:40 AM
i did say POSSIBLY....
Sure, you are safe!

I'm glad there isn't 8,767 solutions to this issue! It's like buying a tie; if the salshop assistant is showing up more then three ties, then I have to ask my wife for help. (I hate to go shopping.)

I didn't know about the third solution (Brett's). Don't tell me more; or I must ask my wife to help me!

The help note Intrigued mention can also be found in the SUF70 help doc. Search for keyword 'comments' and select topic 'Using Comments'. However, it is about source comments; not about assigning values to a variable.

Silo_97
03-07-2005, 11:13 AM
I Thank you all for the help..

i solved my problem ..

surely ill be back.. (gonna try text file writing now) :lol :rolleyes

Absynthe
03-07-2005, 03:30 PM
It's stated in the Help file in AMS 5.

Do this to get to it:

Click the F1 key when AMS 5 is active with a project.

Then type in Bracket and then choose the Using Comments listing (the first one of two).

Then scroll a few lines and you will see it explained.

I hope that helps.

Ahhh, but I only use SUF7 :)