how to open a file

Author: urieli@gmail.com (Uriel)

hello, i want to open a file via filebox command. when the directory open, i choose a file and press "open" and nothing happen. i'm  guessing that it just save the path or somthing like that. i tried this code : 

filebox "*.csv","R:\Q_lesheavar\out_files\lamas\" spawn "%%$$gvg_param1%%%"

it dosent work. ant idea? thanks

3 Comments

  1. Hello, If the user has selected a file then the filebox instruction will return $status = 1 and the fully qualified name of the file is stored in $result. This should do the trick:

    filebox "*.csv","R:\Q_lesheavar\out_files\lamas\"
    if ($status = 1) ; the user has selected a file
       spawn "%%"%%$result%%%%%"" ; enclose the file name with double quotes in case it contains spaces
    elseif ($status < 0)
       message/error "filebox returned the error %%$procerror"
    endif
    
    

    Hope this helps. Kind regards, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  2. Uriel said ::: i tried this code : 
    filebox "*.csv","R:\Q_lesheavar\out_files\lamas\" spawn "%%$$gvg_param1%%%"
    it dosent work.

    What is in $$gvg_param1? You should be referencing $result. Also, you may not have associated application for the file type that you are selecting. You also might like to spawn like this...

    spawn "cmd /c %%$result%%%"
    
    

    sometimes this might work over spawning the file directly.


    Author: rkrite (rkrite@gmail.com)
  3. thanks you very much to both of you! it worked!   Wink


    Author: Uriel (urieli@gmail.com)