PDA

View Full Version : How to add this?



ronwilliams
03-08-2010, 01:38 AM
I have :

Bentley = C:\\WINDOWS\\system32\\

I want

Bentley = "C:\\WINDOWS\\system32\\"

this won't work
Bentley = ""C:\\WINDOWS\\system32\\""

longedge
03-08-2010, 02:11 AM
Try -


Bentley = \"C:\\WINDOWS\\system32\\\"

meny
03-08-2010, 02:27 AM
You might want to take a look at the Global Variables:
_SystemFolder, _WindowsFolder, etc.

ronwilliams
03-08-2010, 03:34 AM
Thanks guys

ronwilliams
03-08-2010, 03:42 AM
Cool, but if I have a variable, how would that work?


Var = C:\\WINDOWS\\system32

Bentley = \"..Var..\\\" ??? Will this work?

meny
03-08-2010, 03:53 AM
Use _SystemFolder as-is:

Bentley = _SystemFolder;
exeFile = "cmd.exe";
pathToExeFile = Bentley .. "\\" .. exeFile;
Shell.Execute (pathToExeFile, "open", "", "", SW_SHOWNORMAL, false);

Or just:

exeFile = "cmd.exe";
pathToExeFile = _SystemFolder .. "\\" .. exeFile;
Shell.Execute (pathToExeFile, "open", "", "", SW_SHOWNORMAL, false);

ronwilliams
03-08-2010, 04:03 AM
Thanks, but that path is just a sample:

Here is the actual script:
for x = 1,4 do

Sound = XML.GetValue(strXMLPath.."/audioanswer"..x.."");
AudiA = (WereAreThow..Sound)

Button.SetProperties("Answer"..x,{ClickSound=2});
Button.SetProperties("Answer"..x,{ClickSoundFile= AudiA});

You see AudiA needs the "" , so how do I get the content of AudiA between " "

longedge
03-08-2010, 04:10 AM
In general terms when you want to include a control character e.g. / or " etc in a string, then you need to escape it. To do so you precede it with \

ronwilliams
03-08-2010, 04:12 AM
AudiA = "\"..AudiA.."\" Like this?

ronwilliams
03-08-2010, 04:17 AM
Thanks, worked it out:

AudiA = "\""..AudiA.."\""

!!!

longedge
03-08-2010, 04:21 AM
Do it within your concatenation. Say I was setting the text for a label then -


txt = "Something"
Label.SetText("Label1", "\""..txt.."\"");

p.s. -- Oh right - too late :)

ronwilliams
03-08-2010, 05:35 AM
I need help!!!!! Nothing wants to work today!!!!
for x = 1,4 do
AnswerD = "Answer"..x..""
Answer = "\""..AnswerD.."\""
Bentley = \"C:\\WINDOWS\\system32\\wowsound\\\"


Button.SetProperties(Answer,{ClickSound="2"}); Button.SetProperties(Answer,{ClickSoundFile=Bentle y});

WON"T WORK AT ALL!!!!!!!!
PLEASE>>>>>

meny
03-08-2010, 05:46 AM
Why don't you post you project?

Hard to make out what is going on with partial code.

ronwilliams
03-08-2010, 06:05 AM
All I want to do is change a buttons "on click sound" in the form of a variable:

for x = 1,4 do
AnswerD = "Answer"..x..""
Answer = "\""..AnswerD.."\""
Bentley = \"C:\\WINDOWS\\system32\\wowsound\\sound.wav\\\"

Not Working:
Button.SetProperties(Answer,{ClickSound="2"});
Button.SetProperties(Answer,{ClickSoundFile= Bentley});

Working:
Button.SetProperties("Answer1",{ClickSound="2"});
Button.SetProperties("Answer1",{ClickSoundFile=""C:\\WINDOWS\\system32\\wowsound\\sound.wav"});

Works? Why

meny
03-08-2010, 06:28 AM
Why so complicated (and syntatically-incorrect)

Bentley = \"C:\\WINDOWS\\system32\\wowsound\\sound.wav\\\ "
??
~ You cannot have a \ before the "
~ you cannot have \\\
When you try this the complier says so!

Just use


Bentley = _SystemFolder .. "\\wowsound\\sound.wav"

reteset
03-08-2010, 06:47 AM
min = 1;
max = 4;
for count = min, max do
local Sound = "wow.waw" -- XML.GetValue(strXMLPath.."/audioanswer:"..count);
local ButtonName = "Answer"..count;
local SoundPath = string.format("%s\\%s",_SystemFolder,Sound);
Button.SetProperties(ButtonName,{ClickSound=2,Clic kSoundFile=SoundPath});

end