« Simulating a terminal… | Home | Dutch FileMaker Meetu… »

Insert snippet for FileMaker on Windows

Recently we wrote about adding commands to the contextual menu in FileMaker Script Workspace. That was for MacOS only, but today we have something for the Windows users:


MBS( "HotKey.SetEvaluate"; MBS("HotKey.Register"; "F7"; "control");

"Let ([ 

xml = \"<fmxmlsnippet type=\\\"FMObjectList\\\"><Step enable=\\\"True\\\" id=\\\"89\\\" name=\\\"# (comment)\\\"><Text>loop counting up from 1 to $count</Text></Step><Step enable=\\\"True\\\" id=\\\"141\\\" name=\\\"Set Variable\\\"><Value><Calculation><![CDATA[\\\"/* add count here */\\\"]]></Calculation></Value><Repetition><Calculation><![CDATA[1]]></Calculation></Repetition><Name>$count</Name></Step><Step enable=\\\"True\\\" id=\\\"141\\\" name=\\\"Set Variable\\\"><Value><Calculation><![CDATA[1]]></Calculation></Value><Repetition><Calculation><![CDATA[1]]></Calculation></Repetition><Name>$index</Name></Step><Step enable=\\\"True\\\" id=\\\"68\\\" name=\\\"If\\\"><Calculation><![CDATA[$index ≤ $count]]></Calculation></Step><Step enable=\\\"True\\\" id=\\\"71\\\" name=\\\"Loop\\\"></Step><Step enable=\\\"True\\\" id=\\\"89\\\" name=\\\"# (comment)\\\"><Text>your script steps here</Text></Step><Step enable=\\\"True\\\" id=\\\"89\\\" name=\\\"# (comment)\\\"></Step><Step enable=\\\"True\\\" id=\\\"89\\\" name=\\\"# (comment)\\\"><Text>next</Text></Step><Step enable=\\\"True\\\" id=\\\"141\\\" name=\\\"Set Variable\\\"><Value><Calculation><![CDATA[$index + 1]]></Calculation></Value><Repetition><Calculation><![CDATA[1]]></Calculation></Repetition><Name>$index</Name></Step><Step enable=\\\"True\\\" id=\\\"72\\\" name=\\\"Exit Loop If\\\"><Calculation><![CDATA[$index > $count]]></Calculation></Step><Step enable=\\\"True\\\" id=\\\"73\\\" name=\\\"End Loop\\\"></Step><Step enable=\\\"True\\\" id=\\\"70\\\" name=\\\"End If\\\"></Step></fmxmlsnippet>\"; 

r = MBS( \"Clipboard.SetFileMakerData\"; \"ScriptStep\"; xml ); 

r = MBS( \"RemoteControl.PressControlKey\"; 1 );

r = MBS( \"RemoteControl.PressKey\"; \"v\");

r = MBS( \"RemoteControl.PressControlKey\"; 0 )

]; 1 )"; 0 )

This is an example expression, which registers in one line a hotkey in FileMaker. If you press Control-F7 in Script Workspace, the plugin will put the XML on the clipboard for a loop counting up from 1 to $count. It uses press key functions to press Control-V on Windows to paste the XML right into script workspace.

Please check HotKey.Register and SyntaxColoring.AddContextMenuCommand functions to learn what other expressions you can use. While on MacOS we can use context menu to trigger those commands, you can install them on Windows as hotkeys and do similar things.

FileMaker Plugin
20 11 19 - 11:28

Start Chat