I have been learning scripting in Maya and so far so good.
One thing I would like to do is execute very simple .mel script files externally, with the goal of them changing something in a existing maya window. Very similar to how THIS VSCode extension for Maya Mel script works.
Here is a video example of the extension:

I want to use this with AutoHotkey, a programming language suited for keyboard and mouse automation, to do something like:
Capslock & f:: ; when Capslock and f are pressed run the mel file "c:\temp\Layout4.mel". Which will change the active maya layout
Run, c:\temp\Layout4.mel
I know I can assign the above function to a keyboard key internally in maya. I have done that and I am now finding it to be limited. I do this with many other software's such as adobe Illustrator and Photoshop which let you execute arbitrary code in .jsx files externally, which will have an affect on the open document.
The few things I have tried while a maya window is open are:
- Double clicking a
.melscript file in file explorer - in PowerShell invoking
Maya 'c:\temp\Layout4.mel' - in PowerShell invoking
Maya -script 'c:\temp\Layout4.mel' - in PowerShell invoking
Maya -command 'c:\temp\Layout4.mel'All of the above just lead to the creation of a new maya window that eventually open a new empty scene.
the only thing that worked was dragging c:\temp\Layout4.mel and dropping onto a maya window. The current layout instantly changes to 'Layout4'. Thats what I want but rather than drag and drop, just executing .mel file.
Any help would be greatly appreciated. Thanks.