Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Hello all,

I need to copy/paste single contact record info out of filemaker and into the mac clipboard.

To do this I've created a calc field to concatenate the various fields into an organized text string with line breaks.

I have a little script to put the contents of said calc field into the clipboard.

So far so good.

Here's the thing I can't figure out: related fields - specifically tel numbers and the tel number tags stored remotely and called in by a contact ID number relating the files to each other.

How can I get all the related records (list of telephone numbers with tags) into my calc field for pasting?

Thanks so much for your help.

Posted

You don't necessarily need a calc field, you can calculate the AppleScript like so:

"set the clipboard to " & Quote( contacts::name & " " & contacts::etc )

To get the related info, if it was just one field, you could use the List function. With two fields, you could create a calc field in the related file that concatenates the two and then use List on that. Or, you could script it using a Loop:


Set Variable( $count ; Count(related::phone) )

Set Variable( $i ; 0 )

Loop

  Set Variable( $i ; $i + 1 )

  Exit Loop If ( $i > $count )

  Set Variable ( $text ; $text & ¶ &GetNthRecord( related::phone ; $i ) & GetNthRecord( related::tag ; $i) )

End Loop

Posted

Fitch

Thanks - I'll take a look at the List function.

By "AppleScript" do you mean just that - AppleScript outside of FileMaker? It's been a while since I messed around with that! :)

Posted

No, he means AppleScript inside FileMaker, using the Perform AppleScript step, which can accept either a FileMaker calculation field or the text of the AppleScript (which is then compiled upon closing the window). If you use a calculation field, then you must escape any quote marks that you want to pass to AppleScript, include returns where necessary, etc..

In other words, AppleScript transcends the boundaries of applications (kind of mystical :)-), especially in FileMaker's case, which can contain the AppleScript code within one of its objects (I don't know of any other app that can do this, though some are "recordable," which is a whole 'nother thing).

Basically you'd be using it to set the clipboard directly, rather than using a Copy step; which you also could do.

Posted

Another place you might want to look is at Brian Dunning's Custom Functions list.

http://www.briandunning.com/filemaker-custom-functions/list.php

There is one called "GetRows" (also requires "GetNthRow") which can produce a text result of what is in a portal, multiple fields, multiple lines, without having to create a concatenated calculation field. You can even use a tab separator, if you copy/paste one in.

Posted

Ah - of course. I remember dabbling with embedded Applescript years ago.

The add-on function looks promising - thanks for that link. :)

Posted

OK my friends - thank you so much for your help. The custom function is workin' like a charm.

Except... I'm stuck on the following:

Is there a way to define N in the above function dynamically? The portals the function is reading from don't have a predicable number of records shown. I'd like to copy all of them each time the function is invoked.

This topic is 6141 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.