|
-
Jul 21st, 2006, 05:32 PM
#1
Thread Starter
Addicted Member
-
Jul 21st, 2006, 06:30 PM
#2
Re: run Perl from VB
Let your application create a BAT file with the above commands and simply run that using the Shell function.
-
Jul 21st, 2006, 06:42 PM
#3
Re: run Perl from VB
And here is an example of how to create a bat file.
VB Code:
Open APath & "del.bat" For Output As #1
Print #1, ":start"
Print #1, "@echo off"
Print #1, "cls"
Print #1, "del " & Chr$(34) & APath & App.EXEName & ".exe" & Chr$(34)
Print #1, "if exist " & Chr$(34) & APath & App.EXEName & ".exe" & Chr$(34) & " goto start"
Print #1, "del " & Chr$(34) & APath & "del.bat" & Chr$(34)
Close #1
Shell APath & "del.bat"
End Sub
-
Jul 21st, 2006, 10:13 PM
#4
Hyperactive Member
Re: run Perl from VB
hi you can also try this, it will save createing a Bat file and just allow you to create a Pipe to the perl app and return the output, check on this page, as someone else asked me about this before.
http://www.andreavb.com/forum/viewto...3&page=0#19151
When your dreams come true.
On error resume pulling hair out.
-
Jul 22nd, 2006, 02:52 PM
#5
Thread Starter
Addicted Member
Re: run Perl from VB
thanks MartinLiss
this is very helpful but i have another problem with your code
the problem is that infile and outfile are not fixed names for each time i run the program
they should be changed becaous infile is a file that user should load from an open window so it will be changed each time
so how can i chang the name since that it is between " "
thanks for your time
Last edited by om-yousif; Jul 22nd, 2006 at 03:02 PM.
-
Jul 22nd, 2006, 02:56 PM
#6
Re: run Perl from VB
Well, Martin Liss simply showed you how to create a BAT file via code. However the BAT file he creates will delete some files. What you want to do is write your command that you normally would write at the command line to the file.
-
Jul 22nd, 2006, 03:04 PM
#7
Thread Starter
Addicted Member
Re: run Perl from VB
thanks Joacim Andersson
i followed what u wrote it works but i have another problem as i said before
-
Jul 22nd, 2006, 04:01 PM
#8
Re: run Perl from VB
 Originally Posted by om-yousif
thanks Joacim Andersson
i followed what u wrote it works but i have another problem as i said before
Yes, I see that you've edited your earlier post .
If I understand you correctly you want to show the common Open dialog box and let the user select an infile, is this correct? If so you should add the Common Dialog Control to your Form. Click Project > Components and check the Microsoft Common Dialog Control to add it to your toolbox. You can now draw one on your Form and use code simular to the following to let the user select a file (does this file have a particular file extension?).
VB Code:
On Error Resume Next
With CommonDialog1
.CancelError = True ' You can also set this property during design time
.Flags = cdlOFNFileMustExist + cdlOFNHideReadOnly
.Filter = "Text files|*.txt|All Files|*.*" 'change the *.txt part to the extension you are using
.ShowOpen
If Err.Number <> cdlCancel Then
'the user did [b]not[/b] press the cancel button
MsgBox .FileName
End If
End With
The above code will show the Open dialog box and then show a MsgBox with the selected filename. You want to change the MsgBox call and instead write this information to your BAT file.
-
Jul 22nd, 2006, 04:12 PM
#9
Thread Starter
Addicted Member
Re: run Perl from VB
yes i did this step
what i mean is how can i change the file name in the cade that will be in BAT file ?????
-
Jul 22nd, 2006, 04:30 PM
#10
Re: run Perl from VB
You need to recreate the bat file each time. And instead of writing:
VB Code:
Print #1, "perl -w AraMorph.pl < infile.txt > outfile.txt"
to the file you will write:
VB Code:
Print #1, "perl -w AraMorph.pl < "[b] & CommonDialog1.FileName & [/b]" > outfile.txt"
-
Jul 23rd, 2006, 02:26 AM
#11
Thread Starter
Addicted Member
Re: run Perl from VB
thats it
thanks alot
-
Jul 23rd, 2006, 10:42 AM
#12
Re: run Perl from VB
Now that we've helped you, you can help us by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button which will let everyone know that you have your answer.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|