Jump to content

Recommended Posts

I need someone to guide me through my doubts regarding how to use COM commands.

Regarding this statement:

$objWord = ObjCreate("Word.Application"); Create an Word Object

Help file explain as follow:

ObjCreate ("classname", "servername" )
Classname -  The class of the object in the following format:

I pretty confused :D with the explaination(due to no COM experience :"> )

The question is:

- What does classname actually meant? (Is there any connection with the ClassnameNN on the AutoIT spy?)

- For the "appname.objectype", how can I know the appname/objectype? For example, if I want to run the hyperterminal(Win98) or simply other applications? (I think I need more variety of examples other then MS office.) :D

- Is there any link that, I can learn more about COM easiler and faster? :)

Thanks. :huh:

If @error = me Then $sorry
   Until $meClear
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)
Link to post
Share on other sites

- Is there any link that, I can learn more about COM easiler and faster? :)


When you use the COM Object interface you are not interfacing with Windows (meaning the general GUI) as you are with most AutoIt commands. Instead you are interacting with an application-specific programming interface (API).

What is used for ClassName and everything you can do with it after it is instantiated (after you create a link to that application object) is all dependant on the specific applicaiton - many or most applications do not in fact expose an API for us to work with. This is why the Office apps are being used in the examples -- because they have an API and documentation for it is readily available at MSDN and in many shelves of books at your local bookstore.

The Objects, Methods, Properties and Events associated with these Application APIs are all uniquely implemented in the code of the application, so you really need documentation on the API for each application to know what you can do and how to do it. VisualStudio (which calls it "intellisense") and some other IDEs (Integrated Development Environments) can show you the the Objects, Methods and Events associated with the application (assuming you've figured out the ClassName first :"> ), but without the API documentation you can only guess how to use them.

So, going to MSDN and looking at the programming sections for the Office applications is one of the better ways of learning this interface. You can also pick up a book on Office VBA (Visual Basic for Applications) that will get you started (the VBA editor and interface is available inside each of your Office applications -- see Tools, Macro, Visual Basic Editor).

Hope this helps,


Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to post
Share on other sites

If you don't have a IDE but you have Word, you can view objects through VBA object browser. Here's how:

Run Word

Tools > Macro > Visual Basic editor

Tools > References

You will see a list of all registered components (ocx, dll)

Check which ones you want to see such as AutoItX3 1.0 Type Library

Click OK

View > Object Browser

At the top you will see a listbox with the components you checked with the first step. Such as AutoItX3Lib

On the right, you will see all the properties and methods(functions) for the component.

As for knowing how to use them, you will have to do some research since it's specific for each app.

This should work for any VBA enabled app, not just Word. Not sure though.

EDIT: Here is a free OLE/COM viwer, though it's a little advanced:


Edited by steveR
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to post
Share on other sites

You might also look here Scripting Guide for Windows for some examples.

Shell.Application object is a good place to start learning COM.

It can be as easy as this:

$obj = ObjCreate("Shell.Application"); Create a Shell Object
if @error Or Not IsObj($obj) Then Exit;Object creation failed

$obj.MinimizeAll;Minimize all windows
Edited by Trainee
Link to post
Share on other sites
  • 3 months later...

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.

  • Create New...