Computing.Net > Forums > Programming > getting Perl exit codes in vb

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

getting Perl exit codes in vb

Reply to Message Icon

Name: Dennis Murrell
Date: January 28, 2009 at 06:14:37 Pacific
OS: Windows XP
Subcategory: General
Comment:

I am running a perl script from vb. OK but I need to get access to the exit code from the perl script in the calling vb program. I can do it a long winded way via a batch file but I feel i'm missing something obvious.
Any help Mucho Gratious



Sponsored Link
Ads by Google

Response Number 1
Name: saravananr
Date: February 12, 2009 at 01:14:39 Pacific
Reply:

hai,

How to write perl code in vba editor.
pls explain with example.
provide material for this.

any one is thr?


Regards
Sara


0

Response Number 2
Name: DennyM
Date: February 16, 2009 at 06:29:18 Pacific
Reply:


sorry forgot my login so reregistered
THIS is Dennis Murrell

example:

IN VB code
>
return = shell "perl.exe somescript.txt"

>
end code
return seems NOT to be the exit value from Perl
ir appears to be a process ID

I make it work by the following in a .bat file
>
del ProgErr.txt
del ProgOK.txt

perl.exe somescript.txt

if errorlevel 1 goto ERR
if errorlevel 0 goto OK

ERR:
echo err > ProgErr.txt
goto END
OK:
echo ok > ProgOK.txt
END:

>
In VB
shell the.bat

then test for ProgErr.txt
and progOK.txt

any help Mucho Gratious


0

Response Number 3
Name: FishMonger
Date: February 16, 2009 at 08:18:53 Pacific
Reply:

Here's an example from MSDN.

Dim procID As Integer
Dim newProc As Diagnostics.Process
newProc = Diagnostics.Process.Start("C:\WINDOWS\NOTEPAD.exe")
procID = newProc.Id
newProc.WaitForExit()
Dim procEC As Integer = -1
If newProc.HasExited Then
    procEC = newProc.ExitCode
End If
MsgBox("Process with ID " & CStr(ProcID) & _
    " terminated with exit code " & CStr(procEC))

http://msdn.microsoft.com/en-us/lib...


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: getting Perl exit codes in vb

Exit code in C++ www.computing.net/answers/programming/exit-code-in-c/2248.html

How to OPen a File in VB.NET www.computing.net/answers/programming/how-to-open-a-file-in-vbnet/13055.html

Error in vb www.computing.net/answers/programming/error-in-vb/1236.html