MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to suppress (hide) RunThrough window under Windows?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116902] Re: How to suppress (hide) RunThrough window under Windows?
  • From: Michael <michael2718 at gmail.com>
  • Date: Fri, 4 Mar 2011 03:37:44 -0500 (EST)

On 3/3/2011 4:00 AM, Peter Pein wrote:
> Am 02.03.2011 10:35, schrieb Michael:
>> Hi all,
>>
>> When I use Run[] or RunThrough[] on my machine (running Windows Vista),
>> it flashes a command prompt on my window during the execution of the
>> command.   I've googled around quite a bit and have found a few things
>> to try, none of which have worked.  (Programs, scripts, etc. which are
>> supposed to suppress the console display)  I'm running some tests which
>> involve calling RunThrough hundreds of times and it makes my machine
>> unusable to have hundreds of console windows momentarily popping up
>> while I try to do something else while waiting for my tests to finish.
>> So, how do I hide these pop-up windows?
>>
>>
>> Thanks,
>>
>> Michael
>>
>>
>
> If you wrap a ReadList around the call to cmd.exe the window will not
> pop up. E.g.:
>
> dummy = ReadList["!dir C:\\cygwin\\bin", String];

Thanks Peter.  This got me started.  Apparently Mathematica doesn't have 
any way to open a file from simultaneous reading and writing, which I 
find strange (although given Mathematica's perspective on streams, I 
guess it is understandable), but I was able to re-implement RunThrough 
using ReadList:

RunThroughQuietly[cmd_String, expr_] := Module[{ret, s, filename},
   s = OpenWrite[];
   filename = s[[1]];
   Write[s,expr];
   Close[s];
   ret = ReadList["!" <> cmd <> " < " <> filename];
   DeleteFile[filename];
   ret[[1]]
   ]

I'm not sure why RunThrough doesn't take an option to not show the 
window (maybe nobody thought of that), but the above implementation 
seems to work well enough for what I'm trying to do.

> hth,
> Peter

Best Regards,

Michael


  • Prev by Date: Re: Patterns with conditions
  • Next by Date: Re: Patterns with conditions
  • Previous by thread: Re: How to suppress (hide) RunThrough window under Windows?
  • Next by thread: How to disable automatic clearing $MessageList after generating of output?