Home » Developer & Programmer » Forms » HOST command not working (Oracle AS Version 10.1.2.0.2, Oracle Forms Version 10.1.2.0.2, Windows XP)
HOST command not working [message #429499] Wed, 04 November 2009 04:42 Go to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
am using HOST command to read a files from the directory (on the server). But HOST does not working. When i click the button to read the file, it just hangs on and no error on the console.
Does host work on forms 10g?
Any suggestion.
Re: HOST command not working [message #429547 is a reply to message #429499] Wed, 04 November 2009 08:37 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
any help...
Re: HOST command not working [message #429579 is a reply to message #429499] Wed, 04 November 2009 11:55 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
actually i am using client_host of webutil and its working fine. But it pick the directory from the client. Whereas i need to pick it from the server where AS is. Is there any way to achieve this?
Re: HOST command not working [message #430472 is a reply to message #429579] Tue, 10 November 2009 09:40 Go to previous messageGo to next message
brunobiondo
Messages: 6
Registered: November 2009
Location: Italy
Junior Member
declare
AppID PLS_INTEGER;
Command_File varchar2(100) := '"C:\Program Files\Microsoft Office\office12\WinWord.exe"';
File_name varchar2(500) := '"Your_file_name.ext"';

begin

IF(GET_APPLICATION_PROPERTY(USER_INTERFACE) = 'WEB') then
 --IF YOU DON'T WANT TO SPECIFY THE APPLICATION TO LAUNCH,BUT ONLY THE FILENAME,WITH ANY EXTENSION,THEN WINDOWS FINDS THE ASSOCIATION FOR YOU
 AppID := DDE.App_Begin('rundll32.exe url.dll, FileProtocolHandler "Your_file_name.ext"',DDE.App_Mode_Normal);

 --OR, IF YOU WANT TO SPECIFY THE APPLICATION TO LAUNCH (THE PATH OF APPLICATION MIGHT VARY FROM MACHINE TO MACHINE,PAY ATTENTION)
 --AppID := DDE.App_Begin('C:\Program Files\Microsoft Office\office12\WinWord.exe "Your_file_name.doc"',DDE.APP_MODE_NORMAL);

 --you can use also the following, but in my tests not always works (the port of application server might vary,in my case is 8889)
 --WEB.SHOW_DOCUMENT('protocol://<machine-name-of-application-server>:8889/forms/java/<Your_file_name.ext>', '_blank'); --not always works,e.g. for word documents

 synchronize;

else
 --tipically this branch is in case you have an 'old' client/server app, like in forms 6i
 HOST('cmd /c rundll32.exe url.dll, FileProtocolHandler "Your_file_name.ext"');
 --OR
 --HOST('cmd /c start C:\Program Files\Microsoft Office\office12\WinWord.exe "Your_file_name.doc"');

end if;

IF Form_Success THEN 
 Message('command executed.'); 
ELSE 
 Message('there was a problem executing command.'); 
END IF; 

EXCEPTION
	WHEN DDE.DDE_APP_FAILURE THEN
		MESSAGE('WINDOWS APPLICATION CANNOT START.');
	WHEN DDE.DDE_PARAM_ERR THEN
		MESSAGE('A NULL VALUE WAS PASSED TO DDE');
	WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN
		MESSAGE('DDE CANNOT ESTABLISH A CONVERSATION');
	WHEN DDE.DMLERR_NOTPROCESSED THEN
		MESSAGE('A TRANSACTION FAILED'); 
	when others then
		message('ERRORE: '||sqlcode||', '||sqlerrm);
		raise form_trigger_failure;		
end;
Re: HOST command not working [message #430553 is a reply to message #430472] Wed, 11 November 2009 00:51 Go to previous message
javed.khan
Messages: 340
Registered: November 2006
Location: Banglore
Senior Member

Thanks ...It helps me in one of my scenario.
What i am doing in my case is
1. I am generating one CSV file which take around 2 minute
2. What user is doing is instead of checking the file in my destination folder (Common Drive) he is goin to generate again and again whenever he need to see the file.
3. what i am doing with this code is i am enabling one flag which user can reset any time at user level.
4. If my flag is enable i will not go and generate the file instead of that i will simply open the file.
5.Although there is no rights to delete the file but anyhow if the file is deleted from destination folder then user can reset the flag and regenerate the file.

So it saves every two minute of my 50 of users one will generate and everybody will watch ...coool ha?

Thanks buddy

Jak
Previous Topic: sending & reading data from excel,word
Next Topic: Backend's sqlerrm
Goto Forum:
  


Current Time: Fri Sep 20 09:31:47 CDT 2024