logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
TBacker  
#1 Posted : Friday, March 5, 2021 8:29:03 AM(UTC)
TBacker

Rank: Advanced Member

Groups: Registered
Joined: 10/29/2019(UTC)
Posts: 93
United States
Location: Syracuse

Thanks: 9 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?
doggy  
#2 Posted : Friday, March 5, 2021 8:42:35 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,041
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 913 time(s) in 752 post(s)
Can you show what you mean (code or intention)
TBacker  
#3 Posted : Friday, March 5, 2021 9:03:56 AM(UTC)
TBacker

Rank: Advanced Member

Groups: Registered
Joined: 10/29/2019(UTC)
Posts: 93
United States
Location: Syracuse

Thanks: 9 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

doggy  
#4 Posted : Friday, March 5, 2021 9:37:39 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,041
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 913 time(s) in 752 post(s)
Google tells me

Code:
'In VB.NET you must use 2 quotes: "John Said ""Hi"""
& """" & "c:\Program .....

thanks 1 user thanked doggy for this useful post.
TBacker on 3/5/2021(UTC)
TBacker  
#5 Posted : Friday, March 5, 2021 12:19:03 PM(UTC)
TBacker

Rank: Advanced Member

Groups: Registered
Joined: 10/29/2019(UTC)
Posts: 93
United States
Location: Syracuse

Thanks: 9 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.
Users browsing this topic
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.