Brian Dunning's FileMaker Custom Functions

AS_File_exists ( myPath ; result_field )

verifies if a file or directory exists and return a value to a global field (macOS/OSX only)

  Average rating: 3.3 (4 votes) Log in to vote

Thomas Siebert   Thomas Siebert - Show more from this author
http://www.t-seabird.de

Share on Facebook Share on Twitter

  Sample input:
AS_File_exists ( Get ( DocumentsPath ) ; TableName::FieldName )

AS_File_exists ( "/Users/username/Downloads/test.zip" ; TableName::GlobalFieldName )
  Sample output:
1

if file exists 1 will be returned to a global field.
otherwise 0 will be returned.

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

returns 1 if a file or directory exists
otherwise 0 will be returned


result_field should be a standard text field of the current table or any global field
at least one record is required in a table to return a value to a global field

there is no way writing a result of an AppleScript directly into a FileMaker variable if using the common FileMaker function "perform AppleScript"

U shall use a standard POSIX path or a common FileMaker paths like:
"filemac:" & Get ( DesktopPath ) & "file.csv"

The script removes prefixes like "filemac:" or the name of the start volume like "/Macintosh HD/" from the path automatically.


Use the ScriptStep "Perform AppleScript" using the option "Calculated AppleScript"
You also shall use "Perform AppleScript" directly from a button.

 

Comments

Thomas Siebert   Thomas Siebert
Apr 23, 2017
parameters changed:
a global field for returning the result will be referenced directly
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: