Dev Tool to Go to Layout by LayoutID

Here is a “Fun FileMaker Fact” beta…a (macOS only) tool to go to Layout by LayoutID.

image

Here is the AppleScript...

tell me to activate
display dialog "Layout ID?" default answer "Enter Layout ID" buttons {"OK", "Cancel"} default button "OK"
set layout_id to the text returned of result
-- set layout_id to layout_id as integer
tell application "FileMaker Pro Advanced"
go to layout ID layout_id
end tell

You will need to check the "Allow Apple events…" Extended Privilege.

2 Likes

I don’t understand why you want to use AppleScript for this when FM has everything you need!?

Go to Record [ By number: ValueCount( Left ( LayoutIDs(“”) ; Position( “¶“ & LayoutIDs(“”) & “¶” ; “¶“ & $LayoutID & “¶” ; 1 ; 1 ) ) ) ]

(Posted on an iPhone - Calculation may not be :100:%! - but it’s the idea that counts!)

Not to mention of course that I’m not sure why you’d want to do this!

We often do clean-up work on multi-file solutions built by others...where we are removing unused Layouts, Scripts, etc.

Rather than add a FileMaker Script to each File, we simply run the AppleScript from the AppleScript menu and it works on the frontmost File.

The LayoutID comes from MBS Plugin or a DDR tool.

On the other hand, sometimes we do add a FileMaker Script to each File that we call with an FMP URL that takes us to the File, Layout, and Record(s)

Different approaches for different use cases. Both good.

Fun!

I'm wondering about the use case too.

My standard library of custom functions includes GetLayoutNumber(layoutID). Internally it looks a lot like the code you posted. It didn't get much use until recently.

I'm playing with a webviewer navigation tool that uses the filemaker/javascript integration. It passes Layout or Script IDs to a script which then uses the CF to decide which layout to display. This is a case which would not work with Layout/Script names ( not unique ). Nor would it work with Layout/Script number ( subject to change ), so the use of ID is necessary.

Even so, I don't want to use AppleScript to resolve the problem. :stuck_out_tongue: