Klusek_ Posted October 23, 2021 Share Posted October 23, 2021 Hello. I have a problem with Notepad++. When I have a lot of "Names", I don't want to replace it with "Klusek1" and no text has been loaded because it is empty in MsgBox. I tested on notepad.exe, it works, but on notepad++.exe it doesn't. As if Autoit could not detect text in Notepad++. I will be very grateful for your help and explanation. >>>> Window <<<< Title: new 1 - Notepad++ Class: Notepad++ Position: -8, -8 Size: 1940, 1060 Style: 0x17CF0000 ExStyle: 0x00000110 Handle: 0x00000000001B0428 >>>> Control <<<< Class: SysTabControl32 Instance: 5 ClassnameNN: SysTabControl325 Name: Advanced (Class): [CLASS:SysTabControl32; INSTANCE:5] ID: Text: Tab Position: 0, 25 Size: 1920, 950 ControlClick Coords: 680, 445 Style: 0x5600A000 ExStyle: 0x00000000 Handle: 0x00000000002E0464 >>>> Mouse <<<< Position: 680, 510 Cursor ID: 0 Color: 0x3F3F3F >>>> StatusBar <<<< 1: Normal text file 2: length : 0 lines : 1 3: Ln : 1 Col : 1 Pos : 1 4: Windows (CR LF) 5: UTF-8 6: INS >>>> ToolsBar <<<< >>>> Visible Text <<<< Tab Normal text file X Find: < > Match &case &Highlight all >>>> Hidden Text <<<< Selected Tab Caption Tab1 Selected Tab Caption Tab1 Selected Tab Caption Tab1 Selected Tab Caption Tab1 Tab MsgBox(0, "Test", "Load the source text into the notebook") $sTxt = ControlGetText("[CLASS:Notepad++]", "", "SysTabControl325") $iNR = 99 MsgBox(64, "Source text", $sTxt) Do $iNR += 1 $sTxt = StringReplace($sTxt, "Names", "Klusek" & $iNR, 1) Until @extended = 0 ControlSetText("[CLASS:Notepad++]", "", "SysTabControl325", $sTxt) Link to comment Share on other sites More sharing options...
Danp2 Posted October 23, 2021 Share Posted October 23, 2021 16 minutes ago, Klusek_ said: Advanced (Class): [CLASS:SysTabControl32; INSTANCE:5] That's the tab control, which won't contain the desired text. You likely need to use UIAutomation in order to successfully retrieve the text. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mLipok Posted October 23, 2021 Share Posted October 23, 2021 20 minutes ago, Klusek_ said: As if Autoit could not detect text in Notepad++ Not true. Tip: Scintilla, SendMessage Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Klusek_ Posted October 23, 2021 Author Share Posted October 23, 2021 3 hours ago, Danp2 said: That's the tab control, which won't contain the desired text. You likely need to use UIAutomation in order to successfully retrieve the text. I'll check and try it. Thanks for the information. 3 hours ago, mLipok said: Not true. Tip: Scintilla, SendMessage Right. Shows all text in MsgBox but delete all text and yield one letter "K". Link to comment Share on other sites More sharing options...
Klusek_ Posted October 24, 2021 Author Share Posted October 24, 2021 I tried UIAutomation. I did as it was described in the guide. Yes, it works on notepad and nothing works on notepad++. Link to comment Share on other sites More sharing options...
mLipok Posted October 24, 2021 Share Posted October 24, 2021 11 hours ago, Klusek_ said: but delete all text and yield one letter "K". ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Klusek_ Posted October 24, 2021 Author Share Posted October 24, 2021 1 hour ago, mLipok said: ? In Notepad ++ I have text Names Names Names When I turn on the script, it changes everything to K I think you understood Link to comment Share on other sites More sharing options...
mLipok Posted October 24, 2021 Share Posted October 24, 2021 1 hour ago, Klusek_ said: When I turn on the script ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Danp2 Posted October 24, 2021 Share Posted October 24, 2021 Show your revised code. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Klusek_ Posted October 24, 2021 Author Share Posted October 24, 2021 1 hour ago, mLipok said: ? This means that after running the script .au3 33 minutes ago, Danp2 said: Show your revised code. Nothing works. On the console it shows me the message "$oValue ERR" expandcollapse popup#include "..\Include\Includes\CUIAutomation2.au3" Example() Func Example() ; Open Notepad++ Run( "C:\Program Files (x86)\Notepad++\notepad++.exe" ) Sleep( 1000 ) Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ConsoleWrite( "--- Notepad++ window ---" & @CRLF ) Local $pCondition $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Notepad++", $pCondition ) If Not $pCondition Then Return ConsoleWrite( "$pCondition ERR" & @CRLF ) ConsoleWrite( "$pCondition OK" & @CRLF ) Local $pNotepad, $oNotepad $oDesktop.FindFirst( $TreeScope_Descendants, $pCondition, $pNotepad ) $oNotepad = ObjCreateInterface( $pNotepad, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oNotepad ) Then Return ConsoleWrite( "$oNotepad ERR" & @CRLF ) ConsoleWrite( "$oNotepad OK" & @CRLF ) ConsoleWrite( "--- Fill Edit element ---" & @CRLF ) ; $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "15", $pCondition ) $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Scintilla", $pCondition ) If Not $pCondition Then Return ConsoleWrite( "$pCondition ERR" & @CRLF ) ConsoleWrite( "$pCondition OK" & @CRLF ) Local $pEdit, $oEdit $oNotepad.FindFirst( $TreeScope_Descendants, $pCondition, $pEdit ) $oEdit = ObjCreateInterface( $pEdit, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oEdit ) Then Return ConsoleWrite( "$oEdit ERR" & @CRLF ) ConsoleWrite( "$oEdit OK" & @CRLF ) Local $pValue, $oValue ; $oEdit.GetCurrentPattern( $UIA_ValuePatternId, $pValue ) $oEdit.GetCurrentPattern( $UIA_LegacyIAccessiblePatternId, $pValue ) $oValue = ObjCreateInterface( $pValue, $sIID_IUIAutomationValuePattern, $dtagIUIAutomationValuePattern ) If Not IsObj( $oValue ) Then Return ConsoleWrite( "$oValue ERR" & @CRLF ) ConsoleWrite( "$oValue OK" & @CRLF ) $oValue.SetValue( "HelloWorld" ) EndFunc Link to comment Share on other sites More sharing options...
Danp2 Posted October 24, 2021 Share Posted October 24, 2021 16 hours ago, Klusek_ said: Right. Shows all text in MsgBox but delete all text and yield one letter "K". You never showed this code. From your description, it sounds like you were able to retrieve the original text. Please elaborate. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Klusek_ Posted October 24, 2021 Author Share Posted October 24, 2021 It's the same code as at the top MsgBox(0, "Test", "Load the source text into the notebook") $sTxt = ControlGetText("[CLASS:Notepad++]", "", "Scintilla1") $iNR = 99 MsgBox(64, "Source text", $sTxt) Do $iNR += 1 $sTxt = StringReplace($sTxt, "Names", "Klusek" & $iNR, 1) Until @extended = 0 ControlSetText("[CLASS:Notepad++]", "", "Scintilla1", $sTxt) Link to comment Share on other sites More sharing options...
Klusek_ Posted October 24, 2021 Author Share Posted October 24, 2021 Excuse me. I am typing too fast and I noticed that it cannot be edited.. Yes. We managed to recover all the text because it showed up in MsgBox but it all turned into one letter in the Notepad++ editor Link to comment Share on other sites More sharing options...
Danp2 Posted October 24, 2021 Share Posted October 24, 2021 Seems like the ControlSetText isn't working as intended. There is likely a better solution, but here's an alternative for now -- ControlSetText("[CLASS:Notepad++]", "", "Scintilla1", "") ControlSend("[CLASS:Notepad++]", "", "Scintilla1", $sTxt) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Klusek_ Posted October 24, 2021 Author Share Posted October 24, 2021 Pity. This solution could damage my file and notepad does not have the proper encoding for the file with special characters. Link to comment Share on other sites More sharing options...
Danp2 Posted October 24, 2021 Share Posted October 24, 2021 How so? Also, why not perform the editing directly in Autoit (ie: FileRead / FileWrite, etc) instead of using an external editor? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mLipok Posted October 24, 2021 Share Posted October 24, 2021 1 hour ago, Klusek_ said: notepad does not have the proper encoding for the file with special characters. Which characters ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted October 24, 2021 Share Posted October 24, 2021 (edited) 2 hours ago, Klusek_ said: It's the same code as at the top $sTxt = ControlGetText("[CLASS:Notepad++]", "", "Scintilla1") You don't understand me well. I mean here: 22 hours ago, mLipok said: Tip: Scintilla, SendMessage You should use Scintilla API: https://www.scintilla.org/ScintillaDoc.html Edited October 24, 2021 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
jugador Posted October 24, 2021 Share Posted October 24, 2021 (edited) You need GUICtrlMenuClick for thishttps://www.autoitscript.com/forum/topic/205640-guictrlmenuclick/ This not the way to do it but for fun Open Notepad++ then type the word Name(in order you like) and no need to save it Name Name Name Name Run the code from SciTE #include "GUICtrlMenuClick.au3" Example() Func Example() Local $hWnd = WinGetHandle("[Class:Notepad++]") ControlFocus($hWnd, "", "Scintilla1") Send("{APPSKEY}") Local $P_hWnd = WinWait("[CLASS:#32768]") Local $P_Menu = _SendMessage($P_hWnd, 0x01E1) Local $o_SelectAll = __GUICtrlMenu_GetID($P_Menu, 'Select All') Local $o_Copy = __GUICtrlMenu_GetID($P_Menu, 'Copy') Local $o_Paste = __GUICtrlMenu_GetID($P_Menu, 'Paste') Send('{ESC}') If ($o_SelectAll <> -1) And ($o_Copy <> -1) Then __GUICtrlMenu_ClickByID($hWnd, $o_SelectAll) __GUICtrlMenu_ClickByID($hWnd, $o_Copy) Local $sData = ClipGet() Local $sText = StringReplace($sData, "Name", "Age" & 55) ClipPut($sText) __GUICtrlMenu_ClickByID($hWnd, $o_Paste) Endif EndFunc Edited October 24, 2021 by jugador Link to comment Share on other sites More sharing options...
Klusek_ Posted October 24, 2021 Author Share Posted October 24, 2021 4 hours ago, Danp2 said: You never showed this code. From your description, it sounds like you were able to retrieve the original text. Please elaborate. Will it help? With these features it will definitely damage my file. If I remove even one letter or spaces, the whole file will be damaged 1 hour ago, mLipok said: Which characters ? For example, the characters: EM, NUL, ETX, EOT, ENQ 1 hour ago, mLipok said: You don't understand me well. I mean here: You should use Scintilla API: https://www.scintilla.org/ScintillaDoc.html How am I supposed to use it? With inclusion of a DLL? 1 hour ago, jugador said: You need GUICtrlMenuClick for thishttps://www.autoitscript.com/forum/topic/205640-guictrlmenuclick/ This not the way to do it but for fun Open Notepad++ then type the word Name(in order you like) and no need to save it Name Name Name Name Run the code from SciTE #include "GUICtrlMenuClick.au3" Example() Func Example() Local $hWnd = WinGetHandle("[Class:Notepad++]") ControlFocus($hWnd, "", "Scintilla1") Send("{APPSKEY}") Local $P_hWnd = WinWait("[CLASS:#32768]") Local $P_Menu = _SendMessage($P_hWnd, 0x01E1) Local $o_SelectAll = __GUICtrlMenu_GetID($P_Menu, 'Select All') Local $o_Copy = __GUICtrlMenu_GetID($P_Menu, 'Copy') Local $o_Paste = __GUICtrlMenu_GetID($P_Menu, 'Paste') Send('{ESC}') If ($o_SelectAll <> -1) And ($o_Copy <> -1) Then __GUICtrlMenu_ClickByID($hWnd, $o_SelectAll) __GUICtrlMenu_ClickByID($hWnd, $o_Copy) Local $sData = ClipGet() Local $sText = StringReplace($sData, "Name", "Age" & 55) ClipPut($sText) __GUICtrlMenu_ClickByID($hWnd, $o_Paste) Endif EndFunc It will come in handy for later. Thank you 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