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
41
S
16
G
7
Posts: 1,747
Reputation: 9,957

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
137
S
31
G
87
Posts: 5,547
Reputation: 60,438

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
41
S
16
G
7
Posts: 1,747
Reputation: 9,957

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
402
S
238
G
89
Posts: 24,628
Reputation: 196,023

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
41
S
16
G
7
Posts: 1,747
Reputation: 9,957

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
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Wed Jun 11, 2014 2:36 pm

so i have to use (""WScript.Shell"") instead of ("WScript.Shell") ?
B
41
S
16
G
7
Posts: 1,747
Reputation: 9,957

Post » Wed Jun 11, 2014 2:43 pm

See the section on string expressions in the manual.
Scirra Founder
B
402
S
238
G
89
Posts: 24,628
Reputation: 196,023

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
75
S
31
G
27
Posts: 1,015
Reputation: 20,765

Post » Thu Jun 12, 2014 5:14 pm

thanks :D
B
41
S
16
G
7
Posts: 1,747
Reputation: 9,957


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests