ToyleY Posted February 2, 2008 Share Posted February 2, 2008 So do you have to have MS Word installed for this to work?I get:--> Word.au3 Error from function _WordCreate (Word Object Creation Failed)when I run the printer bit (_WordDocPrint)I use Open Office not MS Word. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted February 2, 2008 Author Moderators Share Posted February 2, 2008 @ToyleY - Yes, it relies on MS Word's COM Object Model to function. It has been requested before that Word.au3 be compatible with Open Office as well, but that is not going to happen. A quick google search suggested that Open Office does provide COM automation, maybe someone with some time on their hands can start an automation library for it. Link to comment Share on other sites More sharing options...
ToyleY Posted February 2, 2008 Share Posted February 2, 2008 Thank youI've opted for this:$printProg = "C:\Program Files\Microsoft Office\OFFICE11\WORDVIEW.EXE "$printFile = "test.rtf"$WorkingDir = "C:\Documents and Settings\User\My Documents"$CommandLine = $printProg & $printFile run($CommandLine, $WorkingDir, @SW_MAXIMIZE)Using the free 'MS Word Viewer 2003' From: http://www.microsoft.com/downloads/details...;displaylang=enNo point in reinventing the wheel and it says on the Microsoft Site: "NOTE: So long as you comply with the other license terms for the Microsoft Office Word 2003 Viewer, you may distribute such viewer without a document created by Microsoft Office."It prints -# Rich Text Format (.rtf)# Text (.txt)# Web Page formats (.htm, .html, .mht, .mhtml)# WordPerfect 5.x (.wpd)# WordPerfect 6.x (.doc, .wpd)# Works 6.0 (.wps)# Works 7.0 (.wps)# XML (.xml) Unfortunately there is no command line switch (/p, for example) to print documents without using the 'MS Word Viewer 2003' menus, but it's not a big problem. Link to comment Share on other sites More sharing options...
BBrian Posted April 13, 2008 Share Posted April 13, 2008 There doesn't seem to be a way to attach to Word when there is no Word window. I have script running as a service which launches Word. I can get the pid but haven't figured a way to get a handle or Word object. I'm trying to run a macro when Word opens. I tried using Word's own AutoStart and AutoOpen macros but didn't get it to work. The AutoIt function works perfectly when not running as a service. Link to comment Share on other sites More sharing options...
xhyxsl Posted April 25, 2008 Share Posted April 25, 2008 (edited) hi big_daddy!#include <Word.au3>Const $wdStyleHeading1 = -2$file_name = @ScriptDir & "\index.doc"$oWordApp = _WordCreate ($file_name, 0, 1)$oDoc = _WordDocGetCollection ($oWordApp, 0)xhyxsl_WordContents($oWordApp,$oDoc,2,8)Func xhyxsl_WordContents($o_WordApp,$o_Doc,$C_Head,$C_Tail) $x = 0 For $i In $o_Doc.Paragraphs $x += 1 For $n = $C_Head To $C_Tail If $x > $C_Tail Then If $i.Range = $o_Doc.Paragraphs($n).Range Then $i.Range.Select $o_WordApp.Selection.Style = $o_Doc.Styles($wdStyleHeading1) $C_Head += 1 EndIf EndIf Next NextEndFunc $i.Range = $o_Doc.Paragraphs($n).Range ;;;==============>>> ???;;; vba to au3;;;;;ExamplesSub Contents()Dim i As Paragraph, n As Byte, a As Byte, b As Byte, x As Long, DelRange As Rangea = 2b = 8x = 0For Each i In Activedocument.Paragraphs x = x + 1 For n = a To b If x > b Then If i.Range = Activedocument.Paragraphs(n).Range Then i.Range.Select Selection.Style = Activedocument.Styles(wdStyleHeading1) a = a + 1 End If End If NextNext Edited May 3, 2008 by xhyxsl Link to comment Share on other sites More sharing options...
xhyxsl Posted May 5, 2008 Share Posted May 5, 2008 hi big_daddy! Please help me! Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted May 5, 2008 Author Moderators Share Posted May 5, 2008 $i.Range = $o_Doc.Paragraphs($n).Range ;;;==============>>> ???This is not a question. If you want me to take time to help you, you need to take time to ask a proper question. Link to comment Share on other sites More sharing options...
longtex Posted June 21, 2008 Share Posted June 21, 2008 This is not a question. If you want me to take time to help you, you need to take time to ask a proper question.BD, this is not his non-question, but a real question of my own... I'm trying to display a .doc file (Public Library User Agreement) and ask the user if he agrees, etc - so it's basically like a "standard" EULA... if he agrees, then I run program X (IE, Firefix, etc), but if he doesn't agree, I inform the librarian so he can call in the SWAT team to deal with the terroristic bastard.Anyway... It works fine (okay, not fine but more or less acceptably) in a couple of different versions (read file into var & display, yes/no buttons at bottom), but they want it shown in Rich Text, of course...I'm not seeing anything in your (wonderful) lib that looks like it would work, but I'm probably missing something... am I missing it? If so, how would it be used? Or if not, is there a good way to display beeyoutifull rich text in a non-editable window so I can ask the yes/no in another box?Thanks - Tex Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too? Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 23, 2008 Author Moderators Share Posted June 23, 2008 @longtex - I'd suggest using a RichEdit control. You can find an example in the help file under "GUICtrlCreateEdit". Link to comment Share on other sites More sharing options...
longtex Posted June 24, 2008 Share Posted June 24, 2008 @longtex - I'd suggest using a RichEdit control. You can find an example in the help file under "GUICtrlCreateEdit".It looks promising, but threw an error. Looks like it wanted MSCOMCT2.OCX which was not on my system. I downloaded MSCOMCT2.CAB from ms, put it in \windows\system32 and extracted MSCOMCT2.OCX but I still get two errors - both show an OK box, but time out without user input. The first one is from line 49,$oRP = ObjCreate("RICHTEXT.RichtextCtrl.1")and is styled "invalid class string".Any idea? Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too? Link to comment Share on other sites More sharing options...
longtex Posted June 24, 2008 Share Posted June 24, 2008 @longtex:Did you register the OCX? (regsvr32.exe mscomct2.ocx)alcI did, finally. I'm not much of a Windows hand - most of my work is on Linux systems, and the tips I found first, on adding the ocx, didn't say anything about registering... duhhh...Anyway, after registering, it still throws an error - says it's not licensed for use... I probably need to update - it's an older AU3. I'll do that and report back. Thanks! Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too? Link to comment Share on other sites More sharing options...
longtex Posted June 24, 2008 Share Posted June 24, 2008 I did, finally. I'm not much of a Windows hand - most of my work is on Linux systems, and the tips I found first, on adding the ocx, didn't say anything about registering... duhhh...Anyway, after registering, it still throws an error - says it's not licensed for use... I probably need to update - it's an older AU3. I'll do that and report back. Thanks!Apparently, that's not it - I'm updated to the 6/12/2008 version. Same error "not licensed for use"... let's see... yep, same line$oRP = ObjCreate("RICHTEXT.RichtextCtrl.1")Assuming that this gets resolved - it obviously is dependent on the installation of Windows software on the target machine(s), which is something I think we'd all like to avoid: after all, one of the attractions of AU3 is to avoid needing outside libs. What can we do to address this problem? Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too? Link to comment Share on other sites More sharing options...
longtex Posted June 24, 2008 Share Posted June 24, 2008 Apparently, that's not it - I'm updated to the 6/12/2008 version. Same error "not licensed for use"... let's see... yep, same lineAssuming that this gets resolved - it obviously is dependent on the installation of Windows software on the target machine(s), which is something I think we'd all like to avoid: after all, one of the attractions of AU3 is to avoid needing outside libs. What can we do to address this problem?Got it - it's a registry problem (apparently). Here's where I found the fixNow... at least the example doesn't error off (I just copied the example under guictrlcreateedit, as directed). I'll try out the doc file and see if it's going to work...Still... what does anyone suggest about possibly automating via AU3 the installation and registering of the ocx libs and the registry hack linked above? Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too? Link to comment Share on other sites More sharing options...
longtex Posted June 25, 2008 Share Posted June 25, 2008 Here's the current resolution to this issue. As far as I can tell, the richtext controls do NOT display DOC files - however, they DO display RTF files. I have a program now running, displaying a EULA file in RTF, with Agree/Don't Agree buttons and appropriate action. Look in Example Scripts, for EULA... this may (probably will) get more attention, but for now, I'm calling it okay. Thanks for all the help from everyone! Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too? Link to comment Share on other sites More sharing options...
Vaeb Posted August 11, 2008 Share Posted August 11, 2008 Is there a way to open a word without open a new document? I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
seesoe Posted March 23, 2009 Share Posted March 23, 2009 is it possible to print a template and have autoit fill in some fields from specified vars? Link to comment Share on other sites More sharing options...
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