Rikk_2004 Posted June 28, 2006 Posted June 28, 2006 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. :)
Lee Smith Posted June 28, 2006 Posted June 28, 2006 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
Rikk_2004 Posted June 29, 2006 Author Posted June 29, 2006 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.
Lee Smith Posted June 29, 2006 Posted June 29, 2006 Use the [color:blue]Get ( FilePath ) function in a calculation field. Lee
Rikk_2004 Posted June 29, 2006 Author Posted June 29, 2006 (edited) 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, 2006 by Guest
comment Posted June 29, 2006 Posted June 29, 2006 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.
Rikk_2004 Posted June 29, 2006 Author Posted June 29, 2006 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?
comment Posted June 29, 2006 Posted June 29, 2006 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.
Rikk_2004 Posted June 29, 2006 Author Posted June 29, 2006 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.
comment Posted June 29, 2006 Posted June 29, 2006 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.
Rikk_2004 Posted June 29, 2006 Author Posted June 29, 2006 That is very interesting. I was in fact use insert picture. Insert file i will try and get back to you.
Rikk_2004 Posted June 29, 2006 Author Posted June 29, 2006 (edited) 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, 2006 by Guest formatting..
comment Posted June 29, 2006 Posted June 29, 2006 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 ) )
Rikk_2004 Posted June 29, 2006 Author Posted June 29, 2006 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.
Rikk_2004 Posted June 29, 2006 Author Posted June 29, 2006 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?
comment Posted June 29, 2006 Posted June 29, 2006 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 ) )
Rikk_2004 Posted June 29, 2006 Author Posted June 29, 2006 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.
Rikk_2004 Posted July 5, 2006 Author Posted July 5, 2006 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?
Newbies W. Jack King Posted July 8, 2006 Newbies Posted July 8, 2006 (edited) 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, 2006 by Guest
Wim Decorte Posted July 9, 2006 Posted July 9, 2006 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...
Newbies MxStang Posted January 12, 2007 Newbies Posted January 12, 2007 This works like a charm and saved me at least a weekend of experimenting... thank you so much! :)
Recommended Posts
This topic is 6525 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