ACF Library

SelectAndGetFile

Back to List

Description: Open file select dialogue and return the content of the file. The variable $$FileName contains the selected filename

FileMaker Prototype:

Set Variable [$res; ACFU_SelectAndGetFile( string_startPath;  string_Prompt)]

Category: BOOTSTRAP

NOTE: The bootstrap library comes preloaded in the plugin. Read more

Function source:

function SelectAndGetFile (string startPath, string Prompt)
   FunctionID 202;
   string cc = "";
   string filename = select_file (Prompt, startPath); 
   if (filename != "") then
       cc = LoadFile(filename); 
   end if
   $$FileName = filename;  
   return cc; 
end

SelectAndGetFile is a combined function that lets the user select a file, and then opens it and retrieve its content that is returned. The FileMaker variable $$FileName is set to the path of the selected file. If the user press cancel, both will return empty.

Example

Set Variable [$FileContent; ACFU_SelectAndGetFile( "~/Desktop";  "Select the file to retrieve")]
Set Field [MyTable::SelectedFileName;$$FileName]
Back to List