Attempt to pass FileMaker cell to KM then pass variable back into FMP Keyboard Maestro 8.2.4
First time post...
Attempting to pass a FileMaker cell to KM then pass a variable back into FMP from KM.
Attached below is my KM Macro I'm working on...
A) To simplify my issue before posting to this forum, I've reduced my variable to only one cell in FileMaker (A cell holding the lastname of the person's record). The goal is to get FMPCell assigned to AppleScriptVariable that gets assigned to KeyboardMaestroVariable. I've managed to successfully write a script within FileMaker Pro Advanced v16 to:
-
Set AppleScriptVariable to the value of specified field/cell in FileMaker.
-
Then within that same script, assign KeyboardMaestroVariable to the AppleScriptVariable value.
FileMaker Script step - Perform AppleScript (Native AppleScript):
-- Set ApplScr Variable from FMP Field
set FMName to "FileMaker Pro Advanced"
tell application FMName
—FOLLOWING FORMAT: set AppleScriptVariable to cell named "FileMakerDatabaseName::FileMakerFieldName" of current record as text
set AppleScriptVariable to cell named "Support FM 55::last" of current record as text
end tell
-- Set KM Variable from ApplScr Variable
-- ignoring application responses
tell application "Keyboard Maestro Engine"
setvariable "KMVariable" to AppleScriptVariable
do script "69CA446B-8892-43D2-94A5-5A30413269CE"
-- or: do script "FMP KM and AppleScript"
-- or: do script "69CA446B-8892-43D2-94A5-5A30413269CE" with parameter "Whatever"
end tell
-- end ignoring
When I run the script from within FileMaker, it assigns the variables and triggers the desired KM Macro.
The KM Macro does its steps. For this simplified example, I have a macro step that updates the KMVariable (ie: as if the KMVariable became "NewValue")
My goal (which I cannot figure out): I NEED to set cell named "Support FM 55::last" of current record (in FileMaker) to the NEW value stored in KMVariable and have it pushed automatically back to the cell in FileMaker.
The closest I've come to a solution is a KM action: Executing AppleScript where it assigns the FMP cell to a text string (BUT I need it to be a variable instead of a fixed text string):
set cell named "Support FM 55::last" of current record to "CanOnlyAssignText"
I want this to work:
set cell named "Support FM 55::last" of current record to AppleScriptVariable
-or-
set cell named "Support FM 55::last" of current record to value of variable "KMVariable"
but neither work.
B) Related, but separate problem... With my current KM Macro, if I select the tasks and click "Try Actions" then my script (the FMP cell "Support FM 55::last" updates to "CanOnlyAssignText") appears as if it is working. But when I run the script from within FileMaker, then the KM Macro works up until it stalling out during the Execute AppleScript step: tell application "FileMaker Pro Advanced"... At that point when hover your cursor over the FileMaker application, you get the spinning beach ball. Two minutes later, it breaks free and FileMaker pops up a display window with the error message:
Keyboard Maestro Engine got an error: AppleEvent Timed Out. (-1712)
I have been learning a lot from this forum browsing through, but I’m stuck and could use your expertise!
Thank you in advance.
-Howard
Tags: Variables, applescript, help, file_maker_pro, filemaker, FMP
FMP KM and AppleScript.kmmacros (7.5 KB)