how do i catch stuff from a prompt ?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by TheDanishGuy.

Hi ..

im strugling with some problems as a Purebasic beginner, so here goes and please bare with me.

lets say i have a small DOS utillity thats named FIX.exe ... it might fix the user credentials for a user, - the syntax to use this program might be like :

"fix Peter /apply" ... where "fix" is the program name, and "Peter" is the name of the person the progran should fix and /apply is an additional "parameter"

1. Now comes the tricky part for me a new programmer, "Peter" is written into a box by the operator, then when he pushes a button, this button should execute a specific command on this user, in this case "fix Peter /apply" .. so i need to figure out how to paste Peter into the middle of a command string

(im thinking on having multible buttons, but every button executes commands on the current username in the box)

2. Next i need to catch the return answer of this command and display it in a seperate box

all of theese commands above would normally be done in a DOS promt, - but im trying to spice it up and build a kind of GUI

kind of a looong question, but any ideas ? thanks in advance !

The Danish Guy , a proud Registered Purebasic newcommer
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by TheBeck.

Is this what you want to do?

Code: Select all

If OpenConsole() = 0
MessageRequester("Error", "Can't open console", 0)
  End
EndIf
A$ = "FIX "
c$ = " /apply"
Print("Input: ")
b$ = Input()
d$ = a$ + b$ + c$
PrintN("")
PrintN(d$)
PrintN("Press any key to exit.")
Repeat
  e$ = Inkey()
  Delay(100)
Until e$  ""
CloseConsole()
End
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> 2. Next i need to catch the return answer of this command and
> display it in a seperate box

See the answers here:

http://www.curvesoftware.co.uk/purebasi ... hTerms=dos


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by TheDanishGuy.

Thanks all for the answers ... im very impressed with the speed of this forum.

Im sure im gonna spend alot of quality time here ! ..

and thanks to the makes of PureBasic, for such a neat program !
Post Reply