NOTE: most of the functionality of COM.ahk is now built into AutoHotkey v1.1+ (AHK_L). See the Com functions for more details.
This is a standard library COM.ahk.
It requires at least AHK build 1.0.47.00.
Before downloading, please read first about Standard Library.
(all of these links are unfortunately broken. You can find copies here: http://www.autohotkey.com/board/topic/83238-broken-autohotkeynet-links-updated-5-22-2013/ - Editor's Note)
PREREQUISITE: ComCall via DllCall (Allowing Function Pointer in DllCall)
The usage of COM_Invoke():
If it has the form in VBS-like scripts as
value = Object.Function(param1, param2, ...) ; [color=red]Method, PropertyGet[/color]
it'll be translated like
value := COM_Invoke(Object, "Function", param1, param2, ...)
Object.Function(param1, param2, ...) = value ; [color=red]PropertyPut, PropertyPutRef[/color]
then similarly with the above
COM_Invoke(Object, "Function", param1, param2, ..., value)
However, there exist occasions the above simple form becomes ambiguous. In those cases, can force it to use PropertyPut by appending to the function name the artificial suffix "=" like:
COM_Invoke(Object, "Function[color=red]=[/color]", param1, param2, ..., value)
There are some occasions where another COM Object ObjPrm should be a parameter. In that case, prefix it with "+" like:
COM_Invoke(Object, "Function", ..., "[color=red]+[/color]" . ObjPrm , ...) ; never directly prefix it like +ObjPrm.
As a consequence, "+0" will play the role of VBS Nothing.
And, "-0" will represent VBS missing parameter. For eample
Object.Function(..., param1, , param3, ...)
in VBS-like scripts can be written as
COM_Invoke(Object, "Function", ..., param1, "[color=red]-0[/color]" , param3, ...)
Finally, to control the error message pop-up of COM Library, call
COM_Error(b) ; b := 0/1 for off/on