From: Rémi Cools on 20 Jul 2010 19:54 Hi, I'm just discovering Ruby, so, be indulgent! When I use this code : cmd = "d:\\mes documents\\___3D\\imageMagick\\montage.exe" system( [cmd, cmd], "-background", "#000000", "-geometry", "100%%", "1.jpg", "2.jpg", "3.jpg") A black-window like the jpg in attachment opens itself for half a second. Due to an iteration, this black-window opens itself dozen of times! It's not very professional. Is there a way to avoid that with Ruby ? Or must I absolutely look for that with the called-program ? (sort of silent mode) Thanks Regards. Attachments: http://www.ruby-forum.com/attachment/4873/BLACK.jpg -- Posted via http://www.ruby-forum.com/.
From: Roger Pack on 21 Jul 2010 14:28 Rémi Cools wrote: > Hi, > > I'm just discovering Ruby, so, be indulgent! > > When I use this code : > > cmd = "d:\\mes documents\\___3D\\imageMagick\\montage.exe" > system( [cmd, cmd], "-background", "#000000", "-geometry", "100%%", > "1.jpg", "2.jpg", "3.jpg") > > A black-window like the jpg in attachment opens itself for half a > second. > > Due to an iteration, this black-window opens itself dozen of times! > > It's not very professional. > > Is there a way to avoid that with Ruby ? If you run it from ruby within a command prompt it seems to work. Also appears if you use IO.popen it also works. -- Posted via http://www.ruby-forum.com/.
From: Clifford Heath on 22 Jul 2010 06:25 Roger Pack wrote: >> system( [cmd, cmd], "-background", "#000000", "-geometry", "100%%", >> "1.jpg", "2.jpg", "3.jpg") >> A black-window like the jpg in attachment opens itself for half a >> second. system uses cmd to run the command, and cmd launches a virtual-DOS environment. It's possible (but not from Ruby, I think) to launch cmd with no window - my team figured out how some years back - but I'd have to search to get the details. >> Is there a way to avoid that with Ruby ? The only way I can think of is to change the SHELL environment variable to designate a wrapper for cmd that sets the "no-window" option. Sorry it's not a solution, but I thought the pointer might help. Clifford Heath.
From: Rémi Cools on 22 Jul 2010 05:37 Hi Clifford Heath & Roger Pack, thanks for you answers. I don't understand wath you say, perhaps I didn't explain my problem correctly. I want to avoid that system() call cmd.exe in : system( [cmd, cmd], "-background", "#000000", "-geometry", "100%%" cmd is a String : cmd = "d:\\mes documents\\___3D\\imageMagick\\montage.exe" not the cmd.exe shell I thought that when you call system() with only one parameter, cmd.exe is used but when you call system() with more than one parameter, the program is directly launched without cmd.exe Can you confirm that ? thanks & regards. -- Posted via http://www.ruby-forum.com/.
From: Luis Lavena on 22 Jul 2010 07:14 On Jul 22, 6:37 am, Rémi Cools <r...(a)minimal-beton.com> wrote: > Hi Clifford Heath & Roger Pack, > > thanks for you answers. > > I don't understand wath you say, perhaps I didn't explain my problem > correctly. > > I want to avoid that system() call cmd.exe > > in : > system( [cmd, cmd], "-background", "#000000", "-geometry", "100%%" > cmd is a String : > cmd = "d:\\mes documents\\___3D\\imageMagick\\montage.exe" > not the cmd.exe shell > > I thought that when you call system() with only one parameter, cmd.exe > is used but when you call system() with more than one parameter, the > program is directly launched without cmd.exe > > Can you confirm that ? > That is default behavior of system. Two things: If you want to avoid the cmd.exe black screen from appearing, you can use backticks: result = `#{cmd}` system() with multiple parameters has some weird behaviors on Windows, it requires the absolute path to the executable as first argument. system() differs behavior between 1.8 and 1.9, the later works better. HTH, -- Luis Lavena
|
Next
|
Last
Pages: 1 2 Prev: Wsdl - Webservice Client Next: Simple Hack To Get $2500 To Your PayPal Account. |