trancexx Posted January 21, 2013 Posted January 21, 2013 (edited) But water all the scripts that include Word.au3 will get broken, no exceptions. That's the main issue. You can't say "use the old AutoIt" to them, that's not right.Your UDF is example of how to wrap objects into the UDF from implementation point of view and the old UDF is example of how not to do it (regardless of the reasons for that). Even functionally they are very different. No function from the old file no longer exists in the new, if for nothing then because you renamed them to include additional underscore. Looked from distance, except from used objecs they have almost nothing in common.The fact remains that the old Word.au3 was there before as standard AutoIt UDF. New UDF, new implementation - new name and old one eventually forgotten and trashed, that should be correct procedure as it's less stressful, so to speak.I would like to hear your reasoning because frankly I'm confused by your insisting. Edited January 21, 2013 by trancexx ♡♡♡ . eMyvnE
water Posted January 21, 2013 Author Posted January 21, 2013 But water all the scripts that include Word.au3 will get broken, no exceptions.Correct. That's why this changes are called script breaking changes At a point in time users have to change their scripts anyway if they want to use the latest version of AutoIt.I had a look at the "design" of the UDF and was soon aware that the limitations and design quirks couldn't be solved under the cover. I mentioned this in a thread on the MVP forum and Valik just said: That's when I decided to start from scratch.There were so many script breaking changes in the past (_GUICtrlXXXYYY renaming to _GUICtrlXXX_YYY, splitting of GUIDefaultConstants.au3 into multiple files etc.) which had more or less impact on users.I think releasing one or multiple beta versions gives the users the needed time to decide how to handle script breaking changes.They can stay with an older version of AutoIt, change their scripts or - if we add the old Word UDF as a goody - drop the new Word UDF and work with the old one.If we add this as documentation to the history users have all information they need to make their own decision.I think the current Word UDF has to be dropped anyway so we just have to decide when this will be done. I prefer to drop it now. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
trancexx Posted January 22, 2013 Posted January 22, 2013 Many things in past are done incorrectly. That doesn't justify doing things wrong in the future. What Valik said is what we agreed on. Don't read wrong what he said.As you clearly don't trust my jugment (enough) I will say this... I rewrote half of AutoIt to allow correct objecs handling. I know and showed how to write code correctly and then asked for rewrite of this UDF. Please don't question my ability to make the right decisions. Your arguments in this case are invalid. I gave you fair amount of valid arguments for you to see what's wrong with your idea. If you choose to ignore them, your bad. I have no intention to force you to do anything, but I will use my dev right and not allow current Word.au3 to be part of the next release. If that surprises you (or anyone else) then I suggest reading my last few posts in this thread - again.Correct. That's why this changes are called script breaking changes If you want to talk seriously then don't do that please. ♡♡♡ . eMyvnE
water Posted January 23, 2013 Author Posted January 23, 2013 Trancexx, I would like to move the discussion off of this public Example Scripts forum to either the MVP forum or PM. What do you prefer? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted January 26, 2013 Author Posted January 26, 2013 (edited) After re-reading and re-thinking your and my posts on this subject and some posts on the MVP forum I saw the last few days I will pull back all changes I have made to the Word UDF. Hope to find some time to do it this weekend. Edited January 27, 2013 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
meo Posted February 27, 2013 Posted February 27, 2013 hi water. When using word.au3 or your wordex.au3, i found a bug in _worddocfindreplace() or _word_docfindreplace(). something like this, $find_str="something" $replace_str= <a very long string about 200 words or more> ; try replace _worddocfindreplace($oDoc, $find_str, $replace_str) ; or _word_docfindreplace($oDoc, $find_str, $replace_str) both functions donot work well, when replace string is long enough. Can you give me an advice when replacing so long words. thanks a lot.
water Posted February 27, 2013 Author Posted February 27, 2013 The replace string is limited to 256 characters.Use copy and paste as described here. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shaime Posted April 3, 2013 Posted April 3, 2013 Hey all, I'm trying to open a docx 2010 document with irm permissions on it. Trying to do so with the latest version of WordEX (tnx water!) i'm getting an error which saying that while trying to open the document the returned object was not a word object. I've been using the WordEx for another tasks already and it all went smooth, but this irm permissions...... I've been searching around the net and this forum and didn't found anything that really helped (there is Microsoft object which deals with those permissions but the problem is that i cant get the object that describes the document ). Anyone? Thanks in advance!
water Posted April 3, 2013 Author Posted April 3, 2013 Can you please post the _Word_DocOpen statement you use? What's the value of @error after you have called _Word_DocOpen? Do you set parameters $sOpenPassword (password for opening the document) or $sWritePassword (password for saving changes)? Which password do you need to pass (read, write)? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shaime Posted April 3, 2013 Posted April 3, 2013 Hey water,Thank you for the quick and kind response.I'm only changing the file name in _Word_DocOpen.au3 so the state will be:Local $sDocument = "e.docx"_Word_DocOpen($oWord, $sDocument, Default, Default, True)Of course that $sDocument is declared and created the same as in the original _Word_DocOpen.au3 (as mentioned before, nothing else but the file name is changed there)If i am trying to load the document the error will be with msgbox:Error opening 'Test.doc' @error = 3, @extended = 0 (yes i know, i didnt change the document name in the error msg )The document does not need any password.The thing is that my company is securing this documents and part of the irm permissions which are NOT allowed are the programmatic access (macros aren't enabled).When securing the file without this option (meaning programmatic access is enabled) Then the document is opened successfully (other problems pops but that is another issue) and _Word_DocOpen is acting normal.Any ideas?!
water Posted April 3, 2013 Author Posted April 3, 2013 If your company inhibits programatic access then there is no way for you as a user to open the document ;-) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shaime Posted April 7, 2013 Posted April 7, 2013 you probably right water, i just thought about access the permissions object and 'play' with it around a bit.The thing is that i found that such an object exist but i just cant figure out the way of getting it from my document (it suppose to be part of any doc, but not active in all of them).I tried to search a LOT but nothing came up...As u may already notice i'm kind of new to auto it, and i came into so many tools in such a short time that i dont want to give up..Tnx again
water Posted April 7, 2013 Author Posted April 7, 2013 Never used the permission object myself. But I'm sure that if you are not allowed to access the document you are not allowed to change permissions as well. Would be useless otherwise. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shaime Posted April 25, 2013 Posted April 25, 2013 (edited) Hey all, I'm writing some code using the WordEx (10x again water!). While running my script it seems like that i am getting an error and i wondered if there is any try/catch mechanism in autoit. I've been searching around and all i found is 'use if @error then _catch-caode_' Trying to do so, i've failed. it seems like that my code wont return with an error and wont return at all (kind of an exception is thrown and i cant reach it). Ideas anyone? I'll post my code if necessary... Thanks in advance~~~! Edited April 25, 2013 by shaime
water Posted April 25, 2013 Author Posted April 25, 2013 We need to know if it is a COM error or whatever. If you run your script from SciTE the output pane will display the error message. Can you post this? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shaime Posted April 25, 2013 Posted April 25, 2013 (edited) Yeah of course: my code is as follows (sorry for the mass, it's kind of a draft): expandcollapse popup#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y #include <word.au3> #include <WordEX.au3> ; Create application object Global $oWord = _Word_Create() If @error <> 0 Then Exit MsgBox(16, "Word UDF: _Word_DocFind Example", "Error creating a new Word application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Global $bWordClose = @extended ; Open test document readonly Global $oDoc = _Word_DocOpen($oWord, "english.docx") If @error <> 0 Then Exit MsgBox(16, "Word UDF: _Word_DocFind Example", "Error opening 'Test.doc'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Example1($oDoc) Exit ; ***************************************************************************** ; Example 1 ; Find the last text "test document" in the document and mark it bold. ; ***************************************************************************** Func Example1($oDoc) Local $oRangeFound #forceref $oRangeFound ;$oRangeFound = _Word_DocFind($oDoc, "My",0, Default, False) $oRangeFound = _Word_DocFind($oDoc, "english") If @error <> 0 Then Return MsgBox(16, "Word UDF: _Word_DocFind Example 1", "Error locating the specified text in the document." & @CRLF & "@error = " & @error & ", @extended = " & @extended) $oRangeFound.Bold = True ;;saving _Word_DocSave($oDoc) Local $iResult If $bWordClose Then $iResult = MsgBox(65, "Word UDF: _Word_Quit Example 1", "If you click OK ALL unsaved changes in ALL open documents will be lost and Word will be closed.") Else $iResult = MsgBox(65, "Word UDF: _Word_Quit Example 1", "Word was already running when function _Word_Create was called. Hence only the reference to the object will be removed.") EndIf If $iResult = 2 Then Return _Word_Quit($oWord) If @error <> 0 Then Return MsgBox(16, "Word UDF: _Word_Quit Example 1", "Error closing the Word application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox(64, "Word UDF: _Word_DocFind Example 1", "Last occurrence of string 'english' in the document marked as bold.") EndFunc ;==>Example1 The following is the output: >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:autoitscript_WordEX 1.3MYwORD.au3" /UserParams +>09:36:37 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64) >Running AU3Check (1.54.22.0) params:-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 from:C:Program Files (x86)AutoIt3 +>09:36:37 AU3Check ended.rc:0 >Running:(3.3.8.1):C:Program Files (x86)AutoIt3autoit3.exe "C:autoitscript_WordEX 1.3MYwORD.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop C:autoitscript_WordEX 1.3WordEX.au3 (833) : ==> The requested action with this object has failed.: $oDoc.Save() $oDoc.Save()^ ERROR ->09:36:49 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 13.018 - I'm kind of knowing that this error might come in some scenarios, so i'm willing to catch and handle him as i mentioned earlier. - Nevertheless, the code is working fine with the right configurations/input. Thanks Edited April 25, 2013 by shaime
shaime Posted April 25, 2013 Posted April 25, 2013 Ok i got it water: i used: Local $objErr = ObjEvent("AutoIt.Error","MyErrFunc") Local $output = _Word_DocSave($oDoc) If @error Then MsgBox(65, "Hey", "Hey i got it") EndIf Func MyErrFunc() SetError(1) EndFunc Thank you!
water Posted April 25, 2013 Author Posted April 25, 2013 You don't need to include "Word.au3". WordEX.au3 is made to work with AutoIt 3.3.9.x beta version. With this versions there is no need for a COM error handler. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted July 9, 2013 Author Posted July 9, 2013 I'm getting an invalid .zip file whenever I try to download WordEX. Is anyone else having this issue? Thanks. Could you solve your problem? I can't find your post any longer! My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts