How do I correct vbs script

Get help using Construct 2

Post » Tue Jun 10, 2014 11:17 pm

hi i get an error whe i try to put this as a text

""Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "bat.bat" & Chr(34), 0
Set WshShell = nothing"" to the multiline box the error is detected at the word "WScript" how to correct that?

thanks
B
44
S
18
G
7
Posts: 1,819
Reputation: 10,384

Post » Wed Jun 11, 2014 7:21 am

Wouldn't you be better asking this on a more appropriate site that deals with vbs?
If your vision so exceeds your ability, then look to something closer.
Moderator
B
145
S
33
G
89
Posts: 5,913
Reputation: 62,591

Post » Wed Jun 11, 2014 10:59 am

nope because i use the vbs with construct2 with the multiline box so its a problem with multiline box i think
B
44
S
18
G
7
Posts: 1,819
Reputation: 10,384

Post » Wed Jun 11, 2014 11:06 am

Well, what you posted is a syntax error, the quotes are in the wrong places.
Scirra Founder
B
414
S
245
G
92
Posts: 25,205
Reputation: 200,351

Post » Wed Jun 11, 2014 12:53 pm

Ashley cant you tell me how i have to correct that? i mean what i have to change,

thanks
B
44
S
18
G
7
Posts: 1,819
Reputation: 10,384

Post » Wed Jun 11, 2014 1:02 pm

You should be using "" instead of " when you need to use double quotes inside a string value

Another solution is just to throw the script into a project file, or inside a global/local constant. (The project file is better IMO)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
23
G
18
Posts: 2,123
Reputation: 17,200

Post » Wed Jun 11, 2014 2:36 pm

so i have to use (""WScript.Shell"") instead of ("WScript.Shell") ?
B
44
S
18
G
7
Posts: 1,819
Reputation: 10,384

Post » Wed Jun 11, 2014 2:43 pm

See the section on string expressions in the manual.
Scirra Founder
B
414
S
245
G
92
Posts: 25,205
Reputation: 200,351

Post » Wed Jun 11, 2014 5:20 pm

Don't forget newlines, It's only one statement per line in VBScript.

Code: Select all
"Set WshShell = CreateObject(""WScript.Shell"") & newline &
"WshShell.Run ""bat.bat"", 0" & newline &
"Set WshShell = nothing"
B
81
S
33
G
27
Posts: 1,029
Reputation: 21,143

Post » Thu Jun 12, 2014 5:14 pm

thanks :D
B
44
S
18
G
7
Posts: 1,819
Reputation: 10,384


Return to How do I....?

Who is online

Users browsing this forum: mallorcaredes, PitfallJerry and 2 guests