I''m making a system call in Windows to a program from within my Rails app., and when it executes, a command window opens up by default for the duration of the program run. I''m pretty sure that there''s a way to hide this window when I run the command. Does anyone know how to do this? Alternatively, I tried to set up a shortcut pointing to the executable that runs with the window minimized but wasn''t able to invoke it successfully using system(shortcut_name). Any help is appreciated. Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Matt Stone
2006-Nov-10 12:05 UTC
Re: Hiding the command window when using system() on Windows
Hi Wes, I had a similar problem using another language. I don''t think that there are command line or ruby system() options that let you control this. My solution was to write a very stupid .Net executable; that just ran the programme that I needed in a controlled window [:ie background & minimised]. From .Net its really easy to access the windowing bits of windows. Not a very elegant hack, but it worked. rgds - matt. Wes Gamble wrote:> I''m making a system call in Windows to a program from within my Rails > app., and when it executes, a command window opens up by default for the > duration of the program run. > > I''m pretty sure that there''s a way to hide this window when I run the > command. > > Does anyone know how to do this? > > Alternatively, I tried to set up a shortcut pointing to the executable > that runs with the window minimized but wasn''t able to invoke it > successfully using system(shortcut_name). > > Any help is appreciated. > > Wes-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Wes Gamble
2006-Nov-10 17:19 UTC
Re: Hiding the command window when using system() on Windows
Matt Stone wrote:> My solution was to write a very stupid .Net executable; that just ran > the programme that I needed in a controlled window [:ie background & > minimised]. From .Net its really easy to access the windowing bits of > windows. > > Not a very elegant hack, but it worked.Would you be willing to share this code? I assume it''s in C# and that would require a C# compiler (which I don''t have). Thanks, Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Wes Gamble
2006-Nov-10 17:30 UTC
Re: Hiding the command window when using system() on Windows
> Would you be willing to share this code? I assume it''s in C# and that > would require a C# compiler (which I don''t have). > > Thanks, > WesI can get my hands on a C++/C# compiler if need be. WG -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David Mullet
2006-Nov-10 19:40 UTC
Re: Hiding the command window when using system() on Windows
Wes Gamble wrote:> I''m making a system call in Windows to a program from within my Rails > app., and when it executes, a command window opens up by default for the > duration of the program run. > > I''m pretty sure that there''s a way to hide this window when I run the > command. > > Does anyone know how to do this? > > Alternatively, I tried to set up a shortcut pointing to the executable > that runs with the window minimized but wasn''t able to invoke it > successfully using system(shortcut_name). > > Any help is appreciated. > > WesWes- Using the win32ole library, you could call the Run method of the Wscript.Shell object... require ''win32ole'' cmd = "application.exe" windowstate = 0 # hidden wait = 1 # wait for process to complete WIN32OLE.new(''Wscript.Shell'').Run(cmd, windowstate , wait) Mully -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Wes Gamble
2006-Nov-11 19:55 UTC
Re: Hiding the command window when using system() on Windows
David Mullet wrote:> Using the win32ole library, you could call the Run method of the > Wscript.Shell object... > > > require ''win32ole'' > cmd = "application.exe" > windowstate = 0 # hidden > wait = 1 # wait for process to complete > WIN32OLE.new(''Wscript.Shell'').Run(cmd, windowstate , wait)David, This: WIN32OLE.new(''WScript.Shell'').Run(command_str, 0, 1) did the trick!!! Thanks so much for the help. Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---