This discussion is archived
1 Reply Latest reply: Jul 10, 2013 1:59 PM by CraigB RSS

i want to get desktop path for client user using webutil

IDcode Newbie
Currently Being Moderated

oracle database 11g

oracle forms 10 g

client windows

 

 

i want to get desktop path for client user using webutil
as i want to save file in this path

  • 1. Re: i want to get desktop path for client user using webutil
    CraigB Guru
    Currently Being Moderated

    To get the user's path to their Desktop is a two step process.  First, you have to echo the %USERPROFILE% to a output file and secondly, read the directory from the output file in to Forms.  The code would look similar to the following:

     

    /* When-Button-Pressed trigger */
     DECLARE
      v_temp_path VARCHAR2(250);
      v_temp_file VARCHAR2(12) := 'webutil.log';
      f_file Client_Text_IO.File_Type;
     BEGIN
      Client_Host('cmd /c echo %USERPROFILE%\Desktop > c:\'||v_temp_file);
      f_file := Client_Text_Io.FOpen('c:\'||v_temp_file, 'R');
    Client_Text_Io.Get_Line(f_file,v_temp_path);
    Client_Text_Io.FClose(f_file);
       b_dummy := WebUtil_File.Delete_File('C:\'||v_temp_file);
      --At this point, you have the path stored in the v_temp_path variable.
      --You can assign this variable to a block item or reference it directly in your code.
    END;
    
    

     

    When you reference the value of the v_temp_path, don't forget to wrap the value in double-quotes (" ") becuase the path will have spaces.  Since your plan is to write a file to the user's desktop, your call to FOPEN will look  like this:

     

     

    f_file := Client_Text_Io.FOpen('"'||v_temp_file||'"','W');
    

     

    Hope this helps,

    Craig...

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points