Ron Cates Posted May 26, 2009 Posted May 26, 2009 (edited) Hi All. I have invoices for advertising that have a container field with a copy of the ad in a .jpg format. I was wondering if it was possible to create a script that will rename the image to the invoice number on import? Edited May 26, 2009 by Guest typo
Fenton Posted May 26, 2009 Posted May 26, 2009 (edited) I don't think FileMaker can "rename" an image, because the name came from when it was a file, outside of FileMaker. So what you need to do is either rename the file outside of FileMaker, before you bring it in; which you could do with a plug-in like MooPlug; or you could export it out of FileMaker again, renaming it via the export path, then reimporting the file you just exported. Both methods seem kind of round-about. The questions I would have are: 1. Is the file brought in [x] Reference only (in which case it's still a file out there), or is it embedded? 2. If it's embedded, why do you really care what the imbedded image is "named"? It should be in the Invoice table already, or tied to it, so the name is kind of irrelevant. 3. Is the "invoice-to-image" a one-to-one correlation? Because otherwise it makes no sense to use the invoice ID as the name. 4. If it's not embedded, and it's not 1-to-1, then it makes more sense to create a "folder" with the Invoice ID, and put/move its image files into it. Also could be done by MooPlug (AppleScript on a Mac). Edited May 26, 2009 by Guest
Ron Cates Posted May 27, 2009 Author Posted May 27, 2009 Good Morning and thanks for the input. The file is embedded and there is only one image per invoice. As part of our publishing process all the images for each publication will be exported for layout. By naming the file with the invoice number it will allow for easy reference back to the invoice if needed. So if not on import I do know I can script the file name on output but so far it looks like I have to script the entire path. I would like to be able to script the file name but still allow the user to select a location to export to. Any thoughts?
Fenton Posted May 27, 2009 Posted May 27, 2009 (edited) I would say that the best method is to rename the file before you Insert it. Then you're done. Because I think the only way to rename the file on export (using just FileMaker) is to use a fixed path. I don't think you can let them choose the path and also automatically rename it. FileMaker has limited support for manipulating external files. I wish it had more. But there are fairly simple tools on both platforms to do that, AppleScript on a Mac, MooPlug (or other plug-in, like ScriptMaster) on PC (or command line on either, if you want to get into that). These tools would let you rename the file before it's inserted, or even rename after you export. But I'd rename it before Insert. Though you might have to do both, if you already have images inserted. Maybe someone else has a better idea, a clever trick. I often use these external tools (especially AppleScript), so I do not try very hard to create FileMaker tricks to play with files. Edited May 27, 2009 by Guest
Ron Cates Posted May 27, 2009 Author Posted May 27, 2009 Thanks Fenton. That pretty much confirms my understanding of what FMP can do. This is a new database so along with developing the solution I have all new proceedures to outline as well. One of them will have to be to name the file accordingly before inserting. Although I think I may check the name and validate against the record ID to be sure the users know to name the file correctly. Thanks Again
Fenton Posted May 27, 2009 Posted May 27, 2009 My idea what that they run the FileMaker script from the Invoice record. You use MooPlug plug-in to choose the file. It renames the file to the InvoiceID. You then know the folder path (calculated from the file they chose, which the plug-in has returned), and the file name (the Invoice ID) (actually maybe MooPlug returns the path when you rename a file?). So now you can put those together, in a FileMaker Script Variable, as a full FileMaker syntax path, then use that to Insert the file (or image; this is determined by the prefix you use, filewin: or imagewin:). I would build an example, but, 1. I'd have to launch Windows (on my Mac), and 2. I just don't have time right now (already behind).
Ron Cates Posted May 27, 2009 Author Posted May 27, 2009 That's OK Fenton, I appreciate your help and effort. I have much bigger fish to fry right now anyway. I will have to revisit this issue later on.
Recommended Posts
This topic is 5658 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