iwasnevy Posted November 28, 2008 Posted November 28, 2008 (edited) I'm trying to simply copy a field's entry to the clipboard. I've tried a bunch of different ways, but none of them work because the field who's contents I want to copy are not displayed on my layout! I've got a calculation field set up which calculates a filename (to be pasted by the user) based on the entries in two name fields and an ID field. This calculated field does not show on my layout. The calculation works fine - the entry it's calculating is correct. I've set up a simple script to copy the contents of this field, but it only works if that field is showing on the layout. If the field isn't showing, what it copies is really odd - it appears that it's copying the contents of the fields that are being calculated from in addition to the contents of the calculated field! I've tried just about every way I can think of and see in the scripting window, but I get mixed results depending on how I'm doing it. This should be simple! HELP! A sample file is attached copy_calculated_filename.zip Edited November 28, 2008 by Guest
Ocean West Posted November 28, 2008 Posted November 28, 2008 You could use goto object if you have the field named, however copy commands require the field on the layout and it could be 1px by 1px 1pt text and colored to match your background and turned off so people cant tab or click into it. The script is: Go to Object [Object Name: "theField"] Copy Go to Field [] copy_calculated_filename.fp7.zip
comment Posted November 28, 2008 Posted November 28, 2008 See also: http://fmforums.com/forum/showtopic.php?tid/191757/post/309252/#309252
iwasnevy Posted November 29, 2008 Author Posted November 29, 2008 Thanks for your help - I ended up doing just that - a 1px by 1px field. The problem with that is that if I ever need to go in and change something (about that field) on the layout, I can't see it! I've found myself frustrated more than once now with the fact that a field has to be on the layout to be able to do anything automated with it's data. (I know calculations etc are done on the backend, but every time I've had to 'do' anything with the data, it has to be on the layout.) I just got done writing an applescript to "show in finder" the file the record refers to. The path and filename are calculated by a second field specifically for this script to access. The script breaks if the field is not on the layout. So now that's two 1px by 1px fields on my layout that I can't see. You would think that FM would accomodate "back end" access to the data specifically for scripting, set field, copying etc, especially since alot of the scripting I can think of would involve calculated fields, ID numbers - fields you wouldn't even want the end user to be aware of. I'm just a little dissapointed that I have to use "tricks" to get something like this done. Maybe it's time for a feature request? Anyway, thanks for the help! I appreciate it!
comment Posted November 29, 2008 Posted November 29, 2008 I ended up doing just that - a 1px by 1px field. That wouldn't be my preferred choice. I suggest you return to the thread I linked to. I've found myself frustrated more than once now with the fact that a field has to be on the layout to be able to do anything automated with it's data. That is far from being a fact. Only editing steps (copy, paste, etc.) require a field to be on the layout. In most automated actions you would avoid these. And if you are OS X only, you can use Applescript to set/get the clipboard directly, without Filemaker's limitations.
LaRetta Posted November 29, 2008 Posted November 29, 2008 Ah, no, listen to Comment on this one! But, as for using a very small (or invisible) object, type text on the layout and set it (using conditional format) to turn background color in browse mode: not Get ( WindowMode ) When you drop into layout mode to design, your note will point to it as <--- here is small button But please follow Michael's advice ... if the cursor is in that field and User types, it will be quite obvious and silly.
iwasnevy Posted November 29, 2008 Author Posted November 29, 2008 (edited) Thanks all Commit - This is not my first choice of a way to handle this either. I had run across that thread previously and tried that method, but (if I remember correctly - am I wrong?) that method required the field to be on the layout as well. You're right, I was not stating fact - in fact, I'm too new to this to completely understand what FM is and is not capable of. This just seems to be the case in the two things I'm trying to get done. I'm learning... I appreciate your help. LaRetta, that's a great way to handle my concern about not being able to see the field when editing the layout. Thank you. What I would like is a way to retrieve data from a specific field in the current record without the field having to be on the layout. We're cataloging video files, and the two things I'm currently trying to accomplish are 1) copy a field's contents to the clipboard via a button (for renaming a file in finder - I'm making filemaker calculate the name I will assign to the file - ie: "lastname_firstname_id.mp4" based on it's record in FM) , and 2) pass a field's contents (the filename) to an applescript to show the file in Finder. (for use later when looking up a video entry - to make it easy to find the file it references.) BTW, Sorry if Itook a negative tone - I was frustrated earlier! FM seems to be a very powerful program, but it seems that I'm uncovering some of it's limitations. I'm all better now... : Edited November 29, 2008 by Guest
comment Posted November 29, 2008 Posted November 29, 2008 FM seems to be a very powerful program, but it seems that I'm uncovering some of it's limitations. Rest assured you'll have plenty of opportunities for frustration when you run into some REAL limitations of Filemaker. Right now you're struggling with an imaginary one: as I said, with Applescript you can set the clipboard directly to a field's contents - without the field being on the layout. The purpose of the file I posted in the other thread is to present a cross-platform solution, using only Fliemaker's native tools. For this, the intermediary field gClipboard must indeed be on the layout - or rather on a layout. Since this is a global field, it can be placed anywhere you like and it can be reused from any context - so this is hardly a real obstacle.
Recommended Posts
This topic is 5839 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