vMix Forums
»
General
»
General Discussion
»
VB Scripting: CHR(#) not recognized
Rank: Advanced Member
Groups: Registered
Joined: 10/29/2019(UTC) Posts: 94 Location: Syracuse Thanks: 10 times Was thanked: 4 time(s) in 3 post(s)
|
Okay, I need to programmatically enclose a string in quotation marks. When I'm writing vb.Net apps this is usually by appending Chr(34) to each end. But for some odd reason, vMix's script interpreter has no idea what Chr(34) is, nor Strings.Chr(34).
Ideas or alternate methods?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,221 Location: Belgium Thanks: 293 times Was thanked: 955 time(s) in 790 post(s)
|
Can you show what you mean (code or intention)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 10/29/2019(UTC) Posts: 94 Location: Syracuse Thanks: 10 times Was thanked: 4 time(s) in 3 post(s)
|
Line 13 below. Passing arguments to a cmd.exe... Code:
'Configure webcams
Console.WriteLine(Microsoft.VisualBasic.Strings.Format(DateTime.Now(),"HH:mm:ss") & " | Configuring webcams...")
ExtProcessParams = New Diagnostics.ProcessStartInfo
ExtProcessParams.FileName = "cmd.exe"
ExtProcessParams.CreateNoWindow = true
ExtProcessParams.UseShellExecute = false
ExtProcessParams.RedirectStandardError = true
ExtProcessParams.RedirectStandardOutput = true
ExtProcessParams.Arguments = "/c " & Chr(34) & "C:\Program Files (x86)\CamSet\ConfigureWebcams.cmd" & Chr(34)
ExtProcess = Diagnostics.Process.Start(ExtProcessParams)
ExtProcess.WaitForExit()
ExtProcessResult = ExtProcess.StandardOutput.ReadToEnd()
ExtProcessError = ExtProcess.StandardError.ReadToEnd()
If Not ExtProcess.ExitCode = 0 Then
Console.WriteLine(Microsoft.VisualBasic.Strings.Format(DateTime.Now(),"HH:mm:ss") & " | Configuring webcams failed.")
Console.WriteLine(Microsoft.VisualBasic.Strings.Format(DateTime.Now(),"HH:mm:ss") & " | " & ExtProcessResult)
Console.WriteLine(Microsoft.VisualBasic.Strings.Format(DateTime.Now(),"HH:mm:ss") & " | " & ExtProcessError)
End If
ExtProcessResult = ""
ExtProcessError = ""
ExtProcessParams = Nothing
ExtProcess = Nothing
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,221 Location: Belgium Thanks: 293 times Was thanked: 955 time(s) in 790 post(s)
|
Google tells me Code:'In VB.NET you must use 2 quotes: "John Said ""Hi"""
& """" & "c:\Program .....
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 10/29/2019(UTC) Posts: 94 Location: Syracuse Thanks: 10 times Was thanked: 4 time(s) in 3 post(s)
|
Well I'll be damned - all the years I've been writing vb.net stuff, and the only way I knew to do this was appending character codes. I had no idea you could escape quotes with....more quotes in .Net.
I guess using Chr(34) is a habit I picked up in VB6 and it worked in .Net too, so I never changed.
I searched earlier too, but I searched "CHR(34) alternative" then ran out of time before digging deeper.
Thanks doggy.
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
VB Scripting: CHR(#) not recognized
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close