How to execute a bat file from client machine? [message #398946] |
Mon, 20 April 2009 00:00  |
sirivijay
Messages: 48 Registered: October 2008
|
Member |
|
|
Hi,
When migrating forms from 6i to 10g.I had an issue that i need to run a bat file (REPORT.BAT)containing the following text " START IEXPLORE C:\Apps\Client\LSTRANS.xml"This will invoke the browser and show the report.
In 6i this is coded as host(batfile)..How i can implement this in 10g.this is working in local machine when developing.but its not working after i deployed to the serevr.tried attaching webutil and used client_host(batfile) it doesnt worked.any other solution??
|
|
|
|
|
Re: How to execute a bat file from client machine? [message #398955 is a reply to message #398950] |
Mon, 20 April 2009 00:27   |
sirivijay
Messages: 48 Registered: October 2008
|
Member |
|
|
Thanks for your reply littlefoot.I tried using client_host..When tracing when the control goes to the procedure of client_host of webutill, it is breaking in the middle and going to the exception. i am passing the file containing the exact path of bat file.i feel the code is clear and not knowing what breaks the client_host as it is getting the required path of batfile the bat file is running and showing the report in internet explorer when i click it manually from that location.
Is there any other logic i can use to make this report displayed.i mean other than batfile..
|
|
|
|
Re: How to execute a bat file from client machine? [message #399194 is a reply to message #398946] |
Tue, 21 April 2009 01:40   |
sirivijay
Messages: 48 Registered: October 2008
|
Member |
|
|
PROCEDURE START_IEXPLORER (fileName VARCHAR2)
IS
hFile CLIENT_TEXT_IO.FILE_TYPE;
V_METHOD_NAME CONSTANT VARCHAR(40) := 'PROCEDURE START_IEXPLORER';
V_METHOD_LABEL VARCHAR(40);
v_temp_dir VARCHAR(100) := 'c:\Apps';
v_cmd_file_loc VARCHAR(200);
serverxml VARCHAR(200) ;
serverxsl VARCHAR(200) ;
serverbat VARCHAR(200) ;
clientxml VARCHAR(200) ;
clientxsl VARCHAR(200) ;
clientbat VARCHAR(200) ;
BEGIN
serverxml := 'C:\Apps\LSTRANS.xml';
serverxsl := 'C:\Apps\LSTRANS.xsl';
--serverbat := 'C:\Apps\EgisReport.bat';
clientxml := 'C:\Apps\Client\LSTRANS.xml';
clientxsl := 'C:\Apps\Client\LSTRANS.xsl';
clientbat := 'C:\Apps\Client\EgisReport.bat';
--WEBUTIL_FILE_TRANSFER.AS_TO_CLIENT_WITH_PROGRESS(clientxml,serverxml,'Downloading the XML file if exist','please wait');
--WEBUTIL_FILE_TRANSFER.AS_TO_CLIENT_WITH_PROGRESS(clientxsl,serverxsl,'Downloading the XSL file if exist','please wait');
IF WEBUTIL_FILE_TRANSFER.AS_TO_CLIENT_WITH_PROGRESS(clientxml,serverxml,'Downloading the XML file','please wait') Then
Message('XML file Transferred to client', NO_ACKNOWLEDGE);SYNCHRONIZE;
else
Message('XML file not Transferred', NO_ACKNOWLEDGE);SYNCHRONIZE;
end if;
IF WEBUTIL_FILE_TRANSFER.AS_TO_CLIENT_WITH_PROGRESS(clientxsl,serverxsl,'Downloading the XsL file','please wait') Then
Message('XsL file Transferred to client', NO_ACKNOWLEDGE);SYNCHRONIZE;
else
Message('XsL file not Transferred', NO_ACKNOWLEDGE);SYNCHRONIZE;
end if;
--Tool_Env.Getvar('TEMP', v_temp_dir);
/* Close file when already opened */
V_METHOD_LABEL := 'Close file';
CLIENT_TEXT_IO.FCLOSE(hFile);
V_METHOD_LABEL := 'Open file';
--v_cmd_file_loc := v_temp_dir || '/EgisReport.bat';
v_cmd_file_loc := clientbat;
hFile := CLIENT_TEXT_IO.FOPEN(v_cmd_file_loc, 'W');
CLIENT_TEXT_IO.PUT(hFile, 'START IEXPLORE ' || clientxml);
CLIENT_TEXT_IO.FCLOSE(hFile);
CLIENT_HOST(v_cmd_file_loc);
EXCEPTION
WHEN OTHERS THEN
MESSAGE(DBMS_ERROR_TEXT || V_METHOD_NAME || V_METHOD_LABEL);
END;
|
|
|
|
|
Re: How to execute a bat file from client machine? [message #400377 is a reply to message #398946] |
Mon, 27 April 2009 23:37   |
sirivijay
Messages: 48 Registered: October 2008
|
Member |
|
|
The code you gave is working if i run it from the start->run command but when i am placing this in client_host its not working..i think some thing is stopping to execute the bat file.in my machine.
can you give me an idea.
i want to create some files in temporary folder of the server and transfer them back to client and open them as a report in internet explorer.
in 6i this is implemented by taking the temp folder path from environment,creating the files there..and opening in the browser with the bat file.
in 10g i created a folder temp in folder where all my forms are placed,then creating the files there,bringing them to client's c:\(as common to every client) drive and opening it..
I completely hardcoded every path in the code but i guess its a bad implementation..
as this is a development server..i need to change the code to implement in production.as i have to create a temp folder there and give client and server path in code again
any idea how i can make this independent of hardcoading..
|
|
|
Re: How to execute a bat file from client machine? [message #400502 is a reply to message #400377] |
Tue, 28 April 2009 08:51   |
|
Quote: | in 10g i created a folder temp in folder where all my forms are placed,then creating the files there,bringing them to client's c:\(as common to every client) drive and opening it..
I completely hardcoded every path in the code but i guess its a bad implementation..
as this is a development server..i need to change the code to implement in production.as i have to create a temp folder there and give client and server path in code again
|
" Creating the files there... " how are you doing that?
let me tell u what i have done.... i have a table in my database where i have a column of type CLOB where i am actually storing a PDF file. this is the code i used to download the file on to client machine and open it on client machine..
PROCEDURE DOWNLOAD_DB IS
l_success boolean;
var varchar2(500);
al_id Alert;
al_button NUMBER;
BEGIN
l_success := webutil_file_transfer.DB_To_Client
(clientFile => 'C:\temp\tmp.pdf'
,tableName => 'emp'
,columnName => 'ACTUAL_FILE'
,whereClause => '');
if l_success then
var := 'cmd /c rundll32 url.dll,FileProtocolHandler C:\temp\tmp.pdf';
IF copy_by_host_cmd(var) then
al_id := Find_Alert('User_Warning');
al_button := Show_Alert(al_id);
IF al_button = ALERT_BUTTON1 THEN
var := 'cmd /c Del c:\temp\tmp.pdf';
IF copy_by_host_cmd(var) then
null;
end if;
end if;
Else
Display_okay_message1('Acrobat Reader may not be installed on your Computer. Please contact Administrator');
end if;
else
display_okay_message1('File download from Database failed');
end if;
END;
FUNCTION copy_by_host_cmd(VAL varchar2)
RETURN BOOLEAN IS
BEGIN
client_host(val);
return TRUE;
EXCEPTION
WHEN OTHERS THEN
return FALSE;
END;
Let me know if u didnt understand anything
Mudabbir
|
|
|
Re: How to execute a bat file from client machine? [message #401320 is a reply to message #400502] |
Mon, 04 May 2009 01:21  |
sirivijay
Messages: 48 Registered: October 2008
|
Member |
|
|
Hi Mudabbir,
Thanks for the reply..If you see my code below you will get a clear picture of my requirement.
You can observe that i have hard coded some paths of server.As this is a development server code may not work when moved to the production.if i code like this it will not be accepted as the code is not portable..
the code you mentioned is having the hardcoded client path ..as the client may have some common folder it may not create the problem.but as the server is considered ,the deployment folders keeps varrying...so can you please suggest me how i can make the code independent up to forms path..as i can create the temporarily folders inside the application folder in server's forms path and make it portable.
PROCEDURE START_IEXPLORER (fileName VARCHAR2)
IS
hFile CLIENT_TEXT_IO.FILE_TYPE;
V_METHOD_NAME CONSTANT VARCHAR(40) := 'PROCEDURE START_IEXPLORER';
V_METHOD_LABEL VARCHAR(40);
v_temp_dir VARCHAR(100) := 'e:\APPS\oracle\as10g_mid\forms\EGIS\temp';
v_cmd_file_loc VARCHAR(200);
serverxml VARCHAR(200) ;
serverxsl VARCHAR(200) ;
serverbat VARCHAR(200) ;
clientxml VARCHAR(200) ;
clientxsl VARCHAR(200) ;
clientbat VARCHAR(200) ;
BEGIN
serverxml := 'e:\APPS\oracle\as10g_mid\forms\EGIS\temp\LSTRANS.xml'; serverxsl := 'e:\APPS\oracle\as10g_mid\forms\EGIS\temp\LSTRANS.xsl';
clientxml := 'C:\Apps\LSTRANS.xml';
clientxsl := 'C:\Apps\LSTRANS.xsl';
IF WEBUTIL_FILE_TRANSFER.AS_TO_CLIENT_WITH_PROGRESS(clientxml,serverxml,'Downloading the XML file','please wait') Then
Message('XML file Transferred to client', NO_ACKNOWLEDGE);SYNCHRONIZE;
else
Message('XML file not Transferred', NO_ACKNOWLEDGE);SYNCHRONIZE;
end if;
IF WEBUTIL_FILE_TRANSFER.AS_TO_CLIENT_WITH_PROGRESS(clientxsl,serverxsl,'Downloading the XsL file','please wait') Then
Message('XsL file Transferred to client', NO_ACKNOWLEDGE);SYNCHRONIZE;
else
Message('XsL file not Transferred', NO_ACKNOWLEDGE);SYNCHRONIZE;
end if;
CLIENT_HOST('cmd /c START IEXPLORE C:\Apps\LSTRANS.xml');
|
|
|