Discussion:
[Newbies] ProcessWrapper on Windows - Can't get OSProcess/CommandShell to work
John-Reed Maffeo
2018-09-26 18:48:36 UTC
Permalink
I have an application running on Mac which I am trying to port to run on
Windows.

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
Ron Teitelbaum
2018-09-26 19:50:31 UTC
Permalink
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
Post by John-Reed Maffeo
I have an application running on Mac which I am trying to port to run on
Windows.
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
http://lists.squeakfoundation.org/mailman/listinfo/beginners
John-Reed Maffeo
2018-09-27 19:24:51 UTC
Permalink
Ron,
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.

jrm
Post by Ron Teitelbaum
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
Post by John-Reed Maffeo
I have an application running on Mac which I am trying to port to run on
Windows.
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
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Chris Cunningham
2018-09-27 20:52:05 UTC
Permalink
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
5.2 image.

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
for you.

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
window..."
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.

-cbc
Post by John-Reed Maffeo
Ron,
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.
jrm
Post by Ron Teitelbaum
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
Post by John-Reed Maffeo
I have an application running on Mac which I am trying to port to run on
Windows.
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
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
http://lists.squeakfoundation.org/mailman/listinfo/beginners
John-Reed Maffeo
2018-09-27 22:33:41 UTC
Permalink
cbc, your answer was helpful. I now have FFI loaded with the Win32
extensions. I tried the example you provided but it failed; there is no
shellExecute: method in what I downloaded, only the method
"shellExecute: lpOperation: lpFile: lpParameters: lpDirectory:
nShowCmd: ".

I will try some other experiments with the long shellExecute method and
see if I can get it to work for me.

thanks,

-jrm
Post by Chris Cunningham
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
5.2 image.
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
for you.
If it doesn't, then maybe my exmaple (the is just an extension of what Ron
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 window..."
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.
-cbc
Post by John-Reed Maffeo
Ron,
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.
jrm
Post by Ron Teitelbaum
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
Post by John-Reed Maffeo
I have an application running on Mac which I am trying to port to run
on Windows.
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
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Chris Cunningham
2018-09-27 22:38:11 UTC
Permalink
Sorry about that. That is an extension that I've added - I'll push it out
eventually.

In the meantime, you can either use
shellOpen:
or
shellExecute: nil lpOperation: 'open' lpFile: fn lpParameters: nil
lpDirectory: nil nShowCmd: 0.
Post by John-Reed Maffeo
cbc, your answer was helpful. I now have FFI loaded with the Win32
extensions. I tried the example you provided but it failed; there is no
shellExecute: method in what I downloaded, only the method
nShowCmd: ".
I will try some other experiments with the long shellExecute method and
see if I can get it to work for me.
thanks,
-jrm
Post by Chris Cunningham
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
5.2 image.
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
for you.
If it doesn't, then maybe my exmaple (the is just an extension of what
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 window..."
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.
-cbc
Post by John-Reed Maffeo
Ron,
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.
jrm
Post by Ron Teitelbaum
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
Post by John-Reed Maffeo
I have an application running on Mac which I am trying to port to run
on Windows.
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
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Loading...