June 28, 200619 yr I am having a hard time believing that FMP8 does not have a function to open a file requester on windows. I -must- be missing something. I need a way to open a file requester and drop the path into 1 field and the file name in another field, and to make matters worse, I really would like this functionality to work on PC & Mac Via web server. Come on. For real? Open Dialog box, browse to file, and select it, click ok. thats all I need. can someone please help. :)
June 28, 200619 yr Since you put this in the Import topic area, have you tried to use the Import Records Function? If this isn't what you mean, then what is that you are wanting to do with the file once it is opened? Lee
June 29, 200619 yr Author thanks for asking. I do not want to do anything with the file. I just need a windows file path to the file to be stored in a field. I need a way of getting C:projectsworkuprednition_v01.jpg to be broken down into field path = c:projectsworkup field filename = rednition_v01.jpg then later, when rednition changes to rednition_v02.jpg the user can click on the icon that activates the file requester and point it to the new file. the directories will not always be the same, the directorys will change often. I just need a way to get a file path into a field without the user having to type it in manually and risk errors.
June 29, 200619 yr Author But how do i point to the file? Get(filepath) of what? That function seems to only return the path to the location of your database file. (the fp7 file) that is not where we save all of the work we will be tracking. Edited June 29, 200619 yr by Guest
June 29, 200619 yr the user can click on the icon that activates the file requester and point it to the new file This can be done by having a container field on the layout (this can be hidden and entry-disabled), and using the Insert File[] script step. The limitation is that the "Store only a reference to the file" option is exposed to the user. Use GetAsText ( ContainerField ) to get the path of the selected file.
June 29, 200619 yr Author thanks for the help... From what i tried, this only returns the file name not path, unless you use "Use Only Reference to file" and then it will in fact return the file size, file path with file name. But that is not an option. these files are 8 meg images in some cases. We do not want to link reference only to them, because then every time you go to that record it takes 15 seconds to load the ref and display the record. Way to slow. or are you thinking of another way?
June 29, 200619 yr Perhaps I am missing a point here: 'Store only a reference to the file' does exactly what it says - it stores only the path to the file (and some auxilliary information about the file). It shouldn't matter if the file is 8 MB or 800 MB. To clarify, the 'Store only a reference to the file' option needs to be turned ON in this case. The limitation I have mentioned is that the user can turn it OFF while selecting the file - resulting in (a) a huge file being inserted into the database, and ( not having the file path and info available.
June 29, 200619 yr Author Not exactly. When you use a container to store only a reference, every time you go to that record, it goes oout and rechecks the reference. And if it is an 8 meg image file it takes forever to check that reference. if ref only is NOT CHECKED, then it makes a small thumbnail of the larger image in the database's container, and then the database updates in almost real time. it is when you reference only an image in a container that we see a huge speed hit. Unless you know of a way to reference a file in a container and NOT show the image. Maybe that would be faster.
June 29, 200619 yr Are you sure about this? I haven't noticed anything similar. It also doesn't seem to make much sense - why would checking a reference depend on the file size? Are you perhaps using Insert Picture[] instead of Insert File[]? That would make Filemaker want to DISPLAY the picture in the container - and THAT might take some time with a big file. I believe that in such case just removing the container field from the layout should speed things up (i.e. create a special layout just for selecting the picture). But inserting a FILE should make even that unnecessary.
June 29, 200619 yr Author That is very interesting. I was in fact use insert picture. Insert file i will try and get back to you.
June 29, 200619 yr Author This may be some progress..... When i insert file(as opposed to insert picture) in a container, and then when i use GetAsText ( container::selectedfile) that function returns: size:1442,1050 image:sirriusopen_rev2_0001.tga imagewin:/G:/Sirrius/shots/SirriusOpen/reference/sirriusopen_rev2_0001.tga Which is very very close! Thank you. But now i need to either PARSE that ouput some how to dump just the path (In this case path would be = "G:/Sirrius/shots/SirriusOpen/reference/" and filename = "sirriusopen_rev2_0001.tga" does that make sense? thank you for your help! Really.... :) Edited June 29, 200619 yr by Guest formatting..
June 29, 200619 yr I need to ask again: are you sure about this? Because when I insert a FILE (as opposed to a PICTURE) into a container field, I do NOT get the size, and the path is in the form "file:... ¶ filemac:...", not "image:... ¶ imagemac:...". Parsing the folder path out can be done by: Let ( [ text = RightValues ( GetAsText ( YourContainerField ) ; 1 ) ; start = Position ( text ; "/" ; 1 ; 1 ) + 1 ; end = Position ( text ; "/" ; 1 ; PatternCount ( text ; "/" ) ) ] ; Middle ( text ; start ; end - start ) )
June 29, 200619 yr Author Yes, sorry... You are right actually. the output has the file: then the filename and then filewin:/ which almost gets me there! I just have to figure out how to parse those two into seperate fields when the path will always be different lengths and such. I have never used the parsing before. I will try your example next.
June 29, 200619 yr Author YES. Your parse gives me the path (which is the second line of the GetAsText. How do i get the file Name which is the first line?
June 29, 200619 yr I don't quite see the need to parse out the folder and filename separately, but you have the formula for the folder path above, and the filename can be: Let ( [ text = RightValues ( GetAsText ( YourContainerField ) ; 1 ) ; start =Position ( text ; "/" ; 1 ; PatternCount ( text ; "/" ) ) + 1 ; end = Position ( text ; ¶ ; 1 ; 1 ) ] ; Middle ( text ; start ; end - start ) )
June 29, 200619 yr Author That works exactly! Thank you. we need to have path and file seperately in order to pass arguements to other visual basic custom functions we use. you helped me so very much. thank you.
July 5, 200619 yr Author So Close. This functionality works but the InsertFile script does not work from a browser.. This database will be an intranet databse, editable from a browser, and I am hoping to find a way to do exactly this but have it work from a browser... any other ideas?
July 8, 200619 yr Newbies This thread just solved another problem for me. I needed to be able to log the name of files imported into the my database. Using this method to acquire the file name, store it in a table and pass it as a variable to the "import record" script command, I will finally be able to log imports. This will also allow me to block duplicate imports since all of the import files have unique names. Thanks Edited July 8, 200619 yr by Guest
July 9, 200619 yr Since you mention Visual Basic routines, why not write an ASP page for the web part? Then you can se all the standard techniques that FM doesn't have and write the result (path, filename) back to filemaker...
January 12, 200718 yr Newbies This works like a charm and saved me at least a weekend of experimenting... thank you so much! :)
Create an account or sign in to comment