Create context for CLI

I have ran some tests in CLI and find it really useful. I noticed that certain scripts cannot be run exactly like they were written in the CLI because of there context. An example of this is a script setup to run from a button that would have a function like the followingfunction OnClick(clickData) { mainTab = clickData.func.sourcetab.files DOpus.Output(typeof(mainTab)) }to run it. Of course the "clickData" needs to be passed by a button which is not present here. So with context being the issue here my question is, how could you create a context that could replace something like the OnClick(clickData) part of a script for use in the CLI?

DOpus.Listers.LastActive().ActiveTab will get you an approximation of clickData.func.sourcetab (just change it back to the real thing when you move the code into a button).

Fantastic! Thanks