macOS Services to help write FileMaker code

You can use macOS Services to help write FileMaker code.
(There are many good posts on the internet on what macOS Services are and how they work.)
Files go in the ~/Library/Services/ folder.
Use at you own risk!

You can see a movie with the 2 examples (shown and downloadable below) in this tweet...

FM_Grey_8_wrap_string_2020-08-20.workflow download

FM_Bold_wrap_string_2020-08-20.workflow download

What other macOS Services would be helpful in writing FileMaker code?

1 Like

Nice idea.

I use text shortcuts via the Keyboard->Text prefs pane. The one I use most often is "exitloop", which expands to "let($i = $i+1; $i > $n)".

Could your method place a complete clipping of script steps onto the clipboard or paste it into the script workspace? In this example I'd use

Set Variable [ $n ; Get( FoundCount ) ]
Set Variable [ $i ; 0 ]
Exit Loop If [ let($i = $i+1; $i > $n)  ]
Exit Loop

Thank you.

Pasting in "a complete clipping of script steps" is a different tool/technique.

We used to sell a tool that we call Script Building Blocks...
..that allowed pasting in "a complete clipping of script steps".

We would bring a more modern version of Script Building Blocks (and its siblings) back to market if there was enough interest.

Not sure what is currently available in the "a complete clipping of script steps" market?

In the meantime, macOS services are free!

Hope that helps.

Geist's Generator is free also. You can create your own "Generators". :slight_smile: karbonfm/karbon_Generator.fmp12 at 74cd1956f53f18cd583ec92b7d70565cb526a138 · karbonfm/karbonfm · GitHub

1 Like

Have you seen the extensions you can define yourself for Script Workspace?


If you are using ~ as the Let vars prefix, these 2 .workflows can help debugging.



Lot of other uses for macOS Service > search_and_replace


Another set of free code is FmClipTools, which is found at GitHub - DanShockley/FmClipTools: Tools for converting, modifying, and saving FileMaker Pro clipboard objects. Coded in AppleScript.
Disclaimer: I built most of this, and hope people find it useful.


@DanShockley thanks so much for your work on FMClipTools. It's, by far, the tool I use most, and I'm not even sure I could stand to use FileMaker without them anymore. I also know first-hand multiple other people who use them.

I quietly evangelize about your library whenever I get the chance.

Not sure I've ever thanked you directly, but you've really revolutionized the way I work.


That's good to hear! Thanks for the encouragement. I enjoy building things that make other people's lives easier.

1 Like

I've just downloaded them and installed them in the "no third-party" configuration. I'm not getting anything back when I run them. I do see the gear cog appear in the menu momentarily.

Is there a trick that beginners need to learn, or am I just doing it wrong?

Mac OS Big Sur FMP 19.4

I can't comment on "no-third party" configuration, but IMHO a third party tool like TextExpander/Typinator really enhances FMClipTools. This video desperately needs a re-record (I didn't originally intend it for public), but it shows some of the potential and how to start integrating it with TextExpander.

1 Like

If they worked properly, most of those AppleScripts won't display anything, they just modify the clipboard.
For example, the file "fmClip - Clipboard FM Objects to XML.applescript" just modifies the clipboard so that it contains the text (XML) representation of whatever FileMaker objects you just copied into the clipboard.
So, if you go into a FileMaker script, copy a few script steps (or a whole script, or multiple scripts), then run that AppleScript from the Scripts menu in the menubar, your clipboard will now (also) contains text XML that you can paste into a text document.
Some of the AppleScripts DO present a simple interface. For example, if you run "fmClip - Replace String in FM Objects.applescript", it will ask you for a search string and then a replacement string, which it will then use to modify the FileMaker objects in the clipboard. You could use this to rename a variable in a FileMaker script:

  1. In your FileMaker script, select all steps.
  2. Copy those steps to the clipboard.
  3. Run "fmClip - Replace String in FM Objects.applescript"
  4. Use the old variable (I recommend including the $, for reasons I'll explain below) as the SearchFor string.
  5. When it asks for the Replace With string, type in your new variable name (make sure to include the $ symbol, again).
  6. Back in your FileMaker script, delete the selected steps.
  7. Paste the modified clipboard objects - wherever the old variable name was will now have the new variable name.

One IMPORTANT thing to know is that this replacement does not do any preservation of the XML infrastructure in the objects. So if, for example, you searched for "Field" and changed it to "Bartholomew", the objects in the clipboard would NOT be valid, and either wouldn't paste into FileMaker, or would paste broken/corrupted objects. I haven't tested what kinds of problems that could cause. So, as I suggested above, you really want to make sure you only SearchFor something that is yours, as in, VERY unlikely to be a string that would be contained in the rest of the XML.
If you want to do a more cautious search-and-replace, you could use "Clipboard FM Objects to XML", paste the result into a decent text editor like BBEdit or Sublime, search for the thing you want to change and make sure the only matches are the things you INTEND to change, then search-and-replace in the text editor. Then, you could copy the modified text and use "Clipboard XML to FM Objects" to convert back to FileMaker objects you can then paste back into FileMaker. That's more steps than the "Replace" AppleScript, but can help if you aren't yet sure what kinds of things the XML contains and you don't yet know what to avoid changing.

1 Like

Thanks for the explanations @DanShockley. It's working now, and I'm not sure what changed. I switched FMP off and on again.

I can imagine that doing replacements of TO names would be one of the first uses. Having checked the XML code that is produced I started thinking about how to ensure that I only act on the "correct" objects. Now all I can think of is Buster Keaton.