Silverfrost Forums

Welcome to our forums

Suppressing popups with CISSUE

6 Sep 2012 2:34 #10706

I do not know if this is Windows 7 feature but it seems XP did not have this issue with CISSUE (can not confirm - forgot the password to older OS....LOL). When i compile this example program showing the issue

character*32 text
integer*2 IFail

text='dir'
do i=1,10
 call sleep1@(1.) 	
 call cissue@(TRIM(text),iFail)
enddo
end

this way

FTN95 FILENAME.f95 /link /windows

with the /windows key i get annoying popups. Any way to suppress them?

6 Sep 2012 8:44 #10707

Why not leave out the /windows on the command line?

Either way the behaviour under XP and Windows 7 is consistent for me.

6 Sep 2012 8:35 #10708

I use /win because old DOS black screen in Windows programs looks so archaic. The CISSUE in my code is doing RENAME, COPY and other operations with the files. Popping like that with the /windows has no sense at all plus it does not allow me to work with other things because of blinking 7000 times during 2 hours run. It completely messes out anything you do on your PC interfering with the mouse, ALT+TAB, windows pan etc and at the end of run annoys you literally to nerve ticks LOL

7 Sep 2012 5:40 #10710

I guess that you will need to use something other than CISSUE, maybe START_PROCESS@ or START_PPROCESS@ for example. You might need to use a batch file in order to get the processing to take place in the background. Another possibility is WinExe which is relatively easy to use.

If all else fails then the API to use is CreateProcess but that will be rather tricky to implement.

There again, there are direct ways to COPY etc.

7 Sep 2012 7:09 #10711

Thanks, Paul, for reminding for all possibilities, I have tried most of them before, even to my surprise tried CreateProcess for something similar with DEC compiler 15 years ago but completely forgot that. Some worked, some not depending on unexplainable specific circumstances, will revisit them under Win7. I like CISSUE which before also sometimes worked sometimes not, but now survives my torture under XP/Win7 pretty well.

By the way, may be i overcomplicate these things in addition to making code not portable -- I know how in Fortran i can delete file - it can be done like this

CLOSE (323,status='delete',err=34534)

But how in Fortran COPY and RENAME file can be done similar way in one single line?

7 Sep 2012 7:37 #10712

Dan, here are some ideas:

      program test

      implicit none
      INCLUDE <WINDOWS.INS>

      logical*2      l
      character*120  file_1,file_2,file_3,string

      file_1 = 'test_1.dat'
      open(10,file=file_1,err=100,status='unknown')
      write(10,'(A)',err=100)'this is a test'
100   close(10)

c     copy file_1 to file_2

      file_2 = 'test_2.dat'
      l = CopyFile(file_1,file_2,.false.)
      open(10,file=file_2,err=200,status='old')
      read(10,'(A)',err=200)string
      print*,string
200   close(10)

c     rename file_1 to file_3

      file_3 = 'test_3.dat'
      l = MoveFile(file_1,file_3)
      open(10,file=file_3,err=300,status='old')
      read(10,'(A)',err=300)string
      print*,string
300   close(10)

c     delete files

      l = DeleteFile(file_2)
      l = DeleteFile(file_3)
      end

Regards - Wilfried

7 Sep 2012 1:03 #10713

Dan,

If you get the FTN77 library documentation from this site, you will see routines for doing some of these jobs:

ERASE@ RENAME@ SET_SUFFIX@ and SET_SUFFIX1@

but no COPY

Eddie

7 Sep 2012 1:43 #10714

Eddie, What about the 'CopyFile' function in the MicroSoft documentation:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa363851(v=vs.85).aspx

I'm sure Paul will show you how to use it - makes you wonder why no 'COPY@' function exists in FTN95. Ian

7 Sep 2012 1:51 #10715

Hi Ian,

I never knew that load of routines ever existed - of course they have to, or zillions of folk have to keep reinventing the wheel.

My preference is to use a standard Fortran subprogram if one exists, and an FTNXX one if that exists. Delving into MSDN always looks like hard work to me.

Eddie

7 Sep 2012 8:39 #10717

Eddie, It already exists:

winapp
program copy_test
include <windows.ins>
logical*4 copy_result

copy_result = copyfile('fred.txt','joe.txt',.False.)

end

Have a look in win32api.ins in the include directory of FTN95 - there are lots of things already available. Ian

7 Sep 2012 9:21 #10718

Thanks Wilfried, Eddie and Ian, I did not know at all that CopyFile, DeleteFile, MoveFile exist! Were not mentioned before even ones in this site or other Fortran places i visit...Cool

8 Sep 2012 5:53 (Edited: 9 Sep 2012 6:59) #10719

Yes, I can put together a CopyFile example if anyone needs it. I will add an FTN95 routine to the library when I get a moment.

p.s. I did not see Ian's item above and had forgotten that the interface for CopyFile already exists. Maybe I just need to improve the documentation.

8 Sep 2012 8:56 #10720

Paul, Yes, for consistency that would be nice to add. But please do not use integer*2 anywhere LOL

If possible, adding option to CISSUE behavior with /windows key suppressing popping of DOS window would be also great. It is senseless to blink for a lot of possible uses of CISSUE for example if you redirect output to the file (changing in my demo this line text='dir >z' ). Blinking DOS window contains absolutely no information in this case.

10 Sep 2012 4:02 #10721

Paul,

I would appreciate an example, or at least an explaination if Ian's example would work.

copy_result = copyfile('fred.txt','joe.txt',.False.)

Could you clarify if: ExistingFileName and NewFilename can be fortran strings, or should they have char(0) appended ? is .false. logical*4 suitable, or might cause problems ?

I am always confused about a suitable interface with the API C routines. Is there a robust approach that could be adopted for use of the STDCALL interface.

John

10 Sep 2012 8:50 #10723

The interface in win32api.ins for CopyFile is

      STDCALL COPYFILE 'CopyFileA' (STRING,STRING,VAL):LOGICAL*4

The strings do not need to be null terminated. .FALSE. will be a 32 bit value transmitted as zero. Any other value will have the same effect as .TRUE..

10 Sep 2012 10:21 #10725

Rather than put Paul to the trouble of creating new FTN95 routines, when the Windows API routines are interfaced properly in the INS file, isn't this simply a matter of documenting them? (As they are Win32, they don't have INTEGER*2 anywhere).

Is it not the case that this could be done in most cases (and for the simplest and most commonly required functions) by text that is little more than a combination of John's question and Paul's answer? (MSDN contains descriptions that require knowledge of another language to decypher).

Could this be done in a 'user supported' way (like Wikipedia)?

An important thing to note would be whether or not using the raw Win API routine might interfere with standard Clearwin+

There are hidden gems among the entries in the INS files. For example, there are routines to do a lot of things with scroll bars, like making them appear and disappear. One day I'm going to get around to exploring this in detail...

Eddie

13 Nov 2012 6:57 #11035

Hi all, I'm also suffering currently from these DOS popups. Uusing the hints in this thread I try to avoid them as much as possible. Under gcc.gnu.org I found plans about 'CALL EXECUTE_COMMAND_LINE'. Would the specs of this command allow to popup a DOS flashes? Are there plans to implement it in ftn95 as 'silent' alternative to CALL SYSTEM ? Johannes

Standard: Fortran 2008 and later Class: Subroutine Syntax: CALL EXECUTE_COMMAND_LINE(COMMAND [, WAIT, EXITSTAT, CMDSTAT, CMDMSG ]) Arguments:

COMMAND 	Shall be a default CHARACTER scalar.
WAIT 	(Optional) Shall be a default LOGICAL scalar.
EXITSTAT 	(Optional) Shall be an INTEGER of the default kind.
CMDSTAT 	(Optional) Shall be an INTEGER of the default kind.
CMDMSG 	(Optional) Shall be an CHARACTER scalar of the default kind. 
14 Nov 2012 9:09 #11046

There is no reason to expect any interference between ClearWin+ and direct calls to the API except perhaps when processing messages provided by SendMessage and PostMessage.

There are currently no plans to implement EXECUTE_COMMAND_LINE.

21 Nov 2012 6:50 #11140

How about SILENT_CISSUE@ or CISSUE_PRO@ when it runs without any info popups with 'shutup' key 😃 or with key 'popup_on_error' until error occurs?

21 Nov 2012 8:44 #11142

If someone wants to post a short program illustrating a flashing DOS box then I will aim to find a way to avoid the flashing.

Please login to reply.