thomas77
asked on
Get string from textfile, then compare it to another string
Hi all!
I have a strange problem. Here's the code.
Private Sub cmdTest_Click()
Open "c:\thomas" For Input As #1 ' file opened for reading
'While Not EOF(1)
Line Input #1, instring1
Line Input #1, instring2
Line Input #1, instring3
Line Input #1, instring4
Line Input #1, instring5
'Wend
Close #1
'MsgBox instring1 & vbCrLf & instring2 & vbCrLf & instring3 & vbCrLf & instring4 & vbCrLf & instring5
scriptlang.RunCommand instring1, instring2, instring3, instring4, instring
End Sub
When I run the sub Scriptlang.RunCommand (here's the code):
Public Sub RunCommand(Command2Run, Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4) 'Runs the command u ask for
If Command2Run = "RegDelete" Then RegDelete Syntaxx1, Syntaxx2
If Command2Run = "RegSetKey" Then RegSetKey Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4
If Command2Run = "FileDelete" Then FileDelete Syntaxx1, Syntaxx2
If Command2Run = "SendMSG" Then SendMSG Syntaxx1
End Sub
It does not evaluate the string Command2Run to be the same as the one on the other side of the = sign.
When I try to use RegSetKey, the value of instring1 is "RegSetKey", and the value of Command2Run is also "RegSetKey". BUT when it compares the string Command2Run with "RegSetKey" it doesn't think it's the same???!
Please help =)
/Thomas
I have a strange problem. Here's the code.
Private Sub cmdTest_Click()
Open "c:\thomas" For Input As #1 ' file opened for reading
'While Not EOF(1)
Line Input #1, instring1
Line Input #1, instring2
Line Input #1, instring3
Line Input #1, instring4
Line Input #1, instring5
'Wend
Close #1
'MsgBox instring1 & vbCrLf & instring2 & vbCrLf & instring3 & vbCrLf & instring4 & vbCrLf & instring5
scriptlang.RunCommand instring1, instring2, instring3, instring4, instring
End Sub
When I run the sub Scriptlang.RunCommand (here's the code):
Public Sub RunCommand(Command2Run, Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4) 'Runs the command u ask for
If Command2Run = "RegDelete" Then RegDelete Syntaxx1, Syntaxx2
If Command2Run = "RegSetKey" Then RegSetKey Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4
If Command2Run = "FileDelete" Then FileDelete Syntaxx1, Syntaxx2
If Command2Run = "SendMSG" Then SendMSG Syntaxx1
End Sub
It does not evaluate the string Command2Run to be the same as the one on the other side of the = sign.
When I try to use RegSetKey, the value of instring1 is "RegSetKey", and the value of Command2Run is also "RegSetKey". BUT when it compares the string Command2Run with "RegSetKey" it doesn't think it's the same???!
Please help =)
/Thomas
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.