1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

METHODLIST.BTM - List Methods for an ActiveX (COM) Object

Discussion in 'PowerShell' started by Joe Caverly, Jul 22, 2013.

  1. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    680
    Likes Received:
    8
    Code:
    ::--------------------------------------------------------------------
    :: METHODLIST.BTM
    ::
    :: List Methods for an ActiveX (COM) Object from the CLI
    ::
    :: TCC 15.01.52
    :: 2013/07/22
    :: Joe Caverly
    ::
    :: TODO: Error checking of command line arguments, misc. stuff.
    ::--------------------------------------------------------------------
    @setlocal
    @echo off
    
    iff %# eq 1 then
      gosub psscript
    else
      echo USAGE: methodlist msscriptcontrol.scriptcontrol
      echo        methodlist shell.application
      quit
    endiff
    
    if exist methodlist.ps1 del methodlist.ps1 > nul
    
    :: Pipes are used in the PowerShell Script,
    ::   TCC does not like this.
    ::   Disable | and treat it like text.
    setdos /X-5
    
    do i = %start to %end
      echo %@line[%_batchname,%i] >> methodlist.ps1
    enddo
    
    powershell methodlist.ps1
    
    if exist methodlist.ps1 del methodlist.ps1 > nul
    endlocal
    quit
    
    :psscript
    set start=%@eval[%_batchline+1]
    text > nul
    $Method = New-Object -ComObject %1
    $Method | get-member
    endtext
    set end=%@eval[%_batchline-3]
    return
     

Share This Page