« The annoyance of Non-… | Home | MBS FileMaker Plugin … »

Define hot keys for functions in the FileMaker development

If you call this on start of solution (in development mode), you register a hotkey Control-F5 to write a text file with contents of data viewer into a text file on desktop. Useful for a quick copy to later compare values:

 

MBS( "HotKey.SetEvaluate"; 

MBS("HotKey.Register"; "F5"; "control")

"MBS( \"Text.WriteTextFile\"; 

MBS( \"FM.DataViewerContent\" ); 

MBS( \"Path.AddPathComponent\"; 

MBS( \"Folders.UserDesktop\" ); 

\"Data Viewer \" & substitute(substitute(Get(CurrentTimestamp); \":\"; \"-\"); \"/\"; \"-\") & \".txt\" ); 

\"UTF-8\" 

)"

) 

 

The samer function can work with ScriptWorkspace.ScriptText to write current script to a folder of your choice. Here is an example:

 

MBS( "HotKey.SetEvaluate"; 

MBS("HotKey.Register"; "F6"; "control")

"MBS( \"Text.WriteTextFile\"; 

MBS( \"ScriptWorkspace.ScriptText\" ); 

MBS( \"Path.AddPathComponent\"; 

MBS( \"Folders.UserDesktop\" ); 

\"Script \" & substitute(substitute(MBS( \"ScriptWorkspace.CurrentTab\" ); \":\"; \"-\"); \"/\"; \"-\") & \".txt\" ); 

\"UTF-8\" 

)"

) 

Run once and you can press the hotkey to write current script to a folder, which you can track for version tracking. If you prefer XML, use menu commands to do select all(Menubar.RunMenuCommand with ID 57642) and copy content to clipboard (menu command 57634). Then use Clipboard.GetFileMakerData to read XML and write to file.

 

 

PS: You like to get formulas formatted like above? Simply copy them with Command-Option-C or use SyntaxColoring.Format function in your script. 

15 11 19 - 13:40