Hi All,
I am trying to find out a way to call external executable and grab the input from the same when a button(which I would be creating) is clicked. As I am new to squeak programming it would be great help if anyone can guide me how to achieve this. Thanks in Advance, Arunabh |
On 10.01.2011, at 13:20, arunabh2k wrote:
> Hi All, > > I am trying to find out a way to call external executable and grab the input > from the same when a button(which I would be creating) is clicked. > As I am new to squeak programming it would be great help if anyone can guide > me how to achieve this. As a beginner you should ask this kind of question in the beginners forum: http://forum.world.st/Squeak-Beginners-f107673.html Here on squeak-dev the answer you would typically get is "use OSProcess" and you're kind-of expected to work out most of the rest yourself ;) - Bert - |
Thanks Bert, really appreciated it.
Arunabh |
In reply to this post by Bert Freudenberg
On Mon, Jan 10, 2011 at 01:43:16PM +0100, Bert Freudenberg wrote:
> On 10.01.2011, at 13:20, arunabh2k wrote: > > > Hi All, > > > > I am trying to find out a way to call external executable and grab the input > > from the same when a button(which I would be creating) is clicked. > > As I am new to squeak programming it would be great help if anyone can guide > > me how to achieve this. > > As a beginner you should ask this kind of question in the beginners forum: > > http://forum.world.st/Squeak-Beginners-f107673.html > > Here on squeak-dev the answer you would typically get is "use OSProcess" and you're kind-of expected to work out most of the rest yourself ;) > Well here are a couple more clues ;) If you are using Unix, Linux or Mac OS X, then you can use OSProcess and CommandShell for this. Use a Monticello browser to load these packages from SqueakSource: http://www.squeaksource.com/OSProcess http://www.squeaksource.com/CommandShell Look for classes ProxyPipeline and PipeableOSProcess. Either of these will do what you want. Based on your description of what you want to do, I think that ProxyPipeline may be the better choice, because it works at a higher level and cleans up after itself after you run the command. The basic idea is to evaluate something like this: (ProxyPipeline command: 'ls | cat | wc') upToEndOfFile So if you hook this up to your button, you should have what you want. Additional information is here: http://wiki.squeak.org/squeak/708 http://wiki.squeak.org/squeak/1914 If you are using Windows, this will not quite work, so look for package ProcessWrapper on SqueakSource. Dave |
Thanks Dave, I tried looking out for OSProcess and CommandShell.
I would like to tell the precise requirement which I am trying to do, I am developing this for windows and using scratch. I have to call an external executable once the scratch programming is over. As scratch is developed using squeak I thought to ask the question over here too. I tried installing commandShell in scratch source opened in squeak.exe but didn't got any option to do so. Is this the right approach I am following ? Thanks, Arunabh |
On Tue, Jan 11, 2011 at 04:48:06AM -0800, arunabh2k wrote:
> > Thanks Dave, I tried looking out for OSProcess and CommandShell. > I would like to tell the precise requirement which I am trying to do, I am > developing this for windows and using scratch. > I have to call an external executable once the scratch programming is over. > As scratch is developed using squeak I thought to ask the question over here > too. > I tried installing commandShell in scratch source opened in squeak.exe but > didn't got any option to do so. > > Is this the right approach I am following ? Hi Arunabh, I am not too familiar with Scratch, but I think that it is distributed with a different version of the Squeak VM that probably does not have the OSProcessPlugin that would be required. Also, you will need to use ProcessWrapper on Windows. So no, I do not think this approach will work for Scratch on Windows. Sorry, Dave |
Hi,
Scratch does come with an older vm but it works with a more recent one. I have it working with 'Squeak3.10.2 of ''5 June 2008'' [latest update: #7179]'.
I'm attaching a change set I just did which installs ProcessWrapper in a scratch image. Please note that I only tested it with the example I found on the squeaksource project description, and even though it works I don't know if something else might be broken... at least it installs correctly :)
Oh, ProcessWrapper>>#downloadPlugin doesn't work. You will need to download the plugin manually from: "http://people.inf.elte.hu/uzonyile/ProcessWrapper/2/ProcessWrapperPlugin.dll" and place it on your vm directory.
I hope it helps. Richo
On Tue, Jan 11, 2011 at 10:04 AM, David T. Lewis <[hidden email]> wrote:
ProcessWrapper.1.cs (25K) Download Attachment |
In reply to this post by David T. Lewis
Hi,
if all you're after is launching nother application from within a Scratch image, you might just take the BYOB image's SystemPlugin class and DLL. This is a very simply OS app launcher that you can easily port into the Scratch image by filing out the SystemPlugin class from BYOB and filing it into Scratch. Be sure to also copy the DLL to your Scratch folder. I created the SystemPlugin to enable BYOB to call the external EXE/APP-Packer pseudo-compiler from within the image. Assuming that's similar to what you're interested in this might probably be the easiest and most straightforward way to go. --Jens |
In reply to this post by Ricardo Moran
On Tue, 11 Jan 2011, Ricardo Moran wrote:
> Hi, > > Scratch does come with an older vm but it works with a more recent one. I > have it working with 'Squeak3.10.2 of ''5 June 2008'' [latest update: > #7179]'. > > I'm attaching a change set I just did which installs ProcessWrapper in a > scratch image. Please note that I only tested it with the example I found on > the squeaksource project description, and even though it works I don't know > if something else might be broken... at least it installs correctly :) There are tests in the ProcessWrapper-Tests package. All of them should pass (except for ProcessWrapperUnixUtilsTests if you don't have cat.exe and touch.exe, see the class comment for details). > > Oh, ProcessWrapper>>#downloadPlugin doesn't work. You will need to download > the plugin manually from: " What's the problem with #downloadPlugin? Levente > http://people.inf.elte.hu/uzonyile/ProcessWrapper/2/ProcessWrapperPlugin.dll" > and place it on your vm directory. > > I hope it helps. > Richo > > On Tue, Jan 11, 2011 at 10:04 AM, David T. Lewis <[hidden email]>wrote: > >> On Tue, Jan 11, 2011 at 04:48:06AM -0800, arunabh2k wrote: >>> >>> Thanks Dave, I tried looking out for OSProcess and CommandShell. >>> I would like to tell the precise requirement which I am trying to do, I >> am >>> developing this for windows and using scratch. >>> I have to call an external executable once the scratch programming is >> over. >>> As scratch is developed using squeak I thought to ask the question over >> here >>> too. >>> I tried installing commandShell in scratch source opened in squeak.exe >> but >>> didn't got any option to do so. >>> >>> Is this the right approach I am following ? >> >> Hi Arunabh, >> >> I am not too familiar with Scratch, but I think that it is distributed >> with a different version of the Squeak VM that probably does not have >> the OSProcessPlugin that would be required. Also, you will need to >> use ProcessWrapper on Windows. >> >> So no, I do not think this approach will work for Scratch on Windows. >> >> Sorry, >> Dave >> >> >> > |
The problem is not the ProcessWrapper package but the Scratch image. Keep in mind Scratch is built on an old Squeak 2.8 image. Since Scratch doesn't have SUnit, I didn't even bother installing the Tests package. I just hacked my way until the source.st got installed, then I tried the project description example (which, I think, is exactly what Arunabh needs) and since it worked, I simply made a change set with all the changes. Cheers Richo On Tue, Jan 11, 2011 at 7:49 PM, Levente Uzonyi <[hidden email]> wrote:
|
In reply to this post by Jens Mönig
Hey Jens,
Thanks a lot of direction. I searched for BYOB system plugin and everything in google is talking about its usage in MAC. I must be wrong somewhere in search. Please pardon my beginner questions as I am really really new in this language. Arunabh |
In reply to this post by Ricardo Moran
Hi Richo,
Thanks for the direction I was able to call external executable through processwrapper in windows. I hope this would be able to work on linux/Mac as well but currently I am more focused on windows. As I was new in this, I would like to sum-up the steps which I did to make it work: 1. Copy the processWrapperplugin.dll to the directory where my squeak.exe exist. 2. go to menu and check the files list browse to the processWrapper.1.cs provided by Richo and apply the change. 3. Use following code: ProcessWrapper new useStdout; startWithShellCommand: 'path_to_executable\executable.exe'; upToEnd; waitForExitFor: 5000; exitCode. And this did the part of calling the executable which I was having. Also I was using squeak vm version 3.11.5. I now have to make changes as per my requirement. Special Thanks to Richo, Dave, Bert, Jens, Levente as this was POC for me and now I can go forward about learning scratch/squeak programming. Jens I would still look forward for your solution. Thanks, Arunabh |
On Wed, Jan 12, 2011 at 1:07 PM, arunabh2k wrote:
> Jens I would still look forward for your solution. The website for Jen Mönig's BYOB project offers Windows downloads: http://byob.berkeley.edu/ Hope that helps. |
In reply to this post by arunabh2k
Oh, I'm sorry, I guess I should have explained better. BYOB is an offshot of Scratch and is also implemented in Squeak. You can download the current version (3.0.8) at http://byob.berkeley.edu (it comes with the complete changes and sources files, and with a .bat that opens it in development mode).
Here's how to get the plugin into Scratch: 1) download and install BYOB 2) open BYOB in development mode (use the .bat) 3) shift-click on EDIT and select "turn fill screen off" 4) click on the background to get the Squeak World menu 5) open a browser, file out class SystemPlugin 6) quit BYOB, open a Scratch dev image and file in class SystemPlugin 7) Save the Scratch dev image and quit it 8) copy SystemPlugin.dll from the BYOB folder to your Scratch dev folder 9) Again launch your Scratch dev image and refer to the examples in the class method #primLaunch: Good luck! --Jens |
In reply to this post by arunabh2k
On Wed, 12 Jan 2011, arunabh2k wrote:
> > Hi Richo, > > Thanks for the direction I was able to call external executable through > processwrapper in windows. > I hope this would be able to work on linux/Mac as well but currently I am > more focused on windows. It works on windows only. I wrote this package, because with OSProcess you can't access the started process' standard streams on windows (it works on other platforms). ProcessWrapper could be ported to other platforms, but fixing OSProcess on windows would be better IMHO. If you just want to start a new process and don't want to communicate with it via the standard streams, then you can also use OSProcess, FFI or SystemPlugin from BYOB on windows. Levente > > As I was new in this, I would like to sum-up the steps which I did to make > it work: > 1. Copy the processWrapperplugin.dll to the directory where my squeak.exe > exist. > 2. go to menu and check the files list browse to the processWrapper.1.cs > provided by Richo and apply the change. > 3. Use following code: > ProcessWrapper new useStdout; > startWithShellCommand: 'path_to_executable\executable.exe'; > upToEnd; > waitForExitFor: 5000; > exitCode. > > And this did the part of calling the executable which I was having. Also I > was using squeak vm version 3.11.5. > I now have to make changes as per my requirement. > > Special Thanks to Richo, Dave, Bert, Jens, Levente as this was POC for me > and now I can go forward about learning scratch/squeak programming. > > Jens I would still look forward for your solution. > > Thanks, > Arunabh > > -- > View this message in context: http://forum.world.st/calling-a-external-executable-tp3207051p3213893.html > Sent from the Squeak - Dev mailing list archive at Nabble.com. > > |
On Wed, Jan 12, 2011 at 8:58 AM, Levente Uzonyi <[hidden email]> wrote:
> If you just want to start a new process and don't want to communicate with > it via the standard streams, then you can also use OSProcess, FFI or > SystemPlugin from BYOB on windows. > If you don't need input or output from squeak, just Win32Shell shellOpen: '<fullfilename>' will run it (or open the text file, or any other file that Windows knows how to open). Obviously Windows only, though. |
On Wed, 12 Jan 2011, Chris Cunningham wrote:
> On Wed, Jan 12, 2011 at 8:58 AM, Levente Uzonyi <[hidden email]> wrote: >> If you just want to start a new process and don't want to communicate with >> it via the standard streams, then you can also use OSProcess, FFI or >> SystemPlugin from BYOB on windows. >> > > If you don't need input or output from squeak, just > Win32Shell shellOpen: '<fullfilename>' > will run it (or open the text file, or any other file that Windows > knows how to open). Obviously Windows only, though. > > That's the FFI version. :) Levente |
Free forum by Nabble | Edit this page |