For this yes! But not always. For e.g. this KB.
By using single-line syntax-es I was annotating that I am calling the object's methods and properties but unable to capture ActiveDocument or ActiveWindow Index directly. I also wrote:
in order to portray that I am using those properties.
Most certainly, it will throw an error if used in a single-line, because a new instance of the called objects needs to be created first, before calling its methods
or properties
(by using a period .
). Since, in AFL's OLE model a =
already serves the purpose for the keyword new
generally seen in other languages.
Purpose of my first post (in this thread) remained same always.
First Line:
Last Line:
Had I posted a "one line" query, it would have been inappropriate on my side for not explaining and might have been deemed SMS style. Thus, I went for a crisp & short explanation in between the first and the last line, instead of stretching the post and remained focused on expressing the actual issue.
Those short code phrases were used as part of sentences for the reader to have a gist of what the poster was trying to convey.
The reason for the syntax error was because it was calling a property (Name
) of ActiveDocument
instead of setting (assigning) that and not for stating it as a single-line as shown in the above mentioned KB.
Intention was to share that I am getting Error 30, since, I am referencing a property. And subtly asked a question, "Is there a way to retrieve (get) the value of this property, in similar fashion when I assign (set) it?", without making it look redundant as the same question was already asked (directly) before in the first line itself.
If I sat down to explain everything in the first post itself and wrote all that I tried, tested and their errors; then it would have deviated (unnecessarily) from the main purpose of a simple one-liner query. I had no way of knowing beforehand which error, you were going to point out in future. So, Error 18 (like many other) was not mentioned.
I wrote:
because you specifically pointed out (respect that) what I had tried earlier. Thank you (I mean that)!
FWIW, evidently there is no direct method to capture ActiveDocument or ActiveWindow Index using OLE. Because if there was, then you would have already solved it generously like you usually do.
Heard of Master/Slave HDDs! But first time (no second time) reading about such a concept "even" for charts in "AmiBroker" - on both the occassions from you (no KB).

Good hint! Thank you very much for looking into this. Anyways, using OLE would have been more direct (and simpler) in this scenario, something like, Ab.ActiveDocument.Item
or Ab.ActiveWindow.Item
, isn't it?