DjDeep00 0 Posted April 3, 2005 Share Posted April 3, 2005 Instead of writing to notepad all the time with just simple text. Is there a way to call some DLL, using some function that would write to Microsoft Word with different fonts and sizes? Link to post Share on other sites
CyberSlug 6 Posted April 3, 2005 Share Posted April 3, 2005 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 WordI used the following sites to find thsee few commandshttp://cuinl.tripod.com/Tips/off1.htmhttp://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
layer 3 Posted April 3, 2005 Share Posted April 3, 2005 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
DjDeep00 0 Posted April 3, 2005 Author Share Posted April 3, 2005 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
layer 3 Posted April 3, 2005 Share Posted April 3, 2005 I haven't tried it yet but have your tried this?: $objWord.Selection.Font.Style.Underline Or is that to many keywords? I haven't tried it yet so I wouldn't know :"> FootbaG Link to post Share on other sites
layer 3 Posted April 3, 2005 Share Posted April 3, 2005 @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
SlimShady 1 Posted April 3, 2005 Share Posted April 3, 2005 (edited) It works here on Windows XP with Office 2003. @layer: Copy & paste the code, save and then run the script. That's it. Edited April 3, 2005 by SlimShady Link to post Share on other sites
layer 3 Posted April 3, 2005 Share Posted April 3, 2005 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! FootbaG Link to post Share on other sites
Insolence 2 Posted April 3, 2005 Share Posted April 3, 2005 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
layer 3 Posted April 3, 2005 Share Posted April 3, 2005 I have Microsoft Works with a few windows programs... But not office :"> Is that why I guess...? :"> FootbaG Link to post Share on other sites
DaleHohm 65 Posted April 3, 2005 Share Posted April 3, 2005 (edited) 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 COMDale Edited April 3, 2005 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
DjDeep00 0 Posted April 3, 2005 Author Share Posted April 3, 2005 No luck, I am still unable to underline text and insert a picture into the word document. Link to post Share on other sites
CyberSlug 6 Posted April 3, 2005 Share Posted April 3, 2005 You have to assign a value to the underline property.http://www.geocities.com/ResearchTriangle/...htm#WdUnderlineYou can have single, double, wavy, dashed underlines....$objWord.Selection.Font.Underline = 1 ;single underlineI 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
layer 3 Posted April 4, 2005 Share Posted April 4, 2005 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! Well, I'll go check them out now... Haven't even looked at the yet FootbaG Link to post Share on other sites
layer 3 Posted April 4, 2005 Share Posted April 4, 2005 Grrr... Neverming, this is the closest thing I found using google...http://www.codeproject.com/internet/mcapi.aspBut 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! FootbaG Link to post Share on other sites
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now