Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 1913 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

That would be the small normal script

Copy Field?

Make the field a Button and attach the script (I would also not allow entry in the field.

Maybe if you explained what you were trying to do, I could make it sexier. LOL

Lee

Edited by Guest
Posted

Basically I have a lot of layouts that have entry disabled to prevent accidental altering of the data, and instead have the users use a different 'editing' layout when they want to make changed.

However this also means that you can't just select the field content and copy it to the clipboard, if they want to the paste it into some email or word document the user is writing up. So to get around this the user goes to the 'editing' layout, just to copy the text. I don't like this, it opens the data up to accidental alterations, and adds seemingly unnecessary steps for the user.

So what I would like it to just have the uneditable fields act as a button that when clicked on the content of just that field gets copied into the clipboard so that the user can do whatever they want with it.

The problem I've encountered is that the copy command in scriptmaker either requires the target field to be specified, or it'll copy the whole record. But as I want to do this to something like 50 fields, having to write a different script for each one doesn't sound like fun, plus is bad programing methodology.

Have looked into using a variable, and can get the data i want to be put in a variable, can't figure out how to get that into the clipboard.

Any ideas or pointers greatly welcome.

Cheers,

--Dave

Posted

Isn't that what I just said? :qwery:

You can create a separate layout if you want, but basically, you can lock the field in Layout Mode to not allow entry in Browse. Select the field, and attach the Copy Script step, and you don't have to go into Scriptmaker to do it, you can select it in the Button Setup Dialog.

Lee

Posted

this may also be an appropriate technique

http://www.filemakermagazine.com/videos/copying-merge-fields.html

Posted

You can create a separate layout if you want, but basically, you can lock the field in Layout Mode to not allow entry in Browse. Select the field, and attach the Copy Script step, and you don't have to go into Scriptmaker to do it, you can select it in the Button Setup Dialog.

I did try that, but it copies the whole record into the clipboard (as a long string of useless text noless), and all I want is the content of a specific field.

Posted (edited)

you haven't selected a field.

Lee

BTW, you have only been talking about one field. There have been Topics in the past on this subject, if you are needing to copy more than one field, this would change things.

Other then wanting to paste the contents of a field into the Clipboard, you really haven stated why. Using the Clipboard should be avoided, especially since you could probably accomplish what you are after using one of the others, such as Set Field, Insert Calculated Result, Duplicate Record, etc.

HTH

Lee

Edited by Guest
Posted

Hello HungryDragon,

Using the Clipboard should be avoided, especially since you could probably accomplish what you are after using one of the others, such as Set Field, Insert Calculated Result, Duplicate Record, etc.

For me, I would "copy" or save the value of the record using variables. That would be easier, then if you want to "paste" the value, you can use "Set Field" or other functions...

  • 11 months later...
Posted

I still can't work out a good why to do this. At the moment the only option that works is to make a separate script for every field I want to be able to click on and copy the content to the clipboard. But the programmer in me just hates the idea of replicating almost identical scripts.

Posted

What about a layout that has ALL calculated fields ?

The text inside them can be copied and even dragged and dropped, still preventing accidental altering of data.

Posted

That is an interesting idea, it would work, but would require creating a calculated field for every field on a number of layouts... probably 100 or more extra fields, just so the contents is copyable... I will have to think this one over.

Posted

Hi comment

why not a script of only one step:

Set field [ Table::gClipboard ; Get ( ScriptParameter ) ]

and let the gClipboard field enterable to the user for edit/copy/export ?

Posted

Because that was not the request? True, the Insert Calculated Result[] can be replaced by Set Field[] - it makes very little difference here.

BTW, if you change gClipboard to type Container, it will work with all data types.

  • 2 weeks later...
Posted

Hi Michael,

In your PseudoSetClipoard file, I notice you end with Go To Field [ ]. I know, in older versions of FileMaker, there was no Exit Records/Requests or (now) Commit Records/Requests and so it was pretty common to use; at least I THINK that's what I've understood. But I thought that, now with Commit Records, Go To Field [ ] had been pretty-much dropped.

I am wondering if you have a specific reason for using it (you usually do) or whether it was old habit or simple preference. It seems like a small question but it is still important and if there are any subtle differences on when to use one or the other, I'd love to know it! Both, it seems, removes the cursor from any field and gives up possession of the record. So why use Go To Field [ ] ?

LaRetta :wink2:

Posted

That's a good question. Until you've brought this up, I thought Go to Field[] would exit the active object without committing the record. Which is true, but there's a catch: the action is equivalent to clicking outside any object, so if the layout is set to save automatically, the record WILL be committed; if not, the script will be rudely interrupted by a message asking if you want to save the changes.

Seems like the only way to "deselect all" without committing is to place a dummy non-enterable object (e.g. text or a rectangle) on the layout, and use Go to Object ["dummy"].

Posted

Well, I wondered if a global field took possession of a record. My test shows it does not. If this is correct, no commit would be necessary. BTW, I just opened a new window to test and have not (yet) run it by opening two simultaneous users to a served file. But I believe the results should be the same.

Posted

I just meant that, since the cursor will be sitting in a global field, it won't be necessary to even remove the cursor; why can't it be left there when the script ends? I appreciate the input a great deal, thank you!

Posted

Ah, gotcha ... because to put something onto the clipboard, we need to use Copy[] which requires Select Entire Contents and there is no way to hide it although one could go to another layout and back. I like your concept of using Go To Object ["Dummy" ] instead of layout hopping. One could also make the global field 1 px x 1 px and it wouldn't show at all.

Posted

No, thank you. If you hadn't insisted, I wouldn't have discovered the limitation of Go to Field and the Go to Object ["dummy"] workaround. You have made yet another entry in the "Not in the Manual" document, which I am sure will please you to no end. :)

Posted

It does indeed tickle me! I, like ChindoguMaker, enjoy discovering, uncovering or recovering strange things ... and even BEING strange things! :jester:

  • 10 years later...
  • Newbies
Posted

A really simple way to do it, which was my modification of some of the suggestions, is to create one script that use IF statement branching based on the script paramater passed in.

This worked for me, as I only had a handful of fields on different layouts, etc... My use case was being able to copy email addresses from different areas of the solution.

So for each field I wanted to give the click to copy behaviour, I setup the field as a button, and assigned it my script below, which I created. The script paramater is a string that makes sense (in my case different tables that have the desired field, which might be used on different layouts - so this reduces the number of IF branches).

It copies the field and then selects nothing, so that the field doesn't become editable.

The script I created is as follows:

Freeze Window
Allow User Abort [Off]

Set Variable [$param; Value: Get ( ScriptParameter )]

If [$param = "approvers"]
	Copy [Select; Approvers::Email]
Else If [$param = "contacts"]
	Copy [Select; Contacts::Email]
Else If [$param = "companies"]
	Copy [Select; Companies::Email]
Else
	Halt Script
End If

Go to Field []

Even if there was a reasonably large number of fields, it wouldn't be too big of a job to setup.

Posted

You are replying to a topic from almost 12 years ago. 😉

This topic is 1913 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.