Question

A colleague of mine claims that you cannot early-bind COM objects in AutoIt. Is this true?

Was it helpful?

Solution

AutoIt is an interpreted language even when compiled. The actual process of compiling is simply embedding the code in the interpreter (with some preprocessor elements sorted out like includes).

As a result, binding can not be done at compile time, as there is no compile time. This means that the following will compile fine and no error will be detected.

$oShell = ObjCreate("shell.application")
If False Then ConsoleWrite($oShell.LolWut & @LF)

Run that and nothing will happen. $oShell.LolWut will never be evaluated and so there is no error. Try it with the if test executing the statement and you get: The requested action with this object has failed.

Edit: Also note the reply here for more details on implementation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top