Jump to content
water

Analyzing COM objects

Recommended Posts

Just for the records:
 
MS provides an easy method to retrieve the methods, properties, events of COM objects by using PowerShell.

  • Open powershell.
  • Create the object. The syntax is:
    $variable = New-object -ComObject "ProgID"
  • Type the variable name to retrieve the properties of the object
  • Use "Get-Member" to retrieve all properties, methods, collections and events of the object

Example: 

$IE = New-object -ComObject "InternetExplorer.Application"
$IE
$IE|Get-Member
PS> $object = New-Object -COMObject "InternetExplorer.Application"
PS> $object

Application          : System.__ComObject
Parent               : System.__ComObject
Container            :
Document             :
TopLevelContainer    : True
Type                 :
Left                 : 309
Top                  : 92
Width                : 1383
Height               : 870
LocationName         :
LocationURL          :
Busy                 : False
Name                 : Windows Internet Explorer
HWND                 : 2361028
FullName             : C:\Program Files\Internet Explorer\iexplore.exe
Path                 : C:\Program Files\Internet Explorer\
Visible              : False
StatusBar            : True
StatusText           :
ToolBar              : 1
MenuBar              : True
FullScreen           : False
ReadyState           : 0
Offline              : False
Silent               : False
RegisterAsBrowser    : False
RegisterAsDropTarget : True
TheaterMode          : False
AddressBar           : True
Resizable            : True

PS> $object|Get-Member

   TypeName: System.__ComObject#{d30c1661-cdaf-11d0-8a3e-00c04fc9e26e}

Name                 MemberType Definition
----                 ---------- ----------
ClientToWindow       Method     void ClientToWindow (int, int)
ExecWB               Method     void ExecWB (OLECMDID, OLECMDEXECOPT, Variant, Variant)
GetProperty          Method     Variant GetProperty (string)
GoBack               Method     void GoBack ()
GoForward            Method     void GoForward ()
GoHome               Method     void GoHome ()
GoSearch             Method     void GoSearch ()
Navigate             Method     void Navigate (string, Variant, Variant, Variant, Variant
Navigate2            Method     void Navigate2 (Variant, Variant, Variant, Variant, Varia
PutProperty          Method     void PutProperty (string, Variant)
QueryStatusWB        Method     OLECMDF QueryStatusWB (OLECMDID)
Quit                 Method     void Quit ()
Refresh              Method     void Refresh ()
Refresh2             Method     void Refresh2 (Variant)
ShowBrowserBar       Method     void ShowBrowserBar (Variant, Variant, Variant)
Stop                 Method     void Stop ()
AddressBar           Property   bool AddressBar () {get} {set}
Application          Property   IDispatch Application () {get}
Busy                 Property   bool Busy () {get}
Container            Property   IDispatch Container () {get}
Document             Property   IDispatch Document () {get}
FullName             Property   string FullName () {get}
FullScreen           Property   bool FullScreen () {get} {set}
Height               Property   int Height () {get} {set}
HWND                 Property   int64 HWND () {get}
Left                 Property   int Left () {get} {set}
LocationName         Property   string LocationName () {get}
LocationURL          Property   string LocationURL () {get}
MenuBar              Property   bool MenuBar () {get} {set}
Name                 Property   string Name () {get}
Offline              Property   bool Offline () {get} {set}
Parent               Property   IDispatch Parent () {get}
Path                 Property   string Path () {get}
ReadyState           Property   tagREADYSTATE ReadyState () {get}
RegisterAsBrowser    Property   bool RegisterAsBrowser () {get} {set}
RegisterAsDropTarget Property   bool RegisterAsDropTarget () {get} {set}
Resizable            Property   bool Resizable () {get} {set}
Silent               Property   bool Silent () {get} {set}
StatusBar            Property   bool StatusBar () {get} {set}
StatusText           Property   string StatusText () {get} {set}
TheaterMode          Property   bool TheaterMode () {get} {set}
ToolBar              Property   int ToolBar () {get} {set}
Top                  Property   int Top () {get} {set}
TopLevelContainer    Property   bool TopLevelContainer () {get}
Type                 Property   string Type () {get}
Visible              Property   bool Visible () {get} {set}
Width                Property   int Width () {get} {set}
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
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

That is pretty ace.

Windows PowerShell
Copyright © 2009 Microsoft Corporation. All rights reserved.
 
PS C:UsersJOHN> $SW = New-object -ComObject "ShockwaveFlash.ShockwaveFlash.11"
PS C:UsersJOHN> $SW
 
 
ReadyState                 : 0
TotalFrames                :
Playing                    : True
Quality                    : 1
ScaleMode                  : 0
AlignMode                  : 0
BackgroundColor            : -1
Loop                       : True
Movie                      :
FrameNum                   : -1
WMode                      : Window
SAlign                     :
Menu                       : True
Base                       :
Scale                      : ShowAll
DeviceFont                 : False
EmbedMovie                 : False
BGColor                    :
Quality2                   : High
SWRemote                   :
FlashVars                  :
AllowScriptAccess          :
MovieData                  :
InlineData                 :
SeamlessTabbing            : True
Profile                    : False
ProfileAddress             :
ProfilePort                : 0
AllowNetworking            : all
AllowFullScreen            : false
AllowFullScreenInteractive : false
IsDependent                : False
 
 
 
PS C:UsersJOHN> $SW|Get-Member
 
 
   TypeName: System.__ComObject#{d27cdb6c-ae6d-11cf-96b8-444553540000}
 
Name                       MemberType Definition
----                       ---------- ----------
Back                       Method     void Back ()
CallFunction               Method     string CallFunction (string)
CurrentFrame               Method     int CurrentFrame ()
DisableLocalSecurity       Method     void DisableLocalSecurity ()
EnforceLocalSecurity       Method     void EnforceLocalSecurity ()
FlashVersion               Method     int FlashVersion ()
Forward                    Method     void Forward ()
FrameLoaded                Method     bool FrameLoaded (int)
GetVariable                Method     string GetVariable (string)
GotoFrame                  Method     void GotoFrame (int)
IsPlaying                  Method     bool IsPlaying ()
LoadMovie                  Method     void LoadMovie (int, string)
Pan                        Method     void Pan (int, int, int)
PercentLoaded              Method     int PercentLoaded ()
Play                       Method     void Play ()
Rewind                     Method     void Rewind ()
SetReturnValue             Method     void SetReturnValue (string)
SetVariable                Method     void SetVariable (string, string)
SetZoomRect                Method     void SetZoomRect (int, int, int, int)
Stop                       Method     void Stop ()
StopPlay                   Method     void StopPlay ()
TCallFrame                 Method     void TCallFrame (string, int)
TCallLabel                 Method     void TCallLabel (string, string)
TCurrentFrame              Method     int TCurrentFrame (string)
TCurrentLabel              Method     string TCurrentLabel (string)
TGetProperty               Method     string TGetProperty (string, int)
TGetPropertyAsNumber       Method     double TGetPropertyAsNumber (string, int)
TGetPropertyNum            Method     double TGetPropertyNum (string, int)
TGotoFrame                 Method     void TGotoFrame (string, int)
TGotoLabel                 Method     void TGotoLabel (string, string)
TPlay                      Method     void TPlay (string)
TSetProperty               Method     void TSetProperty (string, int, string)
TSetPropertyNum            Method     void TSetPropertyNum (string, int, double)
TStopPlay                  Method     void TStopPlay (string)
Zoom                       Method     void Zoom (int)
AlignMode                  Property   int AlignMode () {get} {set}
AllowFullScreen            Property   string AllowFullScreen () {get} {set}
AllowFullScreenInteractive Property   string AllowFullScreenInteractive () {get} {set}
AllowNetworking            Property   string AllowNetworking () {get} {set}
AllowScriptAccess          Property   string AllowScriptAccess () {get} {set}
BackgroundColor            Property   int BackgroundColor () {get} {set}
Base                       Property   string Base () {get} {set}
BGColor                    Property   string BGColor () {get} {set}
DeviceFont                 Property   bool DeviceFont () {get} {set}
EmbedMovie                 Property   bool EmbedMovie () {get} {set}
FlashVars                  Property   string FlashVars () {get} {set}
FrameNum                   Property   int FrameNum () {get} {set}
InlineData                 Property   IUnknown InlineData () {get} {set}
IsDependent                Property   bool IsDependent () {get} {set}
Loop                       Property   bool Loop () {get} {set}
Menu                       Property   bool Menu () {get} {set}
Movie                      Property   string Movie () {get} {set}
MovieData                  Property   string MovieData () {get} {set}
Playing                    Property   bool Playing () {get} {set}
Profile                    Property   bool Profile () {get} {set}
ProfileAddress             Property   string ProfileAddress () {get} {set}
ProfilePort                Property   int ProfilePort () {get} {set}
Quality                    Property   int Quality () {get} {set}
Quality2                   Property   string Quality2 () {get} {set}
ReadyState                 Property   int ReadyState () {get}
SAlign                     Property   string SAlign () {get} {set}
Scale                      Property   string Scale () {get} {set}
ScaleMode                  Property   int ScaleMode () {get} {set}
SeamlessTabbing            Property   bool SeamlessTabbing () {get} {set}
SWRemote                   Property   string SWRemote () {get} {set}
TotalFrames                Property   int TotalFrames () {get}
WMode                      Property   string WMode () {get} {set}
 
 
PS C:UsersJOHN>

Share this post


Link to post
Share on other sites

To be honest, it is something I found on the AHK forum ^_^

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
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

Is it possible to use powershell via command line?

I tried doing it adding $IE = New-object -ComObject "InternetExplorer.Application" as an argument but get ..

"Invalid assignment expression. The left hand side of an assignment operator nee

ds to be something that can be assigned to like a variable or a property."

Share this post


Link to post
Share on other sites

It is possible AFAIK. From the top of my head: Use '-command $IE = New-object -ComObject "InternetExplorer.Application"*


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
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

powershell -command "$IE = New-object -ComObject InternetExplorer.Application; $IE|Get-Member"

or

powershell -command "$IE = New-object -ComObject 'InternetExplorer.Application'; $IE|Get-Member"

work pretty well.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
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

Yep, that's it, cheers.

$Read = ""

$iPid = Run(@SystemDir & '\WindowsPowerShell\v1.0\powershell.exe -Command $SW = New-object -ComObject  "Shell.Explorer.2"' & @CRLF & '$SW' & @CRLF & '$SW|Get-Member', "", @SW_HIDE, 0x2 + 0x4)

While ProcessExists("powershell.exe")
    $Read &= StdoutRead($iPid)
WEnd

ConsoleWrite($Read)

Share this post


Link to post
Share on other sites

A bit shorter:

$Read = ""

$iPid = Run(@SystemDir & '\WindowsPowerShell\v1.0\powershell.exe -Command $SW = New-object -ComObject "Shell.Explorer.2";$SW;$SW|Get-Member', "", @SW_HIDE, 0x2 + 0x4)

While ProcessExists("powershell.exe")
    $Read &= StdoutRead($iPid)
WEnd

ConsoleWrite($Read)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
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

Shorter code...

$iPid = Run(@SystemDir & '\WindowsPowerShell\v1.0\powershell.exe -Command $SW = New-object -ComObject "Shell.Explorer.2";$SW;$SW|Get-Member', "", @SW_HIDE, 0x2 + 0x4)

While ProcessExists("powershell.exe")
WEnd

ConsoleWrite(StdoutRead($iPid))

Share this post


Link to post
Share on other sites

I didn't have to install it on my Windows 7 machine.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
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
PowerShell 1.0
PowerShell 1.0 was released in 2006 for Windows XP SP2, Windows Server 2003 and Windows Vista. It is an optional component of Windows Server 2008.
 
PowerShell 2.0
Windows PowerShell ISE v2.0, an integrated development environment for PowerShell scripts
PowerShell 2.0 is integrated with Windows 7 and Windows Server 2008 R2 and is released for Windows XP with Service Pack 3, Windows Server 2003 with Service Pack 2, and Windows Vista with Service Pack 1.
PowerShell V2 includes changes to the scripting language and hosting API, in addition to including more than 240 new cmdlets.

 

From wikipedia^

Although I'm sure I only have powershell 1.0 on my win 7 pro 32.

Share this post


Link to post
Share on other sites

Check the version by running the following command. Here are my results.

>powershell -command $PSVersionTable

Name                           Value
----                           -----
PSVersion                      3.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.34209
BuildVersion                   6.2.9200.16481
PSCompatibleVersions           {1.0, 2.0, 3.0}
PSRemotingProtocolVersion      2.2

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
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

Mine are a little different.

Name Value
---- -----
CLRVersion 2.0.50727.5485
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1

 

 

Edited by JohnOne

Share this post


Link to post
Share on other sites

I'm running Windows 7 Service Pack 1.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
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

I'm running 64 bit with the latest updates.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
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

Good luck ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-03-26 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-03-21 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
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
Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.18444
BuildVersion                   6.3.9600.16406
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2

 

 

:)

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

  • 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...