z178 Posted September 18, 2007 Share Posted September 18, 2007 I have a hardisk full of files that I want to use from a database. Like Open a file from the HD when I click a button. (Better yet open it in a program that I specify like .doc in pages, pdf in Acrobat... ) I have a related table that stores info about the linked file. I'd like to insert only a path to the file and not the file itself into the database. As the files located on the HD that I track from my database are HUGE ! What is the filemaker way of doing this? 1. User clicks a button > Shows a choose file dialog. 2. User chooses a file and clicks "OK" > a path to the selected file is stored in a field in the table [color:gray]-- Hope this is not a double post. Not sure wha' happened to the same post I made a while ago : -- Link to comment Share on other sites More sharing options...
z178 Posted September 18, 2007 Author Share Posted September 18, 2007 I got it. tell application "Finder" set filePath to (choose file) as alias set POSIX_filePath to POSIX path of filePath tell application "FileMaker Pro Advanced" set field "FieldName" of table "TableName" of database "DatabaseName" to POSIX_filePath end tell end tell Now I can ask "Finder" to return attributes for the file, or use a similar applescript to open the file using a specific program. Filemaker's integration of Applescript is cool! Hopefully I can create custom dialogs using AppleScript Studio. [color:gray]Thanks to [color:blue]Mikhail Edoshin for a previous post for an applescript question. Link to comment Share on other sites More sharing options...
Fenton Posted September 18, 2007 Share Posted September 18, 2007 Be aware that a POSIX path, though it "looks" more like a FileMaker syntax path, is different, in that it does not have the Drive name, whereas a FileMaker path does. An older Mac path has the drive name, but uses ":" instead of "/". But it's fairly easy to substitute "/" for ":". To just get the Mac path: set filePath to (choose file) as Unicode text P.S. You do not need to use the Finder for just choosing a file. In fact it is better that you don't. Because you should try not to nest FileMaker "tell" blocks inside your scripts if you can help it. This works just fine without the Finder: set filePath to (choose file) set POSIX_filePath to POSIX path of filePath Link to comment Share on other sites More sharing options...
Fenton Posted September 19, 2007 Share Posted September 19, 2007 Also, there is an object hierarchy in FileMaker. The forum engine ate 2 posts I started, so this one's going to be short. Read and test this AppleScript to see what I mean: -- remove comments from line to test commands of 1 line tell application "FileMaker Pro Advanced" -- set field "test1" of table "table2" of database "AStest" to "cat" -- ALL records, even those NOT in the found set, even a 0 record found set (or a global field) -- set cell "test1" of table "table2" of database "AStest" to "cat" -- 1st record in the found set --set cell "test1" of current record of table "table2" of database "AStest" to "cat" -- error, "object not found", a database does not have a found set or current record --set cell "test1" of current record of layout "table2" of document "AStest" to "cat" -- works, current record current record -- all values (list) of the current record of window 1 -- table 1 -- all values of all fields (a list of lists) of 1st table created in the file -- "table" actually means "table occurrence" in all cases. -- There is no access to the real "tables" of FileMaker (there isn't in native FileMaker either). end tell Link to comment Share on other sites More sharing options...
z178 Posted September 19, 2007 Author Share Posted September 19, 2007 Thank you so much. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 6192 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now