Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Finding Current Directory

Featured Replies

  • Newbies

Hi All,

I'm new at using the Send Message script step. I want to use it to open a Word document, but the specific path may vary. It will always be in the same directory as the current solution. Is there any FMP function that will tell me the current directory of the database I am running?

Thanks,

Susie

Welcome to the Forums Susie,

FileMaker 4 is before my experiences, but in 5.5 you can use the calculation below to find the directory.

Substitute( Status( CurrentFilePath ) , Status( CurrentFileName ) , "" )

  • Author
  • Newbies

Uh-oh, I think I'm in trouble, then! Looks like CurrentFilePath is not a valid status flag in FMP 4.

No, Status (CurrentFileName) is available in FMP 4.

  • Author
  • Newbies

I didn't say status(CurrentFileName) wasn't available. I said status(CurrentFilePath) wasn't.

You're right. Fortunately, FMP 7 has both Get ( FileName ) and Get (FilePath ).

I can think of two options to try.

1) Create a global field and manually enter the directory location so it is available to all calcs and scripts.

2) If you are adventerous you could try a modified version of this tech brief on the Send DDE Execute script step from FileMaker's resources. I am new to DDE's but I did get file paths out.

Write a batch file in Notepad.

Name: FileList.bat

C:

cd

dir *.fp5 /s /b /o > "C:My FolderFileList.txt"

Notes:

a) cd can be changed to an other directory to narrow the search path, e.g. cd C:Documents and SettingsAll UsersMy Documents to only find files in that directory.

: Replace *.fp5 with the file extension for version 4 and/or the actual name of a file that the script is run from.

c) "C:My Folder" is the location of the file you are writing with the batch file.

d) "FileList.txt" is the name of the new file the batch file creates.

Create a new database with...

Fields:

FilePath (text) =

Scripts:

Name: Create FilePath

Send Message ["FilePath.bat", "aevt", "odoc"] (File: FilePath.bat)

Name: Import FilePath

Freeze Window

Show All Records

Delete All Records [No dialog]

Perform Script [sub-scripts, "Create FilePath"]

Pause/Resume Scripts ["0:00:03"]

Import Records [Restore, No dialog, "FileList.txt"]

Notes:

The pause is necessary to allow the batch file to complete creating the "FileList.txt" file

Depending on how selective you set up the batch file and how many FileMaker files are on your machine, you may still need to narrow down the data to find the correct file path form a list of files.

Hope this will help.

Mark

FileMaker 4 ... I recommend you have a look at the FREE File Toolbox Plugin. "...contains over 20 file-based functions, like rename, delete, move, copy..."

Also worth mentioning is the Open URL script step may be used to open files. (Although that doesn't help you get the file path -- good job on that, Mark!)

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.