Renshai Posted September 8, 2013 Posted September 8, 2013 Hello - I'm sorry if posting this is a sin and I'm asking a question that has been answered before. I have legitimately spent two hours googling and searching these forums to answer what I assume is a fairly simple problem. I've used the regular expression replace function in some other applications, for making comprehensive changes to code. In the programs I've used and am familiar with, I'd use something along these lines: Find what: SEND("(w+)") Replace with: The previous line would have sent 1! This would have found a line that said: SEND("{ESCAPE}") and replaced it with "The previous line would have sent {ESCAPE}!" I've puzzled out how to MATCH the line I want to replace, for this application it would be Find What: MOUSECLICK("Left", w+, w+, w+) [d+ works fine too] But I cannot for the life of me figure out how to call that matched text in the replace function, and I cannot find a solution online. Granted it is 5am and I've been staring at this long enough to have manually changed every instance 10 times over, but I'm stubborn and want to know for future use. Thanks, sorry if I just missed the solution answered elsewhere, its 5am like I said.
PhoenixXL Posted September 8, 2013 Posted September 8, 2013 (edited) Welcome to the FORUM Renshai Can you post the code you are using at the moment and the expected result that the code fail to give ? To post Autoit code press the A in the formatting options of the editor and paste the code in the window that appears. Regards Edited September 8, 2013 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
Renshai Posted September 8, 2013 Author Posted September 8, 2013 I'm not trying to execute a code. I am using the Autoit editor's built in replace function, that allows for regular expressions, found in the Search -> Replace menu option.
Renshai Posted September 8, 2013 Author Posted September 8, 2013 I solved my problem by using a code editor that works as expected. =P If anyone knows the syntax to use the built in function, feel free to post a response.
Moderators Melba23 Posted September 8, 2013 Moderators Posted September 8, 2013 Renshai,Could I just point out that it is not the "AutoIt editor", but the "SciTE editor" with some tweaks to make it better for AutoIt coding. Anyway, that took some finding! You need to use "(" and ")" to delimit the capturing group - so using this as the Find:SEND("\(.*\)")and this as the Replace:The previous line would have sent \1carries out the replacement as you required. It is the find.replace.regexp.posix property that sets the capture boundary characters: find.replace.regexp.posixChange behaviour of Regular expression search. If set to 0 (the default), characters '(' and ')' must be escaped by '' to behave as regexp meta characters. If set to 1, these characters are meta characters itself.I hope you slept well - coding at 5AM is seldom a good idea. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Renshai Posted September 9, 2013 Author Posted September 9, 2013 I appreciate the response! And I wasn't aware that the editor wasn't inherent to the program, my mistake. I was a little frustrated after banging my tired head against the keyboard for so long, so I'm sorry if the tone of my message conveyed that. This answer explains why I could use w+ to catch a fragment of a line but not use it, and why (w+) would not catch anything at all. It was looking for the "(" as a character in the line of text, which is something I probably would have thought to check if it wasnt 5am =D On a side note, where do I modify this setting? I ran a search of file contents in the autoit program folder and turned up nothing. Thank you.
Moderators Melba23 Posted September 9, 2013 Moderators Posted September 9, 2013 Renshai,No problem - as I mentioned we are rarely at our best at 5AM. You find the SciTE options like the find.replace.regexp.posix one I mentioned above in the Global Options file (SciTE menu: <Options - Open Global Options File>). If you look in there you will see that this option has been commented out, meaning that the default is used. But I would not advise changing that file as it is overwritten when you update. Better to add the line to the User Options file (SciTE menu: <Options - Open User Options File>) as this is retained during updates. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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