miszczykr Posted December 12, 2002 Posted December 12, 2002 What is the best way to find paths to pictures that have been inserted before? I took over a database with almost 6,000 pictures. They have been attached using Insert Piture[ ] script step. Is there a way to get those locations (its all over a network in our company)?
jfmcel Posted December 12, 2002 Posted December 12, 2002 If you are a Mac user you can use AppleScript to get the path...
jfmcel Posted December 12, 2002 Posted December 12, 2002 Here is a sample script that will move the file referenced by the container to a new destination... tell application "FileMaker Pro" set theFile to cell "container" of current record end tell if theFile is not "" then try set thePath to theFile as string on error display dialog "Image not stored as reference to file" return end try set theDestinationFolder to choose folder tell application "Finder" duplicate file thePath to theDestinationFolder end tell else display dialog "No Image found in current container field" end if
BobWeaver Posted December 13, 2002 Posted December 13, 2002 If you just want to find the file path rather than move the pictures, here is a script: -- Finding the filepath name of a picture in the current record only -- If you want to do all records, place this in a Scriptmaker loop tell database "PicCatalog.fp5" of app "Filemaker Pro" -- "picture" is the name of the container field set pathref to cell "picture" of current record -- picref is a text field where the file name and path will be deposited set cell "picref" of current record to pathref as text end tell
miszczykr Posted December 13, 2002 Author Posted December 13, 2002 Thank you for your immediate response, so as I understand there is no way to get those paths (links) on a PC. Since this is extremely important issue for me (I can even loose my job) I HAVE to do it over the weekend on a MAC (not to much experience witch MACs yet), but If I HAVE to... any tips for quick applescript?
BobWeaver Posted December 14, 2002 Posted December 14, 2002 Given the applescript that i posted above, you can call it from within a regular Filemaker script like this: show all records Go to Record/request [first] loop Perform Applescript[<code from above post>] Go to Record/Request [next][exit after last] end loop This will go through every record in the file and call the applescript which will retrieve file path for container field 'picture' and put it into text field 'picref'. So, you can rename 'picture' in the applescript to your actual graphic field name, and create the picref field in your main file. General tip for applescript: Debug the applescript using Script Editor which is a utility that will be on the mac. It gives you a better debug environment. Once it's running correctly, copy and paste the code from there into the 'perform applescript' command in the filemaker script. Oh yes, don't forget to change the filename in this applescript line: tell database "PicCatalog.fp5" of app "Filemaker Pro" to the actual name of your filemaker database.
miszczykr Posted December 14, 2002 Author Posted December 14, 2002 Thank you for all those details. I am familiar with filemaker (so I know about changing names for fields and application). MAC is completely new environment for me, but who knows - I can fall in love ... Besides it is highest time for me to get into applescript. Thank you once again and I will let you know if it succeeded (it seams pretty easy). Robert
BobWeaver Posted December 14, 2002 Posted December 14, 2002 Here's a little more advice related to Applescript's syntax. If you have used any other programming language, you know that there are certain types of syntax that are equivalent. For example, you can usually substitute an expression in place of a variable that is equal to that expression, or vice versa. Because of Applescript's English like (ie, ambiguous) syntax, this doesn't always work the way you might expect. Adding parentheses sometimes helps. But sometimes you will find that you have to try different versions of what appears to be equivalent code in order to get it to work. Annoying as heck! For more Applescript info check out http://macscripter.net/
miszczykr Posted December 15, 2002 Author Posted December 15, 2002 Could you please tell me why doesn't this work??? tell database "pathref.fp5" of app "Filemaker Pro" set pathref to cell "picture" of current record set cell "picref" of current record to pathref as text end tell Filemaker gives me error message: "... Object not found (Error -1728). It seems like error is in line 2, but "picture" is my field's name. Script editor can't even accept first line. It says: "Expected end of line, but found ". That makes me crazy. I am uisng MAC OS 9.2 and Filemaker Pro 5.5. I created a new database "pathref.fp5" with just 3 fields to test it:recordid, picture and picref. Please help. I attached my pathref.fp5 file.
BobWeaver Posted December 15, 2002 Posted December 15, 2002 There's no attachment here. Could you try attaching it again? BTW, you have to determine how the graphics were stored. When you insert the graphic, you can either insert the file reference, or the actual graphics data itself. This applescript will only work if you saved the file reference. If you inserted the actual graphic object, then filemaker has no further need to know where it came from, and the file reference is lost. I'm guessing that if the database contains over 6000 graphics, then they are probably stored as references. However, maybe you didn't do this when you tried your test file.
miszczykr Posted December 16, 2002 Author Posted December 16, 2002 I did insert a picture as a reference in that test database. In "real" database users have attached pictures as reference, too. I am surprised you did not get that file. I hope I have a priviledge to attach a file here on the forum. So lets try again ... If this won't work, can you give me your email or sth so I can send it to you? pathref.zip
BobWeaver Posted December 16, 2002 Posted December 16, 2002 Okay, got it this time. I'll check it out and get back to you.
miszczykr Posted December 16, 2002 Author Posted December 16, 2002 I found another script, but what is strange it works just for my test database (when I attache new records) tell application "Filemaker Pro" -- count the found set of records in the (current) database and -- put that number into NumOfRecords set NumOfRecords to count record of layout 0 of database 1 -- Loop through all the found set repeat with i from 1 to NumOfRecords -- Get the contents of "picture" in a certain record of the current database Set PictureReference to cell "Art1" of record i of layout 0 of database 1 -- Put the contents into "picref" as text set cell "Art1Link" of record i of layout 0 of database 1 to PictureReference as text -- Stop when you run out of records end repeat end tell When I try to use this script in my real database - it gives me two types of error messegases. Sometimes it says not enough memory to complete this operation, which can't be true (there is 512MB of my RAM and enough for filemaker) and sometimes it is Apple error. ... its a long way. Any solutions?
jfmcel Posted December 16, 2002 Posted December 16, 2002 If your script encounters a container that has an no image or an internally stored image, the AppleScript will fail. But that is OK. If you capture the error, your script will know to skip the record or to mark the record with a tag. [One caveat is that the error capture with OS X can behave differently than with OS 9.x.] Try this modification to your script tell application "FileMaker Pro" tell database "pathref.fp5" try set pathref to cell "picture" of current record on error errMes set cell "picref" of current record to errMes return end try try set cell "picref" of current record to pathref as text on error set cell "picref" of current record to "No image or internally stored image" end try end tell end tell I have noticed that if the volume on which the image resides is not available, you may get an out of memory error. [Greater flexiblity can be gain if you use Akua Sweet scripting addition, but that is beyond this discussion.]
BobWeaver Posted December 16, 2002 Posted December 16, 2002 I tried running your attachment, and it worked perfectly on my computer (OS9.2 and FM5.5) when I tested it with a graphic on my local drive. I don't have any convenient way of testing it with graphics stored on a network.
miszczykr Posted December 17, 2002 Author Posted December 17, 2002 All right, I think I have a solution to this problem (I mean no solution). After cosnulting with a network administrator I think it is impossible to achieve. You were right it works on a local hardrive. The problem is that our network is based on Windows (NOT MAC) session. Users connect to Filemaker server using Citrix Client (which uses windows session). Now our applescript requires Mac and I can find links (references) to pictures which are stored on a local volume. However all pictures in our database are stored all over the network and this is why I was getting "not enough memory" error messages on a Mac computer. To confirm that I am going to contact Filemaker Support - maybe they have some magic tools ... who knows. Anyway thank you for your help everyone and have a good day.
BobWeaver Posted December 18, 2002 Posted December 18, 2002 Maybe look at the troi file plug-in. It does a lot of clever things related to file references. It's both Windows and Mac compatible. I don't know if it will solve this particular problem, but you can download a fully functional demo to test out.
jfmcel Posted December 18, 2002 Posted December 18, 2002 You should be able to mount the server volumes on the mac, but the paths will still be diffferent. I understand there is a way to have images show up between the citrix session and on the Mac side. You need to specify the volumes using the internet protocol path to the file, but I think that would need to be up front, as the images are imported. It seems strange that it isn't possible to get the path without the volume mounted and available. Maybe you should look into Visual Basic to get the path from within Citrix?
miszczykr Posted December 18, 2002 Author Posted December 18, 2002 Regarding Troi Plug-In I bought that one about two weeks ago and it works well. I implemented it and since then all records have a field containing reference to a picture. My goal is to get reference to previous records. ... as I called Filemaker support they suggested something about open URL script step (if our server is ftp accessible). I will try to make some research in that direction ...
Newbies Frankf Posted March 20, 2003 Newbies Posted March 20, 2003 In trying your script below to retrieve a path for an insterted Quictime (audiofile) reference, in a single record I get this error: "Cant make Data" followed by a long string beginning with "PICT000........................." Would there be a modification for Quicktime instead of Picture? -- Finding the filepath name of a picture in the current record only tell database "SndCatalog.fp5" of app "Filemaker Pro" -- "sound" is the name of the container field with Quictime audio set pathref to cell "sound" of current record -- picref is a text field where the file name and path will be deposited set cell "AudioFileName" of current record to pathref as text end tell
Recommended Posts
This topic is 7989 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