Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7370 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hello all,

does anybody know how to archieve this:

I have a Drawing Database, and the Record lets say has a Number 10001. I want to import a Drawing, Jpeg, File into the Records Container Field, and in the Process change the Name of the imported File to the Drawing ID. Is this possible? I read another Post, whcih explained how to change the Filename after importing, but i see problems with that and my Users. It would be better if the FIlename is already the same of the Drawing ID before they export it again.

Does anybody know a Solution?

Thanks for all Input or reference to learning Material regarding the Topic.

Overrider

Posted

The problem with Inserting a file as reference and renaming it is that it can't be done in that order, or renaming will break the link. So you have to rename it first, put together the file path of the renamed file, then Insert it.

Oh, let me know if you need this in version 6. It would be the same. You should put your version in your profile, as many answers will depend on which version you're using.

Posted

Hello Fenton,

thank you for your reply and sharing your knowledge.

i am using Version 7. your attachment does what i need, I would like to store the File inside the Database though, not as a reference. Can you modify your Applescript to do that?

Can you recommend a good Site for AppleScript and Filemaker learning? Dont want to bother you with things like this.

regards and many thanks,

Overrider

Posted

Yes, it can do that. But it needs help. The problem with dealing with images that are being inserted embedded from a file is that setting the container field to the file stores as reference. You cannot get just the plain image without some other application or utility which understands images.

I use an AppleScript Scripting Addition named GraphicsImporter OSAX. It can access images in a file directly. Then you can set it into the FileMaker container.

I included a script to download it in the file. You must put it in your Scripting Additions folder, in your Library folder; or in the similar folder in the System library folder (for all users).

It's a little old, but works well. It can also resize pictures (to make thumbnails). Much of this can be done in OS X using the background app Image Events. But it seems to work best with file-to-file conversions and scaling, then inserting as reference. I cannot get it to get the image in a form that FileMaker is happy with to embed directly. Anyone?

InsertRename.zip

Posted

Hmmm, i hope i dont become ridicolous now; i installed the Scripting Addition, buti still get a Message saying that "Finder got an Error: The Operation could not be completed because there is already an Item with that Name.(Error -48).

EDIT: When i use the Script once, it works, if i use it the second time even on a new Record it gives me above Error Message. Does this have to do with status current record?

Other than that, i would take the hurdle to install this "Plugin" on all my Client Machines, but is there no other way? How about embedding it via the standard Filemaker Dialog, not storing a reference, and then use AppleScript to rename the File to the Record ID while exporting it to the Desktop. Wouldnt that be better? A.) one got the right Filename, and b.) dont need to install any "Plugins". What do you think?

Sorry to be a pain,

Overrider

Posted

I got it, one must change the first Line of the AppleScript to

tell current record of current layout of window 1

set newName to cell "PictureName"

end tell

then it will work also on the second or third record. seemed otherwise it is picking up the value of the first record...

Posted

Oops. Good catch. As you can tell, I whipped up the example file, with only 1 record, so I didn't notice it was only using the name from the first record. Since you're talking to the current record the whole time, you could delete the 2nd time, and the superfluous "end tell."

For example, to store as a reference (not the OSAX one):

-- tell application "FileMaker Developer"

tell current record of current layout of window 1

set newName to cell "PictureName"

set pictureFile to (choose file with prompt "Choose the picture to Insert and rename

Posted

sorry, maybe i didnt write clearly; wouldnt it be better to embedd the file via the standard filemaker script step insert picture (no reference) and then while exporting setting the filename via an applescript? i think that might be the nicer solution...or am i misunderstanding and one cannot do that with applescript alone, needing osax or similar. seems to me the only thing i need to know is how to export the file via applescript and rename it in the process...

you have been so much help for this issue, can you recommend a good apple script filemaker learning website or similar, or where did you pick up your magic?

thanks,

overrider

Posted

Well, you wrote something about "exporting," but it didn't make sense to me, so I ignored that. Why you would take a file, embed the image from it into a FileMaker container field, then export that image out again as a file?

You could fairly easily either move or duplicate the original file if you need it in another place. Why would you export from FileMaker and create a file? It would be more trouble.

It is easier to deal with image files that it is to deal with an "image" as such. Only graphics software, or a graphics Scripting Addition, can get an "image" from its file. That is why I used GraphicsImporter OSAX (which I believe stands for Open Scripting Architecture Extension). Other applications can do this, Graphic Converter, Photoshop, YVS Picture Translator (free); but a Scripting Addition is the most lightweight.

As I said, the OS X built-in background app "Image Events" should be able to do this. But I have not been able to get the correct syntax to extract something that a FileMaker container is happy with. I was hoping that BruceR might see the post and know.

There are very few places to pick up info on how to use AppleScript and FileMaker, especially to deal with image files. Most of what you're doing is standard AppleScript though, referencing a file, renaming, moving, etc.. Most of my knowledge comes from bits and pieces gleaned here and there online, but mostly from tedious trial and error.

There are a few books, most of them old, such as Danny Goodman's "AppleScript Handbook" (which is out-of-date now really, but has some good basics).

This book I haven't read, but I'll bet is good for basics: "AppleScript 1-2-3," by Sal Soghoian (who was I believe head of AppleScript at Apple for awhile? Still is? Never was?):

http://www.amazon.com/exec/obidos/ASIN/0...2406545-8229769

There is a new book, by Matt Neuburg, "AppleScript: The Definitive Guide"

http://www.amazon.com/exec/obidos/ASIN/0...2406545-8229769

It sounds good; his previous programming experience with other languages would be both a plus and a minus.

Another good place to do a search on a specific problem is at:

http://www.macscipter.net

and of course at Apple itself, where there is now a fair amount of info on AppleScript, including the Language Guides, which are concise and definitive, but not easy reading.

Posted

hello fenton,

it seems sensless , because i did not explain; i want to tie a drawing database to an item database we are running for my workplace. every item has a drawing and a drawing number and a version. now after a user made a new Item and filled in all the fields, he will also add a drawing. the drawing number shall be the part number of the item with an appended version number. now over time there might either be changes to the drawing, or the customer or whoever requests a copy. in that case i would like the user to export to his desktop. thats why i want to export with the filename set to the filemaker drawing number, so item partnumber 1234.00 gives a drawing with name 1234.00 to the desktop. thats it.

if i store jpeg one could not make change, but if i use a dwg (autocad) file, it would be nice to export a drawing (1234.00) and after making a change import it as a new version 1234.01. of course, the user could still rename to whatever he wants, but i dont care about that, because as he in & exports it the next time, the filename is set again.

i dont like to store references to the drawing, because i literally have horrible users. i am working for a western company in china, and my fellow employees are nice people, but when it comes to rules anbd regulations, it goes havoc. i can be a hundred percent sure that after a guy imports a drawing as a reference, another guy would go in and change the filename, because he can. or maybe the originator would do it himself, not understanding that the file disappears from the filemaker. there are a hundred problems with the reference idea for me. i rather import each drawing (about 300 KB) into Filemaker and done. whatever they do, they couldnt change or delete that one master. and if they export it, and make a change, it must go trough an approval process anyways before it may superceed the original drawing.

files seems to be easier to deal with, fine. images was just my example, sorry for not being specific.

i hope you can get my drift,and this adds clarity instead of more confusion, thanks for all the patience,

overrider

Posted

Well, you wrote something about "exporting," but it didn't make sense to me, so I ignored that. Why you would take a file, embed the image from it into a FileMaker container field, then export that image out again as a file?

That makes perfect sense to me.

Imagine the following situation:

Engineeringh department has all the CAD drawings on their machine.

FileMakerServer is used to make accessible the drawings to the whole company.

We are using FileMaker accounts here to prevent unauthorized access to the drawings, and only allow re-importing changed files after approval by engineering. You cannot have the files on a file server and set individual locks (read-only) or viewing rights using FileServer mechanisms, and you cannot prohibit throwing something into a graphics folder without approval for that single file.

But with embedded graphics, you can. Users can upload the changed files into a table "waiting for approval", and the engineering dept can transfer the drawing into the main table after approval by script.

And you can limit the export process to people authorized to do so. All the other people may be able to print the drawing (in low res to include in sales offers and customer correspondence, but not the CAD highres data.

Business idea for anyone? We are about to implement this for our technical drawings.

Forgot to mention:

this way, implement a controlled versioning mechanism for the drawingsis a snap!

Now, just imagine this being not drawings but your companies contracts, faxes or other important info.

some users can view, others can change, a few ca create records and retain ownership / control other users rights . The link between the info in the database and "external" sources is always there. Perfect.

All the correspondance in one place. Faxes, scanned letters, voice recordings from the phone, meeting reports, powerpoint presentations, the customers financial data, ....

We do have a very fragmented organisation - 10 small offices connectd thru high-bandwidth data lines.

Posted

hello cjaeger,

this is pretty much what i am working on as weel. do you have such a system in place and are willing to show your applescript source?

regards,

overrider

  • Newbies
Posted

I have attached an applescript that exports the contents of a container field and renames the file and can also add field contents to the file comments. The script is not perfect because FileMaker still throws up the "Save as..." dialog with the original file name already filled in. The user only needs to hit "Ok" and the embedded image is saved. The script then renames the exported file based on a field you specify in the script properties. Currently the script exports images from all the records in a found set but I will be happy to modify the script if needed. Feel free to email me directly at the address in the script documentation if you have any questions or problems.

FMContainerExport.zip

This topic is 7370 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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