neypro Posted October 12, 2017 Share Posted October 12, 2017 can you help me!!!! I use the _Word_DocFindReplace function in word.au3 to replace the word, when I use it for the paragraph it works well. But do not substitute words written in the text box Link to comment Share on other sites More sharing options...
water Posted October 12, 2017 Share Posted October 12, 2017 Welcome to AutoIt and the forum! Can you please post the script you run? neypro 1 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 Link to comment Share on other sites More sharing options...
neypro Posted October 12, 2017 Author Share Posted October 12, 2017 18 minutes ago, water said: Welcome to AutoIt and the forum! Can you please post the script you run? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <word.au3> Local $msg GUICreate("My Program", 200, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) $button=GUICtrlCreateButton("drag here",10,10,150,150) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_DROPPED Then $nhap=@gui_DragFile ExitLoop EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Local $oWord = _Word_Create() Local $oDoc = _Word_DocOpen($oWord, $nhap, Default, Default, True) _Word_DocFindReplace($oDoc, "test document", "hiuhiuhiu",$WdReplaceAll) _Word_DocSaveAs($oDoc, @ScriptDir&"\finis.doc") _Word_Quit($oWord) Link to comment Share on other sites More sharing options...
neypro Posted October 12, 2017 Author Share Posted October 12, 2017 Link to comment Share on other sites More sharing options...
water Posted October 12, 2017 Share Posted October 12, 2017 A possible solution has been posted here: neypro 1 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 Link to comment Share on other sites More sharing options...
neypro Posted October 13, 2017 Author Share Posted October 13, 2017 7 hours ago, water said: A possible solution has been posted here: I have seen some related posts. But I'm not good at English so I do not understand much :((( Link to comment Share on other sites More sharing options...
water Posted October 13, 2017 Share Posted October 13, 2017 The following example processes all text box shapes #include <Word.au3> $oWord = _Word_Create() $oDoc = _Word_DocOpen($oWord, @ScriptDir & "\test.docx") Global Const $msoTextBox = 17 ; Text box For $oShape In $oWord.ActiveDocument.Shapes If $oShape.Type = $msoTextBox Then $oShape.Select _Word_DocFindReplace($oDoc, "FindMe", "ReplaceMe", Default, -1) EndIf Next neypro 1 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 Link to comment Share on other sites More sharing options...
neypro Posted October 13, 2017 Author Share Posted October 13, 2017 3 hours ago, water said: The following example processes all text box shapes #include <Word.au3> $oWord = _Word_Create() $oDoc = _Word_DocOpen($oWord, @ScriptDir & "\test.docx") Global Const $msoTextBox = 17 ; Text box For $oShape In $oWord.ActiveDocument.Shapes If $oShape.Type = $msoTextBox Then $oShape.Select _Word_DocFindReplace($oDoc, "FindMe", "ReplaceMe", Default, -1) EndIf Next Oh, thank you. You helped me a lot Link to comment Share on other sites More sharing options...
water Posted October 13, 2017 Share Posted October 13, 2017 neypro 1 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 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