Jump to content
Sign in to follow this  
z178

Big Media files

Recommended Posts

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 : --

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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