getting Perl exit codes in vb

Dennis Murrell January 28, 2009 at 06:14:37
Specs: Windows XP
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

See More: getting Perl exit codes in vb

Report •


#1
February 12, 2009 at 01:14:39
hai,

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

any one is thr?


Regards
Sara


Report •

#2
February 16, 2009 at 06:29:18

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


Report •

#3
February 16, 2009 at 08:18:53
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...


Report •

Related Solutions


Ask Question