MariaAux Posted November 27, 2011 Posted November 27, 2011 Hi Everyone, I have inserted many pdf files into a container field through the 'Insert File' command. The PDF icon and name of the file sit nicely there. But I can't for the life of me work out how to simply open the PDF file in it's own program by double clicking the file. I can manually export field contents, meaning I will create a duplicate of the file and then open it - but creating a duplicate every time I need to open the PDf sounds a bit silly. Surely there is an easier way? Thanks so much for your time and help in advance.
Vaughan Posted November 27, 2011 Posted November 27, 2011 Script the process of exporting the field contents to the temp folder with the option to open the file.
comment Posted November 27, 2011 Posted November 27, 2011 I can manually export field contents, meaning I will create a duplicate of the file If the file is embedded in the container field (i.e. does not exist in your file system) then you must export it first. Double-clicking only works for files that have been inserted as reference only.
MariaAux Posted November 27, 2011 Author Posted November 27, 2011 Thanks Vaughan, So it is actually impossible to open the same file? In this case it is ok, because it is a pdf, but if it is a .doc that I want to edit, is it really just not possible to open an external document from within FM, that i can open, edit, and save, and always be able to open it from within the FM container field? Thanks again
MariaAux Posted November 27, 2011 Author Posted November 27, 2011 Ahhhhhhhhh, I got it now. Making a reference to the file is the secret. Question Answered. Thanks a million!
comment Posted November 27, 2011 Posted November 27, 2011 See also (Windows only): http://www.filemaker.com/11help/html/ole.19.1.html#1027500
Aubais30 Posted December 6, 2011 Posted December 6, 2011 Hello to all, I bounce on this subject because I have the same kind of problem on a great scale. Under Windows, Filemaker 11, 30,000 recordings with a document pdf in a multimedia field, to insert mostly by copy/paste. I want to automate the export 30,000 pdf to reimport only the link. To export directly by script is impossible (multimedia field) , how can i make it ? Thank you for your help and sorry for my English... Bertrand
comment Posted December 6, 2011 Posted December 6, 2011 To export directly by script is impossible (multimedia field) , how can i make it ? Very similar to this: http://fmforums.com/forum/topic/45545-looping-script-to-extract-container-jpegs/page__view__findpost__p__212714
Karsten Wolf Posted December 6, 2011 Posted December 6, 2011 Exporting by script possible with the "Export Field Contents" script step. You should check if the PDFs have a filename since you imported them via copy/paste. This can be done with a formula: "Get as text( Mediafield )". If that name is empty or only a"?" you have to give them names while exporting; something like the ID of the record. You need a unique name since you can't create folders and will be exporting all files into one folder. A sketch of the export script: set var $basefolder = "DestinationFolder" goto first record loop setvar $filepath = $basefolder & "/" & IDField & ".pdf" Export Field Contents(Mediafield, $filepath) go to next record(exit if last)
Aubais30 Posted December 8, 2011 Posted December 8, 2011 Thanks for yoour help Get as text give me "?" as you explain, and when i run the script i've got an error message (in french) Mutimédia field can't be exported. Exporting by script possible with the "Export Field Contents" script step. You should check if the PDFs have a filename since you imported them via copy/paste. This can be done with a formula: "Get as text( Mediafield )". If that name is empty or only a"?" you have to give them names while exporting; something like the ID of the record. You need a unique name since you can't create folders and will be exporting all files into one folder. A sketch of the export script: set var $basefolder = "DestinationFolder" goto first record loop setvar $filepath = $basefolder & "/" & IDField & ".pdf" Export Field Contents(Mediafield, $filepath) go to next record(exit if last)
Karsten Wolf Posted December 8, 2011 Posted December 8, 2011 That's because either you didn't set and create the destination folder (if the error starts with the first record) or you didn't manage to create a UNIQUE filename. That was a sketch and needs adaption for your environment To be more precise: If you're on Mac and the HD's name is "Macintosh HD" and you created a folder "exportFolder" on the top level the line for basefolder should look like this:: set var $basefolder = "filemac:/Macintosh HD/exportFolder/" on windows it will be more like set var $basefolder = "filewin:/D:/exportFolder/" as for the IDField part. You must have (or create now) a unique identifier for each record that can be part of a unique filename.
comment Posted December 8, 2011 Posted December 8, 2011 when i run the script i've got an error message (in french) Mutimédia field can't be exported. It sounds like you are using Export Records[], not Export Field Contents[].
Aubais30 Posted December 9, 2011 Posted December 9, 2011 Thanks for your help Karsten Wolf : you're right, i've put Get(DesktopPath) (Obtenir(cheminBureau) en français... and i forgot the folder ..... Comment : No i've used the good export function (Export field Contents) It seems to be good but i've an error message I try to translate xxx.pdf can't be created on this disk, change the name, free space ...... :idot:
comment Posted December 9, 2011 Posted December 9, 2011 xxx.pdf can't be created on this disk, change the name, free space ...... Well, that's a different error message - it indicates a non-valid path for the exported file.
Karsten Wolf Posted December 9, 2011 Posted December 9, 2011 It indicates that a file with that name already exists or you are addressing a folder which does not exist.
comment Posted December 9, 2011 Posted December 9, 2011 If a file with that name already exists, it will be overwritten without any error message.
Karsten Wolf Posted December 9, 2011 Posted December 9, 2011 What is the full path of the error message? Are there some extra "/" where they shouldn't?
Aubais30 Posted December 10, 2011 Posted December 10, 2011 Well, i turn mad .... My script : Set Var $BaseFolder; Obtenir(CheminBureau) get (desktopPath) Set Var $FilePath ; $BaseFolder&"/"&Test::ID&".pdf" Export Field contents (Test::doc;$FilePath) I have on my dektop one folder named "export" with this config the error message is You can not export multimedia field If i script like that Set Var $BaseFolder;"filemac:/DD1_SkyNet_500Go/export" Set Var $FilePath ; $BaseFolder&"/"&Test::ID&".pdf" Export Field contents (Test::doc;$FilePath) I have the error 800 and the message "1.pdf" can not be created on this disk. Change the name, free space unlock it or choose another disk " :idot: :idot:
Karsten Wolf Posted December 10, 2011 Posted December 10, 2011 Insert this before Export Field: Set Var $FilePath ; "file:" & $FilePath You have to tell FileMaker what to export. Sorry. I totally forgot about that.
comment Posted December 10, 2011 Posted December 10, 2011 (edited) 1. If you are on Windows, you need to use "filewin:/" instead of "filemac:/". For a platform-agnostic implementation, use the Get(SystemPlatform) function to calculate the correct prefix at runtime. 2. The result of Get(DesktopPath) function already ends with a "/". If you have folder named "Export" on your desktop then: Set Variable [ $path ; "filewin:" & Get ( DesktopPath ) & "Export/" & Test::ID & ".pdf" ] Export Field Contents [ Test::doc ; “$path” ] should work for you. Edited December 10, 2011 by comment
Aubais30 Posted December 26, 2011 Posted December 26, 2011 Hello Fist, sorry for the long time, i was submerged by my job .... and now its Christmas ! so Happy Christmas I put an extraction of my problem here. A sample is better than my explaination ExportMultimediaFile Thanks for your help Bertrand
Aubais30 Posted December 27, 2011 Posted December 27, 2011 There is no script in your file. Oups MultimediaFile
comment Posted December 27, 2011 Posted December 27, 2011 AFAICT, the problem here is with the actual contents of the container field: it cannot be exported manually. How did you populate the field?
Lee Smith Posted December 27, 2011 Posted December 27, 2011 Oups MultimediaFile Please attach your files to your posts here, rather than using an external link. External links have a way of getting broken over the years. Lee
Aubais30 Posted December 28, 2011 Posted December 28, 2011 AFAICT, the problem here is with the actual contents of the container field: it cannot be exported manually. How did you populate the field? That is THE problem ! I think it's by Copy/Paste on a Pc For the pdf, i find a solution (not very good but ....) I have a layout in A4 syze and I save it as pdf. But for the other case i'm in the ..... @Lee Ok sorry ExportMultimediaField.fp7.zip
comment Posted December 28, 2011 Posted December 28, 2011 I think it's by Copy/Paste on a Pc It's not very likely. Perhaps these are OLE objects? If so, they could be opened by their native applications under Windows OS.
Aubais30 Posted December 30, 2011 Posted December 30, 2011 It's not very likely. Perhaps these are OLE objects? If so, they could be opened by their native applications under Windows OS. The weight of the base is horrible 6 go i think that means that the picture is realy inside ! :-) I try under windows but does it change something for export ?
comment Posted December 30, 2011 Posted December 30, 2011 The weight of the base is horrible 6 go I beg your pardon? I try under windows but does it change something for export ? Probably not, but you should be able to save the contents directly from the respective applications.
Karsten Wolf Posted December 31, 2011 Posted December 31, 2011 The weight of the base is horrible 6 go i think that means that the picture is realy inside ! :-) The french way of saying that the database is 6GB in size (GO = Giga Octets). 6GB is a little too small for 30.000 records. I've exported the 19 records you posted and none of them have a name and the size extracted doesn't match the size reported by the formula "Length(ImageCourrier)". None of the extracted files is pdf data. Record 17/2603 is visible on OSX. When copying and examining the clipboard a lot of funny types are shown. See attachment. The listed types 'EMBO' (embedded object?), 'OLEP', 'OLER' (Object Linking and Embedding P?R?) hint at some windows mechanism that is responsible for storing the data. Here are the measured and reported media field data sizes: Record: 1 size read/reported: 5040 / 97515 Record: 2 size read/reported: 8516 / 81997 Record: 3 size read/reported: 1564 / 65954 Record: 4 size read/reported: 7608 / 42327 Record: 5 size read/reported: 7608 / 40791 Record: 6 size read/reported: 8516 / 606825 Record: 7 size read/reported: 1564 / 22959 Record: 8 size read/reported: 7608 / 40791 Record: 9 size read/reported: 1498868 / 1558154 Record: 10 size read/reported: 8516 / 46662 Record: 11 size read/reported: 1564 / 74650 Record: 12 size read/reported: 8516 / 44619 Record: 13 size read/reported: 1564 / 41375 Record: 14 size read/reported: 8516 / 57407 Record: 15 size read/reported: 8516 / 740422 Record: 16 size read/reported: 1592 / 19698 Record: 17 size read/reported: 1498868 / 3197547 Record: 18 size read/reported: 1564 / 21414 Record: 19 size read/reported: 8516 / 53853 The file exported.zip contains the data I was able to extract. exported.zip
comment Posted December 31, 2011 Posted December 31, 2011 I've exported the 19 records you posted How exactly?
Karsten Wolf Posted December 31, 2011 Posted December 31, 2011 Using a Python script. Could have been done with Applescript. To run this you'll need appscript for Python and there are problems with FileMaker 11. The script: import sys, os import pdb import appscript as asc fpa = asc.app("FileMaker Pro Advanced.app") window = "ExportMultimediaField" layout = "EXport" layref = fpa.windows[window].layouts[layout] n = layref.count(class_='crow') pdb.set_trace() for i in range(1, n+1): recref = layref.records[i] recref.go_to() media = recref.cells[ "ImageCourrier" ].get_data() medianame = recref.cells[ "imageNom" ].get_data() medialength = recref.cells[ "ImageLength" ].get_data() # ImageLength print "Record: %i size read/reported: %i / %i" % (i, len(media.data), int(medialength)) name = str(i) name = name.zfill(5) name = name + ".data" f = open(name, 'w') f.write(media.data) f.close() print
Karsten Wolf Posted December 31, 2011 Posted December 31, 2011 That depends. WRT container fields and apple events you are right. Since FileMaker 7 some capabilities are gone. PICT is the only graphics format accepted for reading and writing which is very ironic since FileMaker is owned by Apple and the default behavior since Apple OSX 10.6 is to not work with PICT, the mac standard graphics format. With FMP6 you could read a PICT from a container, convert it to JPEG, pack it up and write it back to save a lot of space. That is gone. In my book, it definitely counts as "exporting" when using an available API to get data out of FileMaker.
comment Posted December 31, 2011 Posted December 31, 2011 Ahm... but you are not getting data out, only a very small part of it. Perhaps it's only metadata - as will often happen when you copy and then paste into another application. Anyway, I don't think this thread will move forward until OP or another member opens the file under Windows.
Recommended Posts
This topic is 5055 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