ProcessWrapper on Windows - Can't get OSProcess/CommandShell to work

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
jrm
Reply | Threaded
Open this post in threaded view
|

ProcessWrapper on Windows - Can't get OSProcess/CommandShell to work

jrm
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: ProcessWrapper on Windows - Can't get OSProcess/CommandShell to work

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


On Wed, Sep 26, 2018 at 2:48 PM John-Reed Maffeo <[hidden email]> wrote:
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
jrm
Reply | Threaded
Open this post in threaded view
|

Re: ProcessWrapper on Windows - Can't get OSProcess/CommandShell to work

jrm
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

On Wed, Sep 26, 2018 at 12:50 PM Ron Teitelbaum <[hidden email]> 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 <[hidden email]> wrote:
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
cbc
Reply | Threaded
Open this post in threaded view
|

Re: ProcessWrapper on Windows - Can't get OSProcess/CommandShell to work

cbc
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


On Thu, Sep 27, 2018 at 12:24 PM John-Reed Maffeo <[hidden email]> wrote:
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

On Wed, Sep 26, 2018 at 12:50 PM Ron Teitelbaum <[hidden email]> 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 <[hidden email]> wrote:
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
jrm
Reply | Threaded
Open this post in threaded view
|

Re: ProcessWrapper on Windows - Can't get OSProcess/CommandShell to work

jrm
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


On Thu, Sep 27, 2018 at 1:52 PM Chris Cunningham <[hidden email]> wrote:
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


On Thu, Sep 27, 2018 at 12:24 PM John-Reed Maffeo <[hidden email]> wrote:
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

On Wed, Sep 26, 2018 at 12:50 PM Ron Teitelbaum <[hidden email]> 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 <[hidden email]> wrote:
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
cbc
Reply | Threaded
Open this post in threaded view
|

Re: ProcessWrapper on Windows - Can't get OSProcess/CommandShell to work

cbc
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.

On Thu, Sep 27, 2018 at 3:33 PM John-Reed Maffeo <[hidden email]> wrote:
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


On Thu, Sep 27, 2018 at 1:52 PM Chris Cunningham <[hidden email]> wrote:
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


On Thu, Sep 27, 2018 at 12:24 PM John-Reed Maffeo <[hidden email]> wrote:
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

On Wed, Sep 26, 2018 at 12:50 PM Ron Teitelbaum <[hidden email]> 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 <[hidden email]> wrote:
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners