Here's a technique I use to get the file path to a file:
I define a global container field.
The script goes to a layout where the global container field is present.
It uses insert file with the store a reference option selected to insert the file. I specify "reference" and other options in Dialog Options, I specify the container field, but do not specify a file. This results in a dialog opening where the user can select a file and then it is inserted "by reference" into the container field.
I can then use a calculation to extract the file path from this container field.
GetValue ( Globals::gFileContainer ; 2 )
I use this method in my standard "update to new version" script so that when I deliver a new version of a DB to a client, they run this script to find the copy of their current version so that the new copy can import all the data from it.
Note: the ability to specify Dialog Options was a new feature in FileMaker 12, so users of FileMaker 11 and older can't do that, but this can still be made to work in such older systems.
Thanks. I understood your way.
How to define "global" container? I know how to define container field, but didn't work on global container..
Can you also help me on the issue... I want to extract the mapped directory information. Eg. if Z: mapped to a shared network directory (\\path-fst1.ad.XXX.edu\Public\) then the filepath: instead of z:\.......bif , it should be \\path-fst1.ad.XXX.edu\Public\.........bif. Let me know. Thanks!
Open Manage | database | Fields
Find and double click the field.
You'll find a storage option for global storage on the storage tab.
This method should return the fully qualified path to a file inserted from a shared/mapped/mounted directory.
You may find the info and demo file on $Path variables, container fields and the script steps that can be used with them of interest: Exploring the use of a $Path Variable in Scripts
I tried with the script: GetValue ( Globals::gFileContainer ; 2 ) , it returns filepath: "filewin:/z:/.......bif", not the fully qualified path.
I don't know why that would be. When I test this on my Windows 7 system to insert a file from a shared directory on the server, I get
Which is the full file path in my case. It may be a difference in Operating system versions or how your and my networks are configured.
my z: is mapped to "\\path-fst1.ad.XXX.edu\Public\" and I want the whole path to show. Instead of "filewin:\z:\.....bif", I want to show "\\path-fst1.ad.XXX.edu\Public\ ...bif", because different user can be mapped the same share folder to different directories.
Ok, but I know of no way to do that in FileMaker.
because different user can be mapped the same share folder to different directories.
That's really something that should be avoided on your systems if at all possible as this tremendously complicates your design.
I use a batch file stored in the database that can be exported and executed to map a specific drive letter to the needed location. When users can't get to the needed files, they click a button that exports and executes the file to map that directory in the form needed in order for the file path references to work. That keeps every one standardized on the same file path here. This should only need to be done once, but we've seen "glitches" drop the mapping to a given drive letter so our users know to click this button first before seeking tech support help.
Yes, I know that can complicated the system. But, it seems their (my client) system works this way.
Thanks for giving me the information.