How to run Amibroker menu commands from inside AFL


I want to run menu commands from inside an AFL script. In particular I want to apply "Pretify Selectgion" to an entire .afl file, from inside another AFL file.

From what I am reading, I need to use SHELLEXECUTE ( ) to run a BATCH (abb file, ).

Is this the way to do it?

"Prettify selection" is a code-reformatting feature that is intended to be used by human during code editing, not by computer behind the scenes when no-one is looking. I don't think AFL should be used to trigger code formatting of another AFL file.

Hello @Tomasz

I understand your suggestion.

In general though, what is the way to execute Amibroker menu commands? Is it with SHELLEXECUTE that runs a BATCH (abb file) ?

Only the functionality provided by OLE interface is intended to be used programmatically.

1 Like


I doubt that I can write it myself, I mean with the OLE object, but what is the command to access the "Prettify Selection" menu? Can it be done?

I think the OLE object is safer to use from a .JS file run from windows/dos.