My client has a program that has arguments with double quotes around them and then he has code that is to be used to pass the arguments with double quotes to the back end i developed here is that code:
Sub ParseCommandLine(CmdLine, RaffleID, Password, FirstTicketNo, LastTicketNo)
' There will be either 3 or 4 parameters
' If there are only 3 then the third is last ticket no and a first ticket no of 1 is implied
' If there are 4 then the third is first ticket no and the fourth is last ticket no
' The first 2 args are always password and RaffleID
Password = GetNextArgument(CmdLine)
RaffleID = GetNextArgument(CmdLine)
FirstTicketNo = GetNextArgument(CmdLine)
LastTicketNo = GetNextArgument(CmdLine)
If LastTicketNo = "" Then
LastTicketNo = FirstTicketNo
FirstTicketNo = 1
End If
End Sub
Function GetNextArgument(CmdLine)
Index = InStr(CmdLine, " ")
If (Index = 0) Then
'End of line
GetNextArgument = CmdLine
GetNextArgument = Replace(CmdLine, """", "")
'Remove double quotes
CmdLine = ""
Exit Function
End If
GetNextArgument = Left(CmdLine, Index)
GetNextArgument = Replace(GetNextArgument, """", "") 'Remove double quotes
CmdLine = Right(CmdLine, Len(CmdLine) - Index)
End Function
Private Sub Command1_Click()
Call ParseCommandLine(CmdLine, RaffleID, Password, FirstTicketNo, LastTicketNo)
Dim cCommand As String
cCommand = "C:\Program Files\RaffleMaker\RMDESKTOP\TB - LITE.EXE " & _
CmdLine & ", " & RaffleID & ", " & Password & ", " & FirstTicketNo & ", " & LastTicketNo
RetVal = Shell(cCommand, 1)
End Sub
is what i am wanting to know am i going to need to have double quotes in my back end if so how would i set that up here is the code in my program that deals with parsing is below:
Dim strValuesFromCommandLine() As String
Dim CmdLine As String
Dim RAFFLEID As String
Dim PASSWORD As String
Dim FirstTicketNo As String
Dim LastTicketNo As String
Dim RAFFLEID1a As String
Form1.WindowState = 0
If Len(Command) > 0 Then
strValuesFromCommandLine() = Split(Command$, ", ")
CmdLine = strValuesFromCommandLine(0)
RAFFLEID = strValuesFromCommandLine(1)
PASSWORD = strValuesFromCommandLine(2)
FirstTicketNo = strValuesFromCommandLine(3)
LastTicketNo = strValuesFromCommandLine(4)
Else
MsgBox "Stand alone is not supported by this program.", vbOKOnly
End
End If
Sub ParseCommandLine(CmdLine, RaffleID, Password, FirstTicketNo, LastTicketNo)
' There will be either 3 or 4 parameters
' If there are only 3 then the third is last ticket no and a first ticket no of 1 is implied
' If there are 4 then the third is first ticket no and the fourth is last ticket no
' The first 2 args are always password and RaffleID
Password = GetNextArgument(CmdLine)
RaffleID = GetNextArgument(CmdLine)
FirstTicketNo = GetNextArgument(CmdLine)
LastTicketNo = GetNextArgument(CmdLine)
If LastTicketNo = "" Then
LastTicketNo = FirstTicketNo
FirstTicketNo = 1
End If
End Sub
Function GetNextArgument(CmdLine)
Index = InStr(CmdLine, " ")
If (Index = 0) Then
'End of line
GetNextArgument = CmdLine
GetNextArgument = Replace(CmdLine, """", "")
'Remove double quotes
CmdLine = ""
Exit Function
End If
GetNextArgument = Left(CmdLine, Index)
GetNextArgument = Replace(GetNextArgument, """", "") 'Remove double quotes
CmdLine = Right(CmdLine, Len(CmdLine) - Index)
End Function
Private Sub Command1_Click()
Call ParseCommandLine(CmdLine, RaffleID, Password, FirstTicketNo, LastTicketNo)
Dim cCommand As String
cCommand = "C:\Program Files\RaffleMaker\RMDESKTOP\TB - LITE.EXE " & _
CmdLine & ", " & RaffleID & ", " & Password & ", " & FirstTicketNo & ", " & LastTicketNo
RetVal = Shell(cCommand, 1)
End Sub
is what i am wanting to know am i going to need to have double quotes in my back end if so how would i set that up here is the code in my program that deals with parsing is below:
Dim strValuesFromCommandLine() As String
Dim CmdLine As String
Dim RAFFLEID As String
Dim PASSWORD As String
Dim FirstTicketNo As String
Dim LastTicketNo As String
Dim RAFFLEID1a As String
Form1.WindowState = 0
If Len(Command) > 0 Then
strValuesFromCommandLine() = Split(Command$, ", ")
CmdLine = strValuesFromCommandLine(0)
RAFFLEID = strValuesFromCommandLine(1)
PASSWORD = strValuesFromCommandLine(2)
FirstTicketNo = strValuesFromCommandLine(3)
LastTicketNo = strValuesFromCommandLine(4)
Else
MsgBox "Stand alone is not supported by this program.", vbOKOnly
End
End If