Jump to content
water

Analyzing COM objects

Recommended Posts

Messing around with this powershell, seen ...


Cmdlet          Get-AU3Clip                                        AutoItX
Cmdlet          Get-AU3ControlFocus                                AutoItX
Cmdlet          Get-AU3ControlHandle                               AutoItX
Cmdlet          Get-AU3ControlPos                                  AutoItX
Cmdlet          Get-AU3ControlText                                 AutoItX
Cmdlet          Get-AU3ErrorCode                                   AutoItX
Cmdlet          Get-AU3MouseCursor                                 AutoItX
Cmdlet          Get-AU3MousePos                                    AutoItX
Cmdlet          Get-AU3StatusbarText                               AutoItX
Cmdlet          Get-AU3WinCaretPos                                 AutoItX
Cmdlet          Get-AU3WinClassList                                AutoItX
Cmdlet          Get-AU3WinClientSize                               AutoItX
Cmdlet          Get-AU3WinHandle                                   AutoItX
Cmdlet          Get-AU3WinPos                                      AutoItX
Cmdlet          Get-AU3WinProcess                                  AutoItX
Cmdlet          Get-AU3WinState                                    AutoItX
Cmdlet          Get-AU3WinText                                     AutoItX
Cmdlet          Get-AU3WinTitle

 

 

How to use them? So far only got Get-AU3MouseCursor to show anything worthwhile.
For example...
 
Get-AU3MousePos results in...

                                IsEmpty                                       X
                                -------                                       -
                                  False                                     421

 

 

I can see that X pos may be at 421, but how do I use these properly?

Crikey! all AutoItX appears to be there.

 
Cmdlet          Set-AU3Clip                                        AutoItX
Cmdlet          Set-AU3ControlFocus                                AutoItX
Cmdlet          Set-AU3ControlText                                 AutoItX
Cmdlet          Set-AU3Option                                      AutoItX
Cmdlet          Set-AU3WinOnTop                                    AutoItX
Cmdlet          Set-AU3WinState                                    AutoItX
Cmdlet          Set-AU3WinTitle                                    AutoItX
Cmdlet          Set-AU3WinTrans                                    AutoItX
Cmdlet          Invoke-AU3ControlClick                             AutoItX
Cmdlet          Invoke-AU3ControlCommand                           AutoItX
Cmdlet          Invoke-AU3ControlListView                          AutoItX
Cmdlet          Invoke-AU3ControlTreeView                          AutoItX
Cmdlet          Invoke-AU3MouseClick                               AutoItX
Cmdlet          Invoke-AU3MouseClickDrag                           AutoItX
Cmdlet          Invoke-AU3MouseDown                                AutoItX
Cmdlet          Invoke-AU3MouseUp                                  AutoItX
Cmdlet          Invoke-AU3MouseWheel                               AutoItX
Cmdlet          Invoke-AU3Run                                      AutoItX
Cmdlet          Invoke-AU3RunAs                                    AutoItX
Cmdlet          Invoke-AU3RunAsWait                                AutoItX
Cmdlet          Invoke-AU3RunWait                                  AutoItX
Cmdlet          Invoke-AU3Shutdown                                 AutoItX
Cmdlet          Move-AU3Control                                    AutoItX
Cmdlet          Move-AU3Mouse                                      AutoItX
Cmdlet          Move-AU3Win                                        AutoItX
Cmdlet          Send-AU3ControlKey                                 AutoItX
Cmdlet          Send-AU3Key                                        AutoItX
Cmdlet          Show-AU3Control                                    AutoItX
Cmdlet          Show-AU3WinActivate                                AutoItX
Cmdlet          Show-AU3WinMinimizeAll                             AutoItX
Cmdlet          Show-AU3WinMinimizeAllUndo                         AutoItX
Cmdlet          Wait-AU3Win                                        AutoItX
Cmdlet          Wait-AU3WinActive                                  AutoItX
Cmdlet          Wait-AU3WinClose                                   AutoItX
Cmdlet          Wait-AU3WinNotActive                               AutoItX
Cmdlet          Hide-AU3Control                                    AutoItX
Cmdlet          Enable-AU3Control                                  AutoItX
Cmdlet          Disable-AU3Control                                 AutoItX
Cmdlet          Close-AU3Win                                       AutoItX
Cmdlet          Assert-AU3IsAdmin                                  AutoItX
Cmdlet          Assert-AU3WinActive                                AutoItX
Cmdlet          Assert-AU3WinExists                                AutoItX
 

 

 

Ok, think I got ir.

$AU3 = New-object -ComObject "AutoItX3.Control"
$AU3.MouseMove(10, 10, 10)
AutoItSetOption        Method     int AutoItSetOption (string, int)
ClipGet                Method     string ClipGet ()
ClipPut                Method     void ClipPut (string)
ControlClick           Method     int ControlClick (string, string, string, string, int, int, int)
ControlCommand         Method     string ControlCommand (string, string, string, string, string)
ControlDisable         Method     int ControlDisable (string, string, string)
ControlEnable          Method     int ControlEnable (string, string, string)
ControlFocus           Method     int ControlFocus (string, string, string)
ControlGetFocus        Method     string ControlGetFocus (string, string)
ControlGetHandle       Method     string ControlGetHandle (string, string, string)
ControlGetPosHeight    Method     int ControlGetPosHeight (string, string, string)
ControlGetPosWidth     Method     int ControlGetPosWidth (string, string, string)
ControlGetPosX         Method     int ControlGetPosX (string, string, string)
ControlGetPosY         Method     int ControlGetPosY (string, string, string)
ControlGetText         Method     string ControlGetText (string, string, string)
ControlHide            Method     int ControlHide (string, string, string)
ControlListView        Method     string ControlListView (string, string, string, string, string, string)
ControlMove            Method     int ControlMove (string, string, string, int, int, int, int)
ControlSend            Method     int ControlSend (string, string, string, string, int)
ControlSetText         Method     int ControlSetText (string, string, string, string)
ControlShow            Method     int ControlShow (string, string, string)
ControlTreeView        Method     string ControlTreeView (string, string, string, string, string, string)
DriveMapAdd            Method     string DriveMapAdd (string, string, int, string, string)
DriveMapDel            Method     int DriveMapDel (string)
DriveMapGet            Method     string DriveMapGet (string)
Init                   Method     void Init ()
IsAdmin                Method     int IsAdmin ()
MouseClick             Method     int MouseClick (string, int, int, int, int)
MouseClickDrag         Method     int MouseClickDrag (string, int, int, int, int, int)
MouseDown              Method     void MouseDown (string)
MouseGetCursor         Method     int MouseGetCursor ()
MouseGetPosX           Method     int MouseGetPosX ()
MouseGetPosY           Method     int MouseGetPosY ()
MouseMove              Method     int MouseMove (int, int, int)
MouseUp                Method     void MouseUp (string)
MouseWheel             Method     void MouseWheel (string, int)
Opt                    Method     int Opt (string, int)
PixelChecksum          Method     double PixelChecksum (int, int, int, int, int)
PixelGetColor          Method     int PixelGetColor (int, int)
PixelSearch            Method     Variant PixelSearch (int, int, int, int, int, int, int)
ProcessClose           Method     int ProcessClose (string)
ProcessExists          Method     int ProcessExists (string)
ProcessSetPriority     Method     int ProcessSetPriority (string, int)
ProcessWait            Method     int ProcessWait (string, int)
ProcessWaitClose       Method     int ProcessWaitClose (string, int)
Run                    Method     int Run (string, string, int)
RunAs                  Method     int RunAs (string, string, string, int, string, string, int)
RunAsWait              Method     int RunAsWait (string, string, string, int, string, string, int)
RunWait                Method     int RunWait (string, string, int)
Send                   Method     void Send (string, int)
Shutdown               Method     int Shutdown (int)
Sleep                  Method     void Sleep (int)
StatusbarGetText       Method     string StatusbarGetText (string, string, int)
ToolTip                Method     void ToolTip (string, int, int)
WinActivate            Method     void WinActivate (string, string)
WinActive              Method     int WinActive (string, string)
WinClose               Method     int WinClose (string, string)
WinExists              Method     int WinExists (string, string)
WinGetCaretPosX        Method     int WinGetCaretPosX ()
WinGetCaretPosY        Method     int WinGetCaretPosY ()
WinGetClassList        Method     string WinGetClassList (string, string)
WinGetClientSizeHeight Method     int WinGetClientSizeHeight (string, string)
WinGetClientSizeWidth  Method     int WinGetClientSizeWidth (string, string)
WinGetHandle           Method     string WinGetHandle (string, string)
WinGetPosHeight        Method     int WinGetPosHeight (string, string)
WinGetPosWidth         Method     int WinGetPosWidth (string, string)
WinGetPosX             Method     int WinGetPosX (string, string)
WinGetPosY             Method     int WinGetPosY (string, string)
WinGetProcess          Method     string WinGetProcess (string, string)
WinGetState            Method     int WinGetState (string, string)
WinGetText             Method     string WinGetText (string, string)
WinGetTitle            Method     string WinGetTitle (string, string)
WinKill                Method     int WinKill (string, string)
WinList                Method     Variant WinList (string, string)
WinMenuSelectItem      Method     int WinMenuSelectItem (string, string, string, string, string, string, string, str...
WinMinimizeAll         Method     void WinMinimizeAll ()
WinMinimizeAllUndo     Method     void WinMinimizeAllUndo ()
WinMove                Method     int WinMove (string, string, int, int, int, int)
WinSetOnTop            Method     int WinSetOnTop (string, string, int)
WinSetState            Method     int WinSetState (string, string, int)
WinSetTitle            Method     int WinSetTitle (string, string, string)
WinSetTrans            Method     int WinSetTrans (string, string, int)
WinWait                Method     int WinWait (string, string, int)
WinWaitActive          Method     int WinWaitActive (string, string, int)
WinWaitClose           Method     int WinWaitClose (string, string, int)
WinWaitNotActive       Method     int WinWaitNotActive (string, string, int)
error                  Property   int error () {get}
SW_HIDE                Property   int SW_HIDE () {get}
SW_MAXIMIZE            Property   int SW_MAXIMIZE () {get}
SW_MINIMIZE            Property   int SW_MINIMIZE () {get}
SW_RESTORE             Property   int SW_RESTORE () {get}
SW_SHOW                Property   int SW_SHOW () {get}
SW_SHOWDEFAULT         Property   int SW_SHOWDEFAULT () {get}
SW_SHOWMAXIMIZED       Property   int SW_SHOWMAXIMIZED () {get}
SW_SHOWMINIMIZED       Property   int SW_SHOWMINIMIZED () {get}
SW_SHOWMINNOACTIVE     Property   int SW_SHOWMINNOACTIVE () {get}
SW_SHOWNA              Property   int SW_SHOWNA () {get}
SW_SHOWNOACTIVATE      Property   int SW_SHOWNOACTIVATE () {get}
SW_SHOWNORMAL          Property   int SW_SHOWNORMAL () {get}
version                Property   string version () {get}

 

 

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

@water

$IE = New-object -ComObject "xxxx.xxxxxxxx"
$IE
$IE|Get-Member

Get-Member returning this only not the actual method

1.PNG.bdfc15f1a9b0ea8fe47f21c94e5f6fe6.PNG

using AutoHotkey getting this

d := ComObjCreate("xxxx.xxxxxxxx")
VarType := ComObjType(d)
IName   := ComObjType(d, "Name")
IID     := ComObjType(d, "IID")
CName   := ComObjType(d, "Class")  ; Requires [v1.1.26+]
CLSID   := ComObjType(d, "CLSID")  ; Requires [v1.1.26+]
MsgBox % "Variant type:`t" VarType
    . "`nInterface name:`t" IName "`nInterface ID:`t" IID
    . "`nClass name:`t" CName "`nClass ID (CLSID):`t" CLSID

2.PNG.b4249e73ce7c4d53ea9e1c88a41b346c.PNG

using Autoit ObjName

3.PNG.0cd40c0627255fd585fbe409c6d5296e.PNG

using  @trancexx   TYPELIB Viewer

try with every file in folder (dll,exe,..)

but getting same result

4.PNG.6000dc7a2e64d6b862e07986d3318fa3.PNG

how I can view CLSID, IID & all method with funcation call type......

Share this post


Link to post
Share on other sites

As neither AutoIt, AutoHotkey nor the Typelib Viewer return a result it seems to be a "problem" with the object.
I'm not very familiar with objects of this kind, so I fear I can't help with this problem 😥


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Exit
      For my next project I would like to send files with "alternate data streams" by email in ZIP format.
      I can not use any external program like 7-Zip or WinRAR. (They would fit😥)
      Who knows how to create a ZIP file with "alternate data streams" included with the Powershell command "Compress-Archive"? 
      Here a test script:  (save as "ADSTester.cmd")
      @rem Try to create a zip file with alternate data streams (ADS) included @rem Housekeeping @cls @del ADSTester.zip >nul: @RD /S /Q Extracted >nul: @del ADSTester.txt >nul: @rem End of Housekeeping echo This is the ADSTester.txt file >ADSTester.txt echo This is the ADSTester.txt:Part1 file >ADSTester.txt:Part1 echo This is the ADSTester.txt:Part2 file >ADSTester.txt:Part2 dir /r ADSTester.txt @rem See the 3 files @rem **************************************************************** @rem **************************************************************** @rem Please alter the next lines to include the alternate data streams. powershell Compress-Archive -Path .\ADSTester.txt -Update -DestinationPath ADSTester.zip powershell Expand-Archive -Path ADSTester.zip -DestinationPath .\Extracted\ dir /r Extracted\ADSTester.txt @rem Only one file left :-( pause  
    • By ur
      Which Powershell command in the PowerCLI module for VMware ESX used to interact with UI apps?
       
      When I launch any exe/any exeutable using powercli on guest VM using powercli command.
      Invoke-VMScript, I am able to run them in the background but not in the foreground.
       
      i.e., UI apps are not launching but showing the background as running in the task manager.
       
      We need our UI Automation scripts to execute in the VM, but it is not working.
       
      We are able to do in virtualbox and hyper-v but not in vmware esx using powercli.
       
      Please suggest.
    • By ambad4u
      Hello and Good Day to All!
      I am trying to install .NET 3.5 on Windows 10 x64bit via autoit (via ShellExecuteWait + PowerShell).
      If I run this line, it will runs without issues:
      ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & @ScriptDir & '\OJP83BU523.ps1' & '"') "OJP83BU523.ps1" contains: DISM /Online /Enable-Feature /FeatureName:NetFX3 /All /Source:D:\Sources\sxs /LimitAccess
      However, since I won't know in advance the drive letter of the "sources" folder, I created a script to generate a PowerShell Script to give a correct path for it.
      With the modified script below, PowerShell only blinks and nothing happens
      ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & @ScriptDir & '\' & $filename & '"') or
      ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & $filename & '"')  
      I wish I know the difference with "$filename" and "\OJP83BU523.ps1" usage, as for me, it should be the same.
      Attached is my entire autoit script.
      any help is appreciated!, many thanks in advance!
      test.au3
    • By JLogan3o13
      There are a number of posts on the forum regarding use of Selenium in AutoIt. I recently had a go at using the PowerShell Selenium module, and was amazed at how easy it is. Thought I would post an example here; if anyone is interested this could probably be incorporated into AutoIt code pretty easily. 
      Pre-Req - The true star of this script is the ChroPath extension, available for Edge, Chrome and FireFox. With it installed, you just click on the element, select Inspect, and then ChroPath generates the XPath to the element for you. Here is an example based on a simple form I created on one of my sites.
      $myForm = Start-SeChrome -StartURL "http://logancomputerser.com/Appointment.html" -Maximized $firstName = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_First']" $lastName = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_Last']" $address = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_Street1']" $city = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_City']" $zip = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_Zip']" $state = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//select[@id='formElement_State']" $phoneDay = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_DaytimePhone']" $phoneNight = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_EveningPhone']" $email = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_liamE']" $user = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_48564']" $pw = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_f403c']" $submit = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='wstForm_Contact_Submit']" $reset = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='wstForm_Contact_Reset']" Send-SeKeys -Element $firstName -Keys "Joe" Send-SeKeys -Element $lastName -Keys "Blow" Send-SeKeys -Element $address -Keys "111 S. Main St." Send-SeKeys -Element $city -Keys "AnyCity" Send-SeKeys -Element $zip -Keys "90210" Send-SeKeys -Element $state -Keys "CA" Send-SeKeys -Element $phoneDay -Keys "555.867.5309" Send-SeKeys -Element $phoneNight -Keys "555.888.1212" Send-SeKeys -Element $email -Keys "1Adam12@gmail.com" Send-SeKeys -Element $user -Keys "JBlow" Send-SeKeys -Element $pw -Keys "MyPassword" Start-Sleep 1 Invoke-SeClick -Element $submit Stop-SeDriver -Driver $myForm  
      As mentioned, this is just another way to skin the cat, but I found it a pretty fast way to initiate some easy testing in Selenium, and have used it a couple of times in projects now, both straight through PowerShell and wrapped in AutoIt.
    • By antonioj84
      I need some help with the powershell code below
      #include <AutoItConstants.au3> #include <Array.au3> #RequireAdmin $PS='Get-NetConnectionProfile | Where-Object { $_.NetworkCategory -match "$Public" } | Set-NetConnectionProfile -NetworkCategory Private' $sCommands = "powershell -Command " & $PS &"" $iPID = Run(@ComSpec & " /k " & $sCommands, "", @SW_SHOW , $stdout_child)  
×
×
  • Create New...