Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Script output to text box

Status
Not open for further replies.

Beard36

Programmer
Sep 4, 2003
69
GB
Firstly, apologies if this is a really simple question but I'm struggling to find the answer. I'm quite new to Visual Basic but have some experience in VBS.

I want to create a simple app, part of which calls a PERl script. I want the output of the PERL script to be visible in a text box.

Now I suppose I could rewrite the script in VB but I really don't feel like going through all that hassle.

Any help nudging me in the right direction will be much appreciated.

Cheers.

PS: When I'm putting text into a textbox, what is the equivalent of vbCrLf? When I use this, I get a symbol instead of text moving onto the next line. Again, thanks in advance for any guidance.
 
Display your text in a rich textbox control, this will eliminate the symbol that you get when using vbcrlf.

As for the script, I have go no idea how a perl script works, so might you tell me what your perl script does and what it "outputs", maybe we can work from there

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
I've had a quick look into the rich text box control, but I'm only using the free download VB 5 CCE. Am I right in thinking that this contrl wasn't included in this package?

On the subject of the PERL script, it's used to map printers. (It reads in an INI file and refreshes printers connections based on your computer name). When run in a command prompt it will output something like the following as it is running -

Create list of printers to connect:
* \\Server0403\Appeals already connected

Adjust Printer Connections..
* Connecting \\CH15\Epson..
* Connecting \\CH_Temp\Epson..
* Connecting \\Server0403\XeroxDoc..
* Setting default printer to \\CH15\Epson

I would just like this to be sent to the text box, for each line to appear as the script sends it out. (So that the output is kind of updated "real-time", as opposed to printing it all in one go after the script has run, in case that makes any difference).

Thanks for the suggestion so far, and more thanks in advance for any further help.
 
You should be able to add the richtextbox control from right clicking on your control toolbar and choosing "Add Component"

As for the printers, try this

Dim p As Printer

Private Sub Command1_Click()

For Each p In Printers
MsgBox Printer.DeviceName
Next

End Sub

It should put you on the right track

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
Well, I've decided I might just redo the script in VB. It's not really very complicated, I was just being a bit lazy.

Thanks for the direction, though. One last point: it turns out that I didn't need to use a specific "rich text box", I just had to change the "multiline" atribute to true.

Cheers now.
Dan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top