October 16, 200421 yr 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
October 16, 200421 yr 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 ) , "" )
October 16, 200421 yr Author Newbies Uh-oh, I think I'm in trouble, then! Looks like CurrentFilePath is not a valid status flag in FMP 4.
October 17, 200421 yr Author Newbies I didn't say status(CurrentFileName) wasn't available. I said status(CurrentFilePath) wasn't.
October 18, 200421 yr You're right. Fortunately, FMP 7 has both Get ( FileName ) and Get (FilePath ).
October 19, 200421 yr 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
October 19, 200421 yr 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..."
October 19, 200421 yr 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