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
37
S
15
G
7
Posts: 1,681
Reputation: 9,614

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
134
S
30
G
86
Posts: 5,413
Reputation: 59,510

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
37
S
15
G
7
Posts: 1,681
Reputation: 9,614

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
397
S
236
G
88
Posts: 24,408
Reputation: 194,496

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
37
S
15
G
7
Posts: 1,681
Reputation: 9,614

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

Post » Wed Jun 11, 2014 2:36 pm

so i have to use (""WScript.Shell"") instead of ("WScript.Shell") ?
B
37
S
15
G
7
Posts: 1,681
Reputation: 9,614

Post » Wed Jun 11, 2014 2:43 pm

See the section on string expressions in the manual.
Scirra Founder
B
397
S
236
G
88
Posts: 24,408
Reputation: 194,496

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
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Thu Jun 12, 2014 5:14 pm

thanks :D
B
37
S
15
G
7
Posts: 1,681
Reputation: 9,614


Return to How do I....?

Who is online

Users browsing this forum: bclikesyou, kellehk, ST314 and 24 guests