Link to home
Start Free TrialLog in
Avatar of SirRoss
SirRoss

asked on

Visual Basic Command Protocol

Hello, I am currently writing an improved, aesthetically and practically, clone of MS-DOS. You might have seen another post about the same subject by Kgenis, as we are both working on it together, only difference is I only started learning VB last night... well here goes.

We currently have a few commands scripted that use two arguements, such as "Rm Driveletter\Path.to.file" then VB checks executes the DelTree command followed by the specified file. But now we need to make another set of commands that use just one arguement, such as a 'HELP' command that prints all the commands and there uses or a 'logoff' command, that logs the current user off the computer.

In summary:
The user types a command, e.g. 'help' into the texbox.
VB then takes this command and executes what we want it to do, in this case, using AddLine to print all of the commands and there uses to the screen.

Matt is not currently around so I can't contact him on the issue, and I would like it done by tomorrw, so any help is greatly appreciated. I appologise for the small amount of available points to hand out.

Regards, Ross
Avatar of DarkoLord
DarkoLord
Flag of Slovenia image

Hope this helps:


Option Compare Text 'add this line to the top

Sub Command1_Click()
   Dim strTmp As String, arrStr() As String
   strTmp = Text1.Text
   arrStr = Split(strTmp, " ")
   Select Case arrStr(0)
      Case "help"
         PrintHelpToScreen
      Case "logoff"
         CallCodeToLogoffUser
      Case "rm"
         RemoveFolder arrStr(1)
   End Selecr
End Sub
Avatar of SirRoss
SirRoss

ASKER

Hmm... here is an image of how we have created this, it might help on the replies.

www.empirical-island.co.uk/images/os_prompt.gif

Here is a link to some of the current source:

http://rafb.net/paste/results/qTMrJ880.html

All help is much appreciated, thank you.
Well it should work if you comment (add ' before it) this line:

If Len(tmpArgument) = 0 Then GoTo Err

Darko
Avatar of SirRoss

ASKER

No that doesn't work...

It also needs that in for it too work, there needs to be a second function or something that checks to see if help or other single arguement commands are typed and deals with them appropriately.
Okay, try this then:


Sub Command1_Click()
   Dim strTmp As String, arrStr() As String
   strTmp = Text1.Text
   arrStr = Split(strTmp, " ")
   Select Case Ubound(arrStr)
      Case 0
         'nothing
      Case 1
         '1 argument
      Case Else
        'more arguments
   End Select
End Sub
Avatar of SirRoss

ASKER

Hmm.... I'm afraid that won't work either, we are still looking for answers, but our anti-crack devices and such activated when i installed some new hardware that changed my internal info, so I corrupted the data. We have backups but we have to remake the forms.
Well ALL three solutions work (if you know where to put them), so please be more specific...

Darko
Avatar of SirRoss

ASKER

From the source code displayed at this link:

http://rafb.net/paste/results/qTMrJ880.html

Can you please inform me of where to put them, either by posting it here, or using:

http://rafb.net/paste/

To upload it.

Many thanks in advance.
 - Ross
ASKER CERTIFIED SOLUTION
Avatar of DarkoLord
DarkoLord
Flag of Slovenia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SirRoss

ASKER

Thanks You. :) Its really helpfull. I'm glad I finally got it done.
You're welcome

Darko