Re: FMP Container Field crashes & oddities...
Re: FMP Container Field crashes & oddities...
- Subject: Re: FMP Container Field crashes & oddities...
- From: "Gary (Lists)" <email@hidden>
- Date: Fri, 13 May 2005 23:54:18 -0400
"Xandra Lee" wrote:
> I'm crashing reliably on trying to get cell data, in all but ideal
> conditions when accessing.
I'm crashing reliably trying to read your post. ;)
Is it a script? What?
--> is usually employed to convey to the list the result of running a line
of code. It would more helpful in the future to constrain your use of that
"symbol", IMO.
But, trudging through it... ;)
What do you _want_ to happen? Do you want to get a local file path and then
open the file that is embedded in the container? Do you want to grab the
actual data of the original file? What?
When FM inserts a supported image type into a container field, the actual
result (and the class of the contents of the cell) are different depending
on:
A) how you inserted the item [using the menu equivalent of Insert as
Reference, which does not move the target's data into the cell]
B) the type of item [QuickTime movie/sound, image, etc]
In the case of (A), subsequent requests to 'get' from the cell's content
will then return a file specification, pointing to the position of the file
when inserted.
You go on to use the term 'file "..."' inside your "tell" to FM. FM doesn't
know this term, so if you wanted to open or read data from that file (if it
exists there still), you should tell someone who cares, like the Finder.
In fact, the word spelled "file" does not even appear in the FM 7
dictionary!
It does appear in the word "filename" in relation to the two URL-related
entries, and it of course appears as "FileMaker".
> CRASH EXAMPLE:
> tell application "FileMaker Developer"
> set curRec to a reference to current record of window 1
> set theData to cell contField of curRec
Don't set this to an AS reference. I don't know why folks do that. Oh,
wait, because dictionaries willy-nilly use the italicized phrase "a
reference" when they mean (often) "alias", "file" or "reference" but do not
say which.
Anyway, I've been bitten by that in dictionaries too, so, just use:
tell app "FileMaker Pro"
set theDataPath to cell "Pretty Picture" of current record
--> file specification
end tell -- could be one line, split for list post
Now just tell Finder to open theDataPath
> ODDITIES:
> 1. In some/all? instances using an Applescript to set the container field
> to a reference to a picture --> file icon in the container field (rather
> than the image one gets when manually inserting reference to the image file)
RTM.
That's expected behavior. When you use the menu item or it's FM ScriptMaker
equivalent or the AS equivalent of "Insert a Reference to..." you are
saying:
"Please insert this image only showing me a PICT thumbnail of it here, but
try to remember where the real image was stored."
> 2. set dataType to class of theData
> --> «data PICT» if field is empty
Again, the "graphic" that you see in the cell is not the actual image file,
nor is it even the image file's data -- it's a PICT representation. (You
should also note the relation between the data class and the Preference
setting "Store compatible graphics". Is that ticked or not?)
Xandra, go and download some of the FM-AS-Container tools that I've posted
to the web. They are small files that illustrate various tasks related to
scripting access to container fields. While neither brilliant nor kind of
shiny, they have been useful to others and may save you some time.
Inserting Images by Reference with AppleScript - Opening Images [5 k]
> Use AS to locate and insert references to images stored on a drive.
> Demonstrates techniques for opening an image in the Finder from the inserted
> reference path.
>
> See 'FileMaker Field Reporter' (below) for useful scripts for performing tests
> on Container Field content to determine if an image is actually embedded in
> the file or if it is included by reference.
AppleScript Insert File Path / Open File from Path [8 k]
> Use AppleScript to insert a file path into a text field. Use the text field
> path to locate and open the file item in the Finder. Can be used for image
> browsing/launching for for launching any kind of file from within FileMaker.
FileMaker Field Reporter v1.0 [12 k]
> A Field Data browser test tool for AppleScript. Run the script with any data
> file open, and you are presented with a list of every field in your data file
> (or the current layout). You choose a field and some AppleScript Class
> information about the field is shown. Shows name of field, cell value (except
> for container fields), class of cell value (text, picture/quicktime, sound),
> class of field, class of cell, best type class of cell, best type class of
> field.
<http://nichecrafters.com/NicheTech/> is the start, then click or scroll to
'FileMaker'.
HTH
--
Gary
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden