Moderators big_daddy Posted September 11, 2006 Author Moderators Share Posted September 11, 2006 @randallc - I've been doing some testing, by chance are you initially opening the document via script? There seems to be a bug with _WordAttach() not finding documents opened via script; however it works fine when the document is opened manually. Link to comment Share on other sites More sharing options...
randallc Posted September 11, 2006 Share Posted September 11, 2006 (edited) Hi, It seems to be either way for me! - I was originally doing it manually; now I see I have the problem either way. Seems that "isobj"=1 $oWindows does not have a collection in it, despite existing???...! Best, Randall [EDIT; PS later; it is working?!.. I give up] Edited September 11, 2006 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
BasicOs Posted September 16, 2006 Share Posted September 16, 2006 (edited) Is it possible to have an Openoffice udf inside Word.au3... where they should have same funcs and you can use an global var in the apps where you can decide when to change from one to another: example: include word.au3 $Wordactiveprocessor="OPEN" .... CODE valid FOR OPENOFFICE $WordActiveProcessor="Word" .... Code valid for Word $WordActiveProcessor="Excel" ..... Code valid for Exce Same functions same things... It is a great UDF, Thanks for supporting the free software OO Edited September 16, 2006 by BasicOs Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted September 26, 2006 Author Moderators Share Posted September 26, 2006 New update available! See update history in first post for changes. Enjoy, Bob @BasicOs - I probably won't add this to Word.au3, but I could possibly create an add-on for Open Office. Link to comment Share on other sites More sharing options...
fisofo Posted September 26, 2006 Share Posted September 26, 2006 This is great... keep up the good work! Now we just need an excel and outlook udf Link to comment Share on other sites More sharing options...
DaLiMan Posted September 27, 2006 Share Posted September 27, 2006 This is great... keep up the good work!Now we just need an excel and outlook udf For an Excel udf see the signature of randallc, 3 posts up.... Link to comment Share on other sites More sharing options...
Valuater Posted September 27, 2006 Share Posted September 27, 2006 Looks really nice Bob!!! just a small note.. may help reduce the amount of lines required in this larger type of file i see alot of this... or similar If @error Then SetError(@error, @extended) Return False EndIfoÝ÷ Û^ØZµÊ.ÖÞçnqçm¢;¬·Yb殶s`¤bW'&÷"FVâ&WGW&â6WDW'&÷"W'&÷"ÂWFVæFVBÂfÇ6R²÷" ... AFAIK Valuater 8) Link to comment Share on other sites More sharing options...
DaleHohm Posted September 27, 2006 Share Posted September 27, 2006 Since disk space is charged in bytes rather than lines, i would choose the first structure for readability and flexibility... Dale 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 comment Share on other sites More sharing options...
Moderators big_daddy Posted September 27, 2006 Author Moderators Share Posted September 27, 2006 @fisofo - Thanks, I will! @Valuater - Thanks for the suggestion, however I agree with Dale that the first is much easier to read and manage. Link to comment Share on other sites More sharing options...
fisofo Posted September 27, 2006 Share Posted September 27, 2006 For an Excel udf see the signature of randallc, 3 posts up.... Heh, hmmm, well... aren't i watchful very nice randallc. Once "we" (and by that i mean all of you guys that aren't complete n00bs. like me) get the full office suite done i suppose it'll make it to the stable release. That'd be sweet. Link to comment Share on other sites More sharing options...
Kohr Posted September 28, 2006 Share Posted September 28, 2006 (edited) I was trying to use your _WordDocAddPicture function and I cannot seam to get it to work with .png files. I receive this console error "--> Word.au3 Error from function _WordDocAddPicture, $_WordStatus_InvalidObjectType" when I run the following code. #include <Word.au3> $oWordApp = _WordCreate ("C:\Documents and Settings\All Users\Desktop\WordOutput.doc", 0, 0) $sPath = "C:\Program Files\Temp\" $file = "MWSnap.png" $oShape = _WordDocAddPicture ($oWordApp, $sPath & $file, 0, 1) _WordQuit ($oWordApp) I had been using my own code to do this so I am not sure why it will not work using your function. They appear to be similiar except I am using ".Selection". Code that will insert .png files. #include <Word.au3> $gWord = ObjCreate("Word.Application") $gWord.visible = False $gWord.Documents.Add $sPath = "C:\Program Files\Temp\" $file = "MWSnap.png" $gWord.Selection.InlineShapes.AddPicture( $sPath & $file, False, True) $gWord.ChangeFileOpenDirectory (@DesktopDir) $gWord.Activedocument.SaveAs ("WordOutput.doc") $gWord.Application.Quit Kohr Edited September 28, 2006 by Kohr AutoIt LinksAutoIt CrapsGrid_PixelSearchAdvancedPixelGrab Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted September 28, 2006 Author Moderators Share Posted September 28, 2006 @Kohr - The first parameter for _WordDocAddPicture() needs to be a document object, whereas your trying to pass an application object. Please take a look at the help file, there you will find an example of how to correctly use the function. Thanks, Bob Link to comment Share on other sites More sharing options...
Kohr Posted September 28, 2006 Share Posted September 28, 2006 (edited) Thanks. I got the function to work. Any idea why the 1st method works and the 2nd does not? Works. #include <Word.au3> $oWordApp = _WordCreate ("", 0, 0) $oDoc = _WordDocGetCollection ($oWordApp, 0) $sPath = "C:\Program Files\Temp\" $file = "MWSnap.png" $oShape = _WordDocAddPicture ($oDoc, $sPath & $file, 0, 1) _WordDocSaveAs ($oDoc, @DesktopDir & "\WordOutput.doc") _WordQuit ($oWordApp) Does not work. #include <Word.au3> $oWordApp = _WordCreate (@DesktopDir & "\WordOutput.doc", 0, 0) $oDoc = _WordDocGetCollection ($oWordApp, 0) $sPath = "C:\Program Files\Temp\" $file = "MWSnap.png" $oShape = _WordDocAddPicture ($oDoc, $sPath & $file, 0, 1) _WordDocSave ($oDoc) _WordQuit ($oWordApp) I mainly want to understand these more so I can decide if I want to use them. I basically use word to write a combination of txt and picture inserts on 100+ pages in a single word document. Everything I did is not function based but I would like to move to yours if possible. Kohr Edited September 28, 2006 by Kohr AutoIt LinksAutoIt CrapsGrid_PixelSearchAdvancedPixelGrab Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted September 28, 2006 Author Moderators Share Posted September 28, 2006 @Kohr - Please open up a new topic in the support forum so we can further discuss this, and be more specific than "Does not work". Thanks, Bob Link to comment Share on other sites More sharing options...
Ármányos Kő Posted October 10, 2006 Share Posted October 10, 2006 Is it possible to run spellchecking on a word document?What I am doing is the following:I have a program which helps translators to correct their translated text against the original text. This is a GUI with two synchronised multiline Edit Ctrl with very special functions to speed up comparison of original and translated text. (The translated text normally is not made in MS Word)I would like to add the functionality of spellchecking the translated text using Word spellchecker. Word is installed on everyone's computer (translators) with the local spellchecking so it should not be a problem to use it.Based on the cool Word UDF I can insert my sentence to a word this should be no problem. But can I run the spellchecking somehow (preferably in hidden mode) and show results through my AutoIt GUI?According to http://msdn2.microsoft.com/en-us/library/ms178794.aspx (Which is: How to: Check Spelling in Documents), there is a way of doing it, but I am not expert on this. Thanks for your help Link to comment Share on other sites More sharing options...
ptrex Posted October 10, 2006 Share Posted October 10, 2006 @Ármányos Kő This should you get started. expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.0 ; Language: English ; Platform: Win9x / NT ; Author: Jos van der Zande <jvdzande@yahoo.com> ; ; Script Funktion: ; Spell checks the Selected text with the Word spellchecker and ; Paste it back if updated.; ; ---------------------------------------------------------------------------- ; set to the MS language number you want Global $Language = "1033" ; English $S = ClipGet() ; save clip content ClipPut("") ; empty clipboard Send("^{INSERT}") ; get selection to clipboard $ORG_SELECTION=ClipGet() ; Get current selection If $ORG_SELECTION = "" Then Function: TrayTip('SpellCheck','No text Selected !!',3) Sleep(3000) Else ; get active window title and minimise $WINTITLE = WinGetTitle("") ; hide the window to ensure its not changed during spellcheck WinSetState($WINTITLE,'',@SW_MINIMIZE) ; find number of leading spaces For $SS = 0 To StringLen($ORG_SELECTION) - 1 If StringMid($ORG_SELECTION,$SS+1,1) <> " " Then ExitLoop Next ; find number of trailing spaces For $ST = 0 To StringLen($ORG_SELECTION) - 1 If StringMid($ORG_SELECTION,StringLen($ORG_SELECTION) - $ST,1) <> " " Then ExitLoop Next ; set traytip and Create/Run spellcheck vbs TrayTip('Running SpellCheck for',StringLeft($ORG_SELECTION,30) & "...",5) CreateVBScript() $RC=RunWait(@ComSpec & ' /c Wscript.exe "' & @ScriptDir & '\TextSpellCheck.vbs" 1033',"",@SW_HIDE) ; restore window WinSetState($WINTITLE,'',@SW_RESTORE) WinActivate($WINTITLE,'') ; strip spaces and add original number of leading/trailing spaves $SELECTION=StringStripWS(ClipGet(),3) ; Get current selection If $SELECTION<>StringStripWS($ORG_SELECTION,3) Then For $X = 1 To $SS $SELECTION = " " & $SELECTION Next For $X = 1 To $ST $SELECTION = $SELECTION & " " Next ; update clipboard ClipPut($SELECTION) ; paste updated text Send("+{INSERT}") TrayTip('SpellCheck','Text updated.',4) Else TrayTip('SpellCheck','Text ok, no updates.',4) EndIf EndIf ; restore orignal clipboard contents ClipPut($S) sleep(4000) FileDelete(@ScriptDir & '\TextSpellCheck.vbs') Func CreateVBScript() FileDelete(@ScriptDir & '\TextSpellCheck.vbs') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs','On error resume next') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs','Set Word = CreateObject("word.Application")') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs','Word.WindowState = 2') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs','Word.Visible = False') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs','Set Doc = Word.Documents.Add( , , 1, True)') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs','Word.Selection.Paste') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs','If err = 0 then') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs',' Word.Selection.LanguageID = ' & $Language) FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs',' ''Doc.CheckSpelling '' Spellcheck function') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs',' Doc.CheckGrammar '' Spelling And Grammer check function') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs',' Word.Selection.WholeStory') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs',' Word.Selection.Copy') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs','End If') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs','Doc.Close False') FileWriteLine(@ScriptDir & '\TextSpellCheck.vbs','Word.Application.Quit True') EndFunc ;==>CreateVBScript Enjoy !! ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Ármányos Kő Posted October 10, 2006 Share Posted October 10, 2006 Ptrex! This seems pretty promising! Is it a right feeling that in $RC=RunWait(@ComSpec & ' /c Wscript.exe "' & @ScriptDir & '\TextSpellCheck.vbs" 1033',"",@SW_HIDE) the 1033 should also be changed to local language code ($language)? Thank you very much for the quick help! Link to comment Share on other sites More sharing options...
ptrex Posted October 10, 2006 Share Posted October 10, 2006 @Ármányos Kő Yes indead the 1033 refers to the ENGLISH settings. This needs to be changed to your local settings if needed. regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Ármányos Kő Posted October 10, 2006 Share Posted October 10, 2006 This works perfectly. Thanks again. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted October 10, 2006 Author Moderators Share Posted October 10, 2006 I have already created a script that does this.Custom Spell Checker 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