I'm aware the documentation says not to use OLE from within Amibroker.
I'm also aware of threads that say it's ok as long as you know what you're doing.
I'm likely one of those that do not know what I'm doing. Please help.
I've got this function, it's working up until line 108. ie I'm able to get the COM object, iterate through documents ( funny enough getting active doc or window doesn't do anything ), find windows, zoom windows to a predefined date range programmatically.
What I would absolutely love to do is to programmatically take a screenshot of the window once it's zoomed.
At the moment, logging stops at "Before image export" then the program fails silently.
I'm able to do this with JScript from outside amibroker as per reference manual but do not yet know/want to fiddle with setting it up to programmatically take screenshots of 400 trades over multiple windows ( different t/f ).
The questions are:
Is there a way to take a screenshot programmatically from within amibroker itself?
If not, what is the easiest way to setup a loop to do this for a csv of trades from outside of amibroker?
You could do that only for chart that is NOT the one that currently executes the formula that contains ExportImage. Otherwise you are creating infinite loop/lockup (your formula executes->Export image causes another execution->your formula executes->Export image causes another execution that again causes Export image -> ad infinitum).
And I think my problem is that ALL my charts are floating... doh!
Once I moved them to being normal, ActiveDocument, Document.Name, ExportImage started working on those windows.
Now I'm trying to work out how to keep my floating windows, whilst taking multiple timeframe screenshots of these in non-floating/normal windows, but that's a much easier problem to solve!
After some tinkering, I realised that nircmd doesn't do exactly what I needed, they have the ability to crop and to do all monitors but not both sadly ( ie you can't do screenshotfull <filename> 1920 0 1920 1080 to get the second monitor from the left )
However, ImageMagick does so I swapped it out with the cmd below. What I learned was ShellExecute!
Very rough POC but what I needed was the ability to specify the 3rd monitor which will become a parameter in the forumula. Thank you @PeterD ! Very happy with the results.