[Newbies] ProcessWrapper on Windows - Can't get OSProcess/CommandShell to work
cunningham.cb at gmail.com
Thu Sep 27 20:52:05 UTC 2018
The correct way to load FFI is to load it from SqueakMap, update, in the
mid left panel bring up the menu and unselect "New safely-available
packages", and then install head. Answer yes to installling something not
compatible with your current system (it is, just the map package hasn't
been changed to say it is compatible).
Once this is finished, FFI will be loaded.
At this point, you still need to load the Win32 extentions. Open the
Monticello Browser, click in the repository panel on the right, choosing "
http://source.squeak.org/FFI". Open this repostiory. In this repository,
choose the "FFI-Win32" package. Pick the latest package (currently
FFI-Win32-nice.12.mcz) and load it.
At this point Ron's example should work. This will definitely work in a
Now, Ron's example will either run the program will no results, or will
error out if it can't run, I believe. Try it out first and see if it works
If it doesn't, then maybe my exmaple (the is just an extension of what Ron
stated) will work:
scanScript := ByteString streamContents: [:bs|
bs nextPutAll: 'my.exe > output.txt'); cr; lf.
bs nextPutAll: 'del '; nextPutAll: (fn := 'Scan', serverName, '.bat').
file := FileStream newFileNamed: fn.
[file nextPutAll: scanScript] ensure: [file close].
Win32Shell new shellExecute: fn. "execute runs without opening the program
dir := FileDirectory default.
[dir fileExists: fn] whileTrue: [(Delay forSeconds: 1) wait].
file := FileStream oldFileNamed: 'output.txt'.
raw := file contentsOfEntireFile. "closes file"
dir deleteFileNamed: outFn.
"Do something with raw - the results of the program my.exe"
Of course, this should all just work with ProcessWrapper, but I switched
away from that a few years ago - I don't remember why. Maybe I wanted lots
of concurrent programs running at once.
On Thu, Sep 27, 2018 at 12:24 PM John-Reed Maffeo <jrmaffeo at gmail.com>
> Thanks for the suggestion, however it did not work for me on a 5.2 image
> or a 4.1 image that I downloaded so I could test in the version you
> are using.
> I verified that I have the shell.dll file, but I don't see FFI or
> Win32Shell in either image.
> I can't find any useful documentation about Win32Shell.
> Web searches indicate that I might want to try loading Alien so I will
> give that a try and see what happens.
> On Wed, Sep 26, 2018 at 12:50 PM Ron Teitelbaum <ron at usmedrec.com> wrote:
>> Hi JRM,
>> Not sure how it's done today but on my 4.1 system, we do the following.
>> result := Win32Shell new shellOpen: 'my.exe'.
>> It uses FFI and shell32.dll
>> All the best,
>> Ron Teitelbaum
>> On Wed, Sep 26, 2018 at 2:48 PM John-Reed Maffeo <jrmaffeo at gmail.com>
>>> I have an application running on Mac which I am trying to port to run on
>>> PipeableOSProcess fails on an know issue.
>>> Is Process Wrapper a viable option? It requires adding
>>> SmartSyntaxInterpreterPlugin, and ProcessWrapperPlugin.dll.
>>> All I want to do is run an .exe and capture the output.
>>> Any suggestions?
>>> - jrm
>>> Beginners mailing list
>>> Beginners at lists.squeakfoundation.org
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners