Solved

Get string from textfile, then compare it to another string

Posted on 2001-08-10
1
152 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:thomas77
1 Comment
 
LVL 11

Accepted Solution

by:
Otana earned 100 total points
Comment Utility
Try this:

If Ucase(Trim(Command2Run)) = Ucase(Trim("RegSetKey")) Then RegSetKey Syntaxx1, Syntaxx2, Syntaxx3, Syntaxx4
   
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now