1 post in this topic
Event-based scripting with the windows shell COM object
I want to listen for certain windows events like window open/closed. After reading the help I think I need to use ObjCreate('shell.application') and ObjEvent with that object to create/register a listener. The problem is I don't know what interface or events (i.e. the specific event names) are available for the listener. I tried searching MSDN but it is a labyrinth and I'm not that familiar with the programming frameworks/models used by Windows, and all the examples seem to refer to compiled code using .NET or some other api.
Can any1 point me in the right direction? Also is using COM objects considered the 'modern' way to do this, or should I be using some other framework/resources?
Object Item not exists, how to catch error?
when i try to access an object item, i get an error, but don't know how to catch this error:
Func GetFirewallRule($sName) Local $oPolicy = ObjCreate("HNetCfg.FwPolicy2") MsgBox(0, "test", $oPolicy.Rules.Item($sName)) ; throws error: The requested action with this object has failed. EndFunc Thanks in advance
How can i change the page background color in word
I am trying to change the background color of a page in word document. But i am getting error. This is my code.
Local $owObj = ObjGet("","word.application") If @error Then ConsoleWrite("Obj Error " & @CRLF) Local $odoc = $owObj.ActiveDocument Local $colorArray = [136,151,109] ; Olive Green $odoc.Background.Fill.ForeColor.RGB = _ColorSetRGB($colorArray) $odoc.Background.Fill.Visible = True $odoc.Background.Fill.Solid() If @error Then ConsoleWrite("Error in Color change - " & @error & @CRLF) $owObj = 0 Exit And this is the error msg
Error in Color change - -2147352571 EDIT : I would like to know about using rgb colors in autoit.
How do you make UDF's?
I'm new to scripting and Autoit, but i've already found some things that I would like to create. Where do you start when creating a UDF?
For instance, if I wanted to make a UDF for Excel(I know one exists) Where would I start? What would I need to start researching?
Any input would be appreciated
What's the next step after "QueryInterfac
I already have a COM object. I want to query another interface and call method from that interface. I expect something like this:
Local $pp $app.QueryInterface($tRIID_IServiceProvider, $pp) Bind($pp, $dtag_IServiceProvider) $pp.QueryService(...) in line 3, I want to bind a vtable to this variable (or something similar) but currently there seems no such mechanism.
or something like this:
Local $pp = QueryInterface($app, $tRIID_IServiceProvider, $dtag_IServiceProvider) $pp.QueryService(...) but no such thing either.
The only workable solution I know is the following:
Local $pp $app.QueryInterface($tRIID_IServiceProvider, $pp) Local $provider = ObjCreateInterface($pp, $sIID_IServiceProvider, $dtag_IServiceProvider) $provider.QueryService(...) but apparently there is a duplication for IID_IServiceProvider, which violates the DRY(don't repeat yourself) principle.
Is there any other better solution?