Jump to content

Recommended Posts

COM makes it possible :) Download the special AutoIt Version

$objWord = ObjCreate("Word.Application"); Create an Word Object
if @error Or Not IsObj($objWord) Then Exit;Object creation failed

$objWord.Visible = 1 ;Show the Microsoft Word Window
$objWord.Documents.Add ;New blank document

$objWord.Selection.Font.Size = 50
$objWord.Selection.TypeText("This is 50 pt text" & @CRLF)

$objWord.Selection.Font.Size = 32
$objWord.Selection.Font.Color = 255
$objWord.Selection.TypeText("This is red text")

$objWord.Quit   ; Get rid of Word

I used the following sites to find thsee few commands

http://cuinl.tripod.com/Tips/off1.htm

http://pubs.logicalexpressions.com/Pub0009...icle.asp?ID=160

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to post
Share on other sites

Damn... Do you think that when the COM is an official realese, the devs who can use it will give a more detailed way on how to use COM support? Because I really want to know how! But I don't know where to start... :) Sorry for being off topic.

FootbaG
Link to post
Share on other sites

Thanks for the quick reply CyberSlug. Sorry to trouble you but I had some other questions as well.

How would you make some text underlined,italic, or bold? I tried using the following but no luck:

$objWord.Selection.Font.Underline

$objWord.Selection.TypeText("Test" & @CRLF)

Also is it possible to insert a picture into the word document? Is there somewhere I could go to view all these "Com" related commands?

Link to post
Share on other sites

@CyberSlug, When I try your code, it doesn't seem to do anything... =/ I have the latest beta fromt he dev section, but I don't get any errors or anything, it just doesn't do anything, and the quits. I even tried opening Word first, but nothing, does it save it to a file? Because if it does, then I can't find it, but by looking at the code, it obviously doesn't... Any siggestions?

Thanks! :)

FootbaG
Link to post
Share on other sites

That's exactly what I did :) I'm running Windows XP Home Edition... Oh please oh please oh please I hope COM works on here... If it doesn't I swear I'm going to call Microsoft and raise hell, just for no reason! :D

FootbaG
Link to post
Share on other sites

Do you have office installed?

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to post
Share on other sites

I have Microsoft Works with a few windows programs... But not office :"> Is that why I guess...? :">

<{POST_SNAPBACK}>

To my knowledge Microsoft Works does not have a documented API/COM interface, so you're out of luck there.

I would not hold my breath for much documentation on the usage of COM in the AutoIt documentation, because, for the most part, it is not an AutoIt thing, but rather it is application specific. The ObjGet and ObjCreate interfaces simply open the door to the other applications from inside an AutoIt script.

You may want to check out the discussion here:

COM Question, Learning COM

Dale

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

You have to assign a value to the underline property.

http://www.geocities.com/ResearchTriangle/...htm#WdUnderline

You can have single, double, wavy, dashed underlines....

$objWord.Selection.Font.Underline = 1 ;single underline

I don't know about inserting pictures.

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to post
Share on other sites

Hmm, I wasn't really looking to do anything with word, I just wanted to see how COM works :) But I'm really excited... I just found some API sites for AIM (AOL Instant Messanger) and that's what I really wanted to automate! :D Well, I'll go check them out now... Haven't even looked at the yet :D

FootbaG
Link to post
Share on other sites

Grrr... Neverming, this is the closest thing I found using google...

http://www.codeproject.com/internet/mcapi.asp

But that doesn't have the $obj.AIM.blah.blah etc... I wouldn't recomend downloading the example of IM Commander either, I tried it, it just got really annoying... Does anyone know of any reference to AIM COM support? If you do, could you please share :) Thanks! :D

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

×
×
  • Create New...