View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2939 Location: South Pole, Antarctica
|
Posted: Thu Sep 06, 2012 3:34 am Post subject: Suppressing popups with CISSUE |
|
|
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
Code: |
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? |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8261 Location: Salford, UK
|
Posted: Thu Sep 06, 2012 9:44 am Post subject: |
|
|
Why not leave out the /windows on the command line?
Either way the behaviour under XP and Windows 7 is consistent for me. |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2939 Location: South Pole, Antarctica
|
Posted: Thu Sep 06, 2012 9:35 pm Post subject: |
|
|
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 |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8261 Location: Salford, UK
|
Posted: Fri Sep 07, 2012 6:40 am Post subject: |
|
|
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. |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2939 Location: South Pole, Antarctica
|
Posted: Fri Sep 07, 2012 8:09 am Post subject: |
|
|
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? |
|
Back to top |
|
 |
Wilfried Linder
Joined: 14 Nov 2007 Posts: 314 Location: D�sseldorf, Germany
|
Posted: Fri Sep 07, 2012 8:37 am Post subject: |
|
|
Dan, here are some ideas:
Code: |
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 |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2419 Location: Yateley, Hants, UK
|
Posted: Fri Sep 07, 2012 2:03 pm Post subject: |
|
|
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 |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2419 Location: Yateley, Hants, UK
|
Posted: Fri Sep 07, 2012 2:51 pm Post subject: |
|
|
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 |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Fri Sep 07, 2012 9:39 pm Post subject: |
|
|
Eddie,
It already exists:
Code: |
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 |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2939 Location: South Pole, Antarctica
|
Posted: Fri Sep 07, 2012 10:21 pm Post subject: |
|
|
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 |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8261 Location: Salford, UK
|
Posted: Sat Sep 08, 2012 6:53 am Post subject: |
|
|
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.
Last edited by PaulLaidler on Sun Sep 09, 2012 7:59 am; edited 1 time in total |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2939 Location: South Pole, Antarctica
|
Posted: Sat Sep 08, 2012 9:56 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Mon Sep 10, 2012 5:02 am Post subject: |
|
|
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 |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8261 Location: Salford, UK
|
Posted: Mon Sep 10, 2012 9:50 am Post subject: |
|
|
The interface in win32api.ins for CopyFile is
Code: |
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.. |
|
Back to top |
|
 |
|