grumbachr Posted September 9, 2009 Posted September 9, 2009 I hope this isn't obvious but I have a container that only store a reference to the file. If I double click on the container the file opens but how can I set a button to open the file. I'm not seeing anything in Script Maker to let me do this, I see lots of way to insert files into a container but no way to open them.
comment Posted September 9, 2009 Posted September 9, 2009 See if this helps: http://forum-en.filemaker.com/fm/board/message?board.id=FM-en-4&thread.id=22902
grumbachr Posted September 9, 2009 Author Posted September 9, 2009 (edited) Thanks comment you always seem to have a suggestion and its greatly appreciated. However this didn't work for me because I tried to simplify the question. I could also be complicating a simple problem so here everything. This isn't too complicated but there are a couple details you might find useful. The solution has to work cross platform. All files go into one directory on a server. I noticed that when I insert a file reference into a container that the path is specific to the platform that inserts the file. (Tested via the "GetAsText ( File )" ["File" is my field name] The results of GetAsText (File) looks like this on window and slightly different on a Mac. file:filename.txt filewin://host/Shares/filedirectory/filename.txt Using a calculation (which results in a text field) I'm able to set the path and file name. Here is my calculation. Hope it doesn't look to scary. Let ( [$path = Case ( Get ( SystemPlatform ) = "-2"; "filewin://host/Shares/filedirectory/" ; Get ( SystemPlatform ) = "1"; "filemac:/Shares/filedirectory/" ; "error" ) ; $file =Replace ( GetValue ( File ; 1) ; 1; 5 ; "" )] ; $path & $file ) The results of this calc look something like "filewin://host/Shares/filedirectory/filename" or "filemac:/Shares/filedirectory/filename" So in the end I have a text field with a full path to the file for either platform but since its not a container I can't actually double click on it but was hoping to have a script step that would open the file. FYI: this is done with two fields "File" is a container field File_Path is the calculation resulting in text. Edited September 9, 2009 by Guest additional information.
comment Posted September 9, 2009 Posted September 9, 2009 I am not sure I follow the issue here. I have a text field with a full path to the file for either platform but since its not a container I can't actually double click Why can't you double-click the container field itself - either directly, or through a script?
grumbachr Posted September 10, 2009 Author Posted September 10, 2009 If the file reference is stored while using XP or Vista the path is different than if it is stored using OS X. If the user double clicks the contain from the opposite platform the file will not open, the directory is not found.
comment Posted September 10, 2009 Posted September 10, 2009 Are you sure about this? I would think that if the container has sufficient information to display the file, it should also know how to ask the OS to open it when double-clicked. Or are you saying that the file doesn't always show in the container?
grumbachr Posted September 10, 2009 Author Posted September 10, 2009 I'm not storing the actual file in FileMaker only storing a reference/pointer to the file on a server. I've tested everything multiple times and it does not work. When using the GetAsText to see the path they are different. Maybe its in the way our server is configured. But I've attached a pretty simple file you can test with. The files I'm using are stored on a Window server. Thank you for your efforts.
comment Posted September 10, 2009 Posted September 10, 2009 I am getting more and more confused here. In your original post, you said: If I double click on the container the file opens but how can I set a button to open the file. The suggestion I linked to is to make the button run a script: Freeze Window Go to Field [ YourTable::ContainerField ] [ Select/perform ] Go to Field [ ] I don't see how GetAsText() comes into this.
grumbachr Posted September 10, 2009 Author Posted September 10, 2009 Read the 3 post to this thread were I gave much more detail.
Recommended Posts
This topic is 5553 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