Jump to content

DOH! OLE COM Help!


Recommended Posts

I really wana learn this stuff and I'm reading the manual and I'm getting some good info, but I just need some questions answered.

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler 

; Performing a deliberate failure here (object does not exist)
$oIE = ObjCreate("InternetExplorer.Application")
$oIE.visible = 1
$oIE.bogus 
if @error then Msgbox(0,"","the previous line got an error.")

Exit 


; This is my custom error handler 
Func MyErrFunc() 
   $HexNumber=hex($oMyError.number,8) 
   Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _
                "Number is: " & $HexNumber & @CRLF & _
                "Windescription is: " & $oMyError.windescription ) 

   SetError(1); something to check for when this function returns 
Endfunc

How did you know to use "InternetExplorer" in this line?

$oIE = ObjCreate("InternetExplorer.Application")

Why not "Microsoft Web Browser"?

Is there another source to find the functions of an application? .visible and .bogus, do I really have to goto MSDN to find this information out? I have downloaded OLE/COM Object Viewer and after reading the manual on it I'm more lost than I was before.

Can some one please just point me in the right direction. Don't get me wrong I'm NOT asking for you to hold my hand and write my scripts for me just teach me to fish!

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

Come on now! A little help please!

The COM/OBJ tutorial in the help is a good starting point.

Second, Why is a particular string used to instantiate an object? A search through the registry for InternetExplorer.Application, and "Microsoft Web Browser" then googling on the keys you find will provide an excellent lesson for the motivated student.

Do you really have to go to the vendor who wrote a COM enabled application and find out what properties and methods they have exposed? Yes, unless (1) you use an ide that provides access to enumerated constants (another google search for you), or (2) you crib said values from some other code or documentation.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

I really wana learn this stuff and I'm reading the manual and I'm getting some good info, but I just need some questions answered.

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler 

; Performing a deliberate failure here (object does not exist)
$oIE = ObjCreate("InternetExplorer.Application")
$oIE.visible = 1
$oIE.bogus 
if @error then Msgbox(0,"","the previous line got an error.")

Exit 
; This is my custom error handler 
Func MyErrFunc() 
   $HexNumber=hex($oMyError.number,8) 
   Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _
                "Number is: " & $HexNumber & @CRLF & _
                "Windescription is: " & $oMyError.windescription ) 

   SetError(1); something to check for when this function returns 
Endfunc

How did you know to use "InternetExplorer" in this line?

$oIE = ObjCreate("InternetExplorer.Application")

Why not "Microsoft Web Browser"?

Is there another source to find the functions of an application? .visible and .bogus, do I really have to goto MSDN to find this information out? I have downloaded OLE/COM Object Viewer and after reading the manual on it I'm more lost than I was before.

Can some one please just point me in the right direction. Don't get me wrong I'm NOT asking for you to hold my hand and write my scripts for me just teach me to fish!

if you look under the "Automation Objects" in the OLE/COM Viewer, you'll see the internet explorer object, by highlighting it you see the version independant progid to be InternetExplorer.Application. if you've copied in the dll per the help file, you can then check the idispatch to see the methods etc.
Link to comment
Share on other sites

Great! So I get it a little more

$oTest = ObjCreate("InternetExplorer.Application")
$oTest.Visible = 1
$oTest.Navigate2("www.google.com")
Sleep(3000)
Exit

Now does every Obj have a .Visible? I looked at MediaPlayer and it doesn't look like it...

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

Great! So I get it a little more

$oTest = ObjCreate("InternetExplorer.Application")
$oTest.Visible = 1
$oTest.Navigate2("www.google.com")
Sleep(3000)
Exit

Now does every Obj have a .Visible? I looked at MediaPlayer and it doesn't look like it...

you have to check the inherited methods also. i am pretty sure that the .visible property is part of window class, and all windows (controls are windows too) have it through inheritance.
Link to comment
Share on other sites

you have to check the inherited methods also. i am pretty sure that the .visible property is part of window class, and all windows (controls are windows too) have it through inheritance.

I just looked and double checked. No dice. Give it a whirl for me though and let me know what the deal is.

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

$oTest = ObjCreate("WMPlayer.OCX")
$oTest.Visible = 1
Sleep(3000)
Exit

>"C:\Program Files\AutoIt3\SciTe\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "C:\Documents and Settings\me42457\Desktop\test.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams

>Running AU3Check...C:\Program Files\AutoIt3\SciTe\Defs\Unstable\Au3Check\au3check.dat

>AU3Check Ended. No Error(s).

>Running: (3.1.1.101):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Documents and Settings\me42457\Desktop\test.au3"

C:\Documents and Settings\me42457\Desktop\test.au3 (2) : ==> The requested action with this object has failed.:

$oTest.Visible = 1

$oTest.Visible = 1^ ERROR

>AutoIT3.exe ended.

>Exit code: 0 Time: 0.722

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

Any Ideas on this?

$mp = ("WMPlayer.OCX.7")
;$mp.Visible = True   # Does nothing
$tune = $mp.newMedia("C:\Documents and Settings\me42457\My Documents\My Music\311\311.mp3")
$mp.currentPlaylist.appendItem($tune)
$mp.controls.playItem($tune)
$mp.controls.play()

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...