Home » Developer & Programmer » Forms » How do I look at a directory to see if a file exists
How do I look at a directory to see if a file exists [message #171414] Tue, 09 May 2006 17:41 Go to next message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
I currently have Oracle 6i forms builder installed on an XP machine.

I need to look at a directory on the client machine ( not database ) to see if a file exists in a directory.

If it does - open it.

If not - then open another directory.

Any help is appreciated.
Re: How do I look at a directory to see if a file exists [message #171421 is a reply to message #171414] Tue, 09 May 2006 20:53 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
For looking at a directory on the Application Server look at http://www.orafaq.com/forum/m/169474/67467/?srch=host+dir#msg_169474

For looking on the client's PC search this forum for 'd2kwutil'.

David
Re: How do I look at a directory to see if a file exists [message #171838 is a reply to message #171421] Thu, 11 May 2006 13:07 Go to previous message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
LOOKING DID HELP AND I USED THE FOLLOWING ===



WITHIN THE ACTUAL FORM MODULE I ADDED AN ADDITIONAL PROGRAM UNIT OF FUNCTION AN ATTATCHED IT : ( the function is named HelloFile and uses a BOOLEAN return type with the TEXT_IO to test if it can actually open the file.


FUNCTION HelloFile (p_filename VARCHAR2) RETURN BOOLEAN IS 

-- p_filename variable will hold the value of the directory specified in the trigger IF statement


fileID TEXT_IO.FILE_TYPE;

BEGIN

fileID := TEXT_IO.FOPEN(p_filename, 'r');

TEXT_IO.FCLOSE(fileID);

	

RETURN TRUE;


EXCEPTION
 
 WHEN others THEN
 
RETURN FALSE;
	
END HelloFile;






- THE FUNCTION ABOVE GETS CALLED FROM A BUTTON TRIGGER THAT USES THE IF STATEMENT OF:


-- START WORD


IF :GLOBAL.APPLICATION_ID IS NOT NULL THEN
	
		MESSAGE('Application is already running.');

	ELSE
	
		IF HelloFile('C:\Program Files\Microsoft Office\Office\WINWORD.EXE') THEN

                             -- the above directory is then stored in the (p_filename) of the function HelloFile
                             -- to see if it can be opened, IF SO then open the directory as below
                             -- IF NOT then go to the else statement and process the next directory to open word. 

				appl_name := 'C:\Program Files\Microsoft Office\Office\WINWORD.EXE';
				:GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);

		ELSE

				appl_name := 'C:\Program Files\Microsoft Office\Office11\WINWORD.EXE';
				:GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);
				
		END IF;


		
END IF;	


Previous Topic: How Do I find out "in code" what type of operating system a user is running ( XP or 2000 )
Next Topic: signing jar files & OLE problem (merged)
Goto Forum:
  


Current Time: Fri Sep 20 06:57:16 CDT 2024