Topic: command window

Is there any way to suppress display of the DOS command line window when a fortran program runs?  I am using Windows 7.  Thanks....

Re: command window

I gather from a previous discussion that this is a Windows issue and the command window will only stay away if and when Jeff manages to give us a compilation option to create Windows executables rather than cmd line executables.  I have no idea how feasible this will be. 

I am making very good progress with a windows version of my executable, using Dislin for the GUI,   Windows open, menus appear, buttons work etc, but the black cmd line dos box is still there in the background.  Actually, I don't mind it, and I write a few runtime stats to it.
---
John

Re: command window

There is currently no way to suppress the command window.  If there is interest, I could look into a different compilation target that would not open a command window at all.

If it will suffice for the time being, you can set an option for the command window to automatically close when the program completes.  From the Options menu, select "Launch..." to open the Launch Options dialog.  You can uncheck the "Leave Console Open" option, which will force the command window to close immediately upon program exit.

Jeff Armstrong
Approximatrix, LLC

Re: command window

Jeff & John - thanks for your comments.  I would appreciate you looking into the possibility of a different compilation target, especially if others were interested as well.  I have been using SF for two days now, and it looks as if it will meet my needs.  My app is currently in a very high level language, and I believe rewriting the engine in fortran will dramatically reduce run time. So my intent is to go ahead and register SF and get started on conversion of the non-UI portion of my app.  I will have to see about converting the UI part to Dislin or some other library at a later date.  For now, the UI I have should work, as it can readily launch an exe.  I think the engine and the UI can communicate via temp text files, but I will have to test that early on.  I did that years ago with Lahey, and it worked well as I recall.  In any case, avoidance of the DOS window will result in a smoother experience for the users.  I would say, however, there certainly is not any kind of rush....

Thanks very much for such a great product, and for keeping it so economical!

Dan

Re: command window

Dan,

I'm glad to hear you plan on registering.  Out of curiosity, which high level language are you planning on interfacing with?  I have some personal experience working with Fortran<->Python and Fortran<->MATLAB interfaces, along with mixed C/Fortran projects.

I've also been experimenting with a GUI library that may in the future ship with Simply Fortran.  At the moment, though, many users have had success with DISLIN.

Jeff Armstrong
Approximatrix, LLC

Re: command window

Jeff -
   Most of my high level language use has been Javascript for web related work, and VBA for application based work.  However, what I have found that works really quite well for windows itself is AutoIT.  It has a rich set of tools and UI controls, and even though it is technically a scripting tool it feels very much like a programming language.  The syntax is Basic-like and not a lot different than F90. What I have in mind is to have an AutoIT script provide user interface capability and then write a small file containing user preferences and other data.  Then the script will launch the fortran program which reads the small file and any other referenced data.  The fortran program, I would think, will do any significant amount of number crunching far faster than a script will.  Time will tell if that is the case.  Another process I would like to try is to keep the AutoIT script active while the Fortran program runs.  The Fortran program could write out its status to another file which could be periodically read by the script, and this info could then be related to the user through the UI.  AutoIT has a easy to use progress bar routine which is very helpful for a user who want to track the status of their run, as well as text boxes that can be used to give even more detail.

   It will take me a couple of weeks to find the time to get this working.  I'll give you a report on how it comes out.

Dan

Re: command window

Dan,

I use AutoIt pretty regularly, and it's a great product!  I mostly stick to it's impressive automation abilities.  In fact, AutoIt plays a prominent role in Simply Fortran's pre-release testing.

Jeff Armstrong
Approximatrix, LLC

Re: command window

jeff wrote:

I've also been experimenting with a GUI library that may in the future ship with Simply Fortran.  At the moment, though, many users have had success with DISLIN.

You just seriously caught my interest with that talk about including a GUI library. That would definitely make Simply Fortran the best IDE I've ever used (just for the record it already is).
Keep up the good work, Simply Fortran has improved incredibly since the first time I downloaded it.

Re: command window

Jeff -
  A quick update on integration with AutoIT.  I am about half way through converting my AutoIT code (at least the number crunching part) to Fortran.  Thus far, using AutoIt for the UI, and Fortran for the engine is working out as hoped.  One positive thing I have found that, in AutoIT, the "RUN" command has a flag that can be set to hide the window for executable that is being RUN.  This easily resolves my original concern about the DOS Command line window that started this thread.
  Other than that tidbit, tentatively at least, Fortran runs very much faster that AutoIT when dealing with large arrays and a lot of logical operations, so I am very happy with the way this has come together so far.  More later.....
Dan

Dan

Re: command window

Dan,

I'm glad to hear things are going well!  I would think Fortran would have a significant speed advantage over AutoIt, which I would guess is strictly interpreted.  Although the AutoIt option seems to have fixed your hiding of the command window, the next version will support the option explicitly.  I think the ability to suppress the command window will be particularly useful to those who are working with the DISLIN GUI toolkit.

Jeff Armstrong
Approximatrix, LLC

Re: command window

Jeff -
I ran into a bit of a problem and hope you can suggest a solution.  My fortran program is working well when I run it from the Simply Fortran Interface, Windows Explorer, or a DOS command window.  When I launch it from my AutoIT script, it apparently starts but ends very quickly with an error of some kind.  The problem is that the command window disappears so quickly that I cannot read it and determine the nature of the error.  Is there a way to compile the fortran program so that when runs outside of SimplyFortran it either  1.) holds the command window open until a key is pressed, or 2.) pipes its output from the standard device to a file?   Or, if you have any other ideas....

Dan

Re: command window

Dan,

One thing you could try is wrapping your Fortran executable in a batch file.  For example, if your executable is named "MYPROG.EXE," you'd create a simple batch file, call it "MYWRAP.BAT," that says:

MYPROG.EXE
PAUSE

The pause command will wait until the user presses a key.  Then change your AutoIt script to execute the batch file rather than the program.

Jeff Armstrong
Approximatrix, LLC

Re: command window

Jeff -

   I have been following exactly that line of thinking.  In autoIT, instead of launching my program, I launched a DOS command window ('@comspec' in AutoIT).  This allowed me to first check to see if my working directory was correct.  It wasn't, and the error I had been getting was related to that.  After fixing that in my AutoIT script, I repeated loading the command window to confirm I had the correct working dir.  Then, I entered 'myprog.exe' and it ran just fine. (I also found I could pipe output to a file by entering: ' myprog.exe > scrnOutput.txt'.)  After using the DOS window I closed it with an EXIT command and control returned to the AutoIT script.   So I think this problem is solved.

   I still am having issues getting AutoIT to recognize my fortran program even tho the working dir and relative pathname is set properly (I think).  In any case, I can resolve that issue by using the full pathname (C:\Users\Dan\myproject\myprog.exe).

   This exercise has been good, because I have learned that I can pipe the screen output to a file, which helps with debugging.  Piping will work only in the case of if you open a command window from AutoIT, but NOT if you run the program directly from AutoIT ( as in: 'C:\Users\Dan\myproject\myprog.exe > scrnOutput.txt').

   I have also tried putting various combinations of these approaches in a DOS batch file.  Any batch file I have put together runs fine from windows explorer or a command window I open myself.  The pipe works fine as well ('C:\Users\Dan\myproject\myprog.exe > scrnOutput.txt' ).  However, if I try to start the batch file from AutoIT,  but I consistently get an  error message that  "Windows cannot find 'c:\windows\system32\cmd.exe  C:\Users\Dan\myproject\runMyProg.bat' ".    While this is not a big issue, it would be nice to be able to resolve this error, because I think the idea of using a wrapper could be useful.   I'll let you know if I can find a solution.

   Thanks again for the help.....

Dan

Re: command window

Dan,

I've felt the pain of getting the current directory/working directory wrong.  In fact, early versions of Simply Fortran had a nasty path handling bug related to the same thing.  If the user ever opened a file outside their project directory, Simply Fortran just didn't work correctly anymore.  The issue took a while to hunt down, and it seemed silly once it was identified.  Of course, that was many versions ago, and it no longer suffers from such obvious maladies.

Jeff Armstrong
Approximatrix, LLC