Copy and Paste from a script or manually?
There are known limitations/drawbacks to doing copy/paste as part of a script.
Manually most of the time, but it happens in both. I had to use Copy and paste in a script because Set Field doesn't work all of the time. It maybe I'm doing something wrong with Set Field but why does it work in one script but not in another. I always commit record after Set Field!?
Draw backs to using Copy and Paste from a script:
1) The referenced fields must be present on the current layout. If not, the script will "fail silently". (Script execution is not interrupted and no error dialog appears.)
2) Using Copy replaces any data the user has currently copied to the clipboard with data it copies.
Set Field avoids both issues and is quite reliable.
When you copy manually, is there any chance that one of your scripts that uses copy is replacing the data you copied with what it copied (Item 2)?
98% of the situations where a script uses copy and paste, Set Field and/or Set Variable is the better alternative.
Ditto what Phil says. I purged my business solution of copy and paste steps entirely. There were literally hundreds of instances if counting sub-scripts etc. and dozens of little scripts that did nothing but copy and paste. Learning to use ScriptParameter, SetVariable and SetField, among other steps, is something that, had I done it earlier, would have saved tons of time, not to mention the odd sneaky and silent error that would crop up. Also, scripts using the optional ScriptParameter together with Get(ScriptParameter) are more universal in that the same script can be triggered by menus or buttons or whatever with a different script parameter for each context.
Thanks Folks, I hear what you're saying. I agree that their are issues with using copy and paste however it seems to be the only thing that works. Set field simply doesn't go anything when trying to lookup a record via a relationship using a script. I think my lack of knowledge with the alternatives is the issue here. I will try and read up a bit more about the various other methods you have mentioned to see if I can work around the usage of copy and paste. If you have any pointers that would be helpful.
Feel free to post an example of "trying to lookup a record via a relationship using a script" where set field isn't working for you. We can probably suggest a way to use either script parameters or set field with a global field to do what you want.
This is driving me nuts.
I've been using for FMPro since V3...(perhaps even earlier).
This started about a year ago or so...and I've lived with it, but I jut can't any more.
Copy just doesn't work!
Manual copy (and also in scripts). Sometimes there is no problem at all, other times (most of the time) I have to hit Copy 20 times (yes 20) for the field to copy into the clipboard. My db is a flat file, and I just copy fields between records.
Usually, just hit CNTL C, and field should copy. Nah. And, you don't know if the field copied properly, unless you go to menu and look if the Paste menu item is black (and not grey)...so, just copy from menu item - doesn't make any difference. It's a hit or miss affair.
I even created a button to do Copy - but that made no difference.
I'm now on V11 Pro and V11 Server. Same thing happened with V7 Pro and V7 Server (I jumped versions). Even tested without Server (opened file locally, same thing). Thought it was my PC, but no, happens on other PCs. Thought it was Vista, no, it happens on Win7. Differnent PCs, different OS's, and even with different Dbs's (thought I'd test different db's as well, just in case). The OS is fine with copy/paste. Every other app is just fine. FMPro just isn't.
Could it just be me that this is happening to? Of course, it's not, since the OP (in 2009) says it was happening to him as well.
Any hints to fix this would be appreciated very gratefully...
I'm glad I did a search for this! I just started noticing this 'bug' about two months ago. Some days it's a NON-issue and other days...like today when I have ten thousand things I need to do...it's a constant.
I hadn't realized the power of Set Value though until today. I'm a 'learn as I go' user of Filemaker and have built beautiful tools but credibility is lost when something as simple as Copy and Paste fails.
I'm glad that it appears to be something common but concerned that it's been happening for years and yet there seems to be no fix. Any idea on how to submit these issues to FMP?