Making a (specific) field in FileMaker Pro active (for pasting into)

I created a macro that: activates FileMaker Pro; opens a FileMaker database (I could probably just open the file, in which case FileMaker Pro would open, if not already open); select "New Record" in the menu "Records" in FileMaker Pro; type tab twice (to place the cursor in a specific field); insert Text "Start writing now" by Typing; then command-A to select that text so I can simply start typing from scratch. Most of the time, it works, but occasionally, the cursor ends up in the FileMaker Quick Find field.

Based on some exploration of KM macros, and a reply from Peter L. in another topic, it appears the only (mostly, anyway) reliable method is to use AppleScript, to go to the field, or trigger a FileMaker script that goes to that field. I want to make sure I'm not missing anything, in terms of using Keyboard Maestro not being able to do this work, without using AppleScript.

Much better to do most of this with a FileMaker script. For my "BackupDisks" table and setting the field "diskOwner":

Not only will it be more reliable (especially the "select ready for overtyping" bit) but it will mean you can also access the same functionality from FileMaker's Scripts menu, by ⌘-n if it's in your first 10 scripts, by attaching it to a button on your layout, etc.

You could run the script from within your KM macro by keystroke if it's got one assigned in FileMaker, by selecting the menu item, or by AppleScript. The last two are better choices and I've included both below -- pick only one or you'll get 2 new records :wink: You should be able to drop it into your current macro and edit either the menu item name or AS to match your database and script names.

Run Script in FM.kmmacros (3.8 KB)

Image

2 Likes

I changed "FileMaker Pro 18" to "FileMaker Pro" (which is v.19, and resides at /Applications/) in all three actions. When I run the macro with ' Select … from the Menu "Scripts" … ' , and disable ' Execute AppleScript' the macro works as expected. (I think I had to allow access ' Select … from the Menu "Scripts" … ' once, due to macOS 14.6.1 security.)

When I enable the latter and disable the former, I got an error related to "FileMaker Pro 2023.app" (sorry; I didn't take note because I thought I could replicate the error). When I ran the macro again, I get a KM error:

Macro Cancelled
Execute an AppleScript failed with script error: text-script:65:116: execution error.
Not authorized to send Apple event to FileMaker Pro. (-1743). Macro "Run Scrip…

The error message is truncated. When I click "Show", I don't see the (full) error message.

Regrading the initial (one time only) error about trying to access "FileMaker Pro 2023.app" (which is also at /Applications/ (i.e., not nested in a FileMaker folder)), the 2023 version is a trial (I think there is v. 2024 out as well), and I'm not using it, so I deleted it, but I'm (still) getting the above KM error.

In terms of the initial error about "Filemaker Pro 2023", there should be a workaround for that, but it's not currently an issue for me.

Thanks a lot for your script and KM integration. (I used to work in AppleScript a lot.)

Have you allowed fmexstcriptaccess for your user login for that database?

File->Manage...->Security, then "Advanced Settings" and the "Extended Privileges" pane, select fmexstcriptaccess and click "Edit...", then turn on for your account's privilege set.

(May be a different route in your version, so dig around a bit!)

(I used to run FileMaker server, with external authentication to Active Directory, so had experience with "Extended Privileges", but had never used fmextscriptaccesss.) (The route to the location in Security is the same in v.19.)

I started to make the change, was warned that my account had no password (and it had Full Access as well (I know! :slight_smile: )), so I added a password, quit FileMaker Pro, reopened the database with the new password, ran the macro, and got the same error.

I don't think the fact that I added a password should have any effect, but thought I'd mention it.

I'm logged in as "Admin".

Also, I figured out if I click the right angle bracket ">" in the KM error window, I can see the full error message:

Macro Cancelled
Execute an AppleScript failed with script error: text-script:65:116: execution error.
Not authorized to send Apple event to FileMaker Pro. (-1743). Macro "Run Script in FM" cancelled (while executing Execute AppleScript).

If there is an issue with using the Execute AppleScript action due to my environment, I can simply use the version that selects the script from the Scripts menu, since that works.

thanks

Try System Settings->Privacy & Security->Automation, open the "Keyboard Maestro" section, see if there's a FileMaker entry and if it's switched on.

1 Like

Bingo! Thank you so much.