Login  Register

Re: call .exe file smalltalk

Posted by Christopher J. Demers on Mar 23, 2004; 9:22pm
URL: https://forum.world.st/call-exe-file-smalltalk-tp3370117p3370127.html

"Theo Pronk" <[hidden email]> wrote in message
news:c3p2o7$29u2i8$[hidden email]...
> I would like to call "pkunzip.exe" with parameters, so it can unzip a
> file for my application.
>
> Does anyone have an example of calling an exe file with parameters from
> Smalltalk ?

I think Bob's package may be best for what you are actually doing.  However
for more generic use I use some variations on shellOpen:, see the methods I
added bellow.  I think it might be handy if something like the methods
bellow found their way into the base system.

The text between the bars can filed in and will add two methods to
ShellLibrary.
=======================
!ShellLibrary methodsFor!
shellOpen: fileString directory: dirString parameters: aParameter
"Opens the specified file, which can be an executable or document file.
Simplified wrapper around ShellExecute() to open a document."
| hInst |
hInst := self shellExecute: nil
lpOperation: 'open'
lpFile: fileString
lpParameters: aParameter
lpDirectory: dirString nShowCmd: SW_SHOWNORMAL.
^hInst asInteger <= 32
ifTrue: [self systemError]
ifFalse: [hInst]! !
!ShellLibrary categoriesFor: #shellOpen:directory:parameters:!public!win32
functions-shell library! !
!ShellLibrary methodsFor!
shellOpen: fileString parameters: aParameter
"Opens the specified file, which can be an executable or document file.
Simplified wrapper around ShellExecute() to open a document."
^self shellOpen: fileString directory: nil parameters: aParameter
! !
!ShellLibrary categoriesFor: #shellOpen:parameters:!must not
strip!public!win32 functions-shell library! !
=======================

Chris