wingrass: launching gui and shell [was: Re: [GRASS-dev] Wingrass and TclTk]

Moritz Lennert mlennert at club.worldonline.be
Mon Nov 5 09:41:10 EST 2007


On 05/11/07 14:44, Glynn Clements wrote:

> 
>> If yes, I'll just include a standard link into the 
>> distribution, inviting people to copy it to the desktop. This link can 
>> also be configured to minimize the cmd window which would solve that 
>> problem.

Actually it doesn't. If your .grassrc6 is configured to start grass in 
text mode, minimizing the window via the link does not allow you to see 
the terminal window...

So, again, the best solution seems to be two different .bat files for 
gui and text startup (also see below).

> 
> The GUI should probably be started via a .bat file which uses the
> "start" command with the option to hide the console window. The
> console window won't appear unless something is written to
> stdout/stderr (and they aren't redirected).

It actually appears as soon as you launch any .bat file.

> 
>>> The "start" command has a flag to hide the console window.
>> That is what Benjamin and I suggested to use. However, Paul is right 
>> that we currenly need a cmd session to remain open in order to do the 
>> clean up work at the end. And whichever way I turn the issue, I haven't 
>> been able to find a satisfying solution, yet. For more details, see 
>> towards the end of 
>> http://grass.itc.it/pipermail/grass5/2007-November/033889.html - from 
>> "Yes. I had forgotten about all that")
> 
> Is it not possible to "start" a batch file which runs gis.m in the
> foreground then deletes the files when it terminates? Or does that
> still open a console window?
> 

Yes, that is actually the "definition" of start (from 
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true):

"Starts a separate Command Prompt window to run a specified program or 
command."

There is a flag /min to minimize this new window. There is also a flag 
/b ("Starts an application without opening a new Command Prompt 
window"). This opens the application in the current window...

But the problem is not launching gis.m without a terminal. That's quite 
easy. The problem is that launching grass63.bat automatically opens a 
terminal and that it is difficult to get rid of that, unless we follow 
your suggestion and have different .bat files for launching grass with 
or without gui.

As I wrote in the mail mentioned above:

> One option would be to use the start command in grass63.bat, such as:
> 
> start /min cmd /c "%WINGISBASE%\etc\init.bat" %*
> 
> It spawns a new minimized cmd.exe which then runs init.bat. This works
> great for GUI startup, but when you launch grass63.bat -text, you have the
> incovenience of a) another cmd window open for grass and b) you have to
> maximize the window to be able to enter grass. And since the 'text' option
> can come from the .grassrc6 file, we cannot count on a '-text' parameter
> being available in grass63.bat.

So, if we use two different grass63.bat files (or we parse the command 
line and .grassrc6 in grass63.bat), this option seems the easiest. It 
actually opens a cmd.exe window but this is minimized and so you only 
see it in the task bar (would be great to be able to get rid of that as 
well, but that should be acceptable - don't know if it is possible to 
hide a program from the task bar).

One option would be to create a gui launching script in another language 
(i.e. C, tcl, etc) so that it doesn't automatically provoke the launch 
of a cmd window.



Moritz




More information about the grass-dev mailing list