langthang084 Posted July 26, 2014 Share Posted July 26, 2014 i've a paragraph and I click random on it. So, how to recognize a character at the back of the control (in word) is alphabet or number? Link to comment Share on other sites More sharing options...
JohnOne Posted July 26, 2014 Share Posted July 26, 2014 What language? Unicode or ascii? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 26, 2014 Moderators Share Posted July 26, 2014 langthang084,If you are selecting characters rather then just placing the cursor in a random position within the text, then you can pass the selection to the clipboard and then use a RegEx to determine what it is:HotKeySet("{SPACE}", "_TestChar") HotKeySet("{ESC}", "_Exit") While 1 Sleep(10) WEnd Func _TestChar() ; Copy selection to the clipboard Send("^c") Sleep(100) ; Extract first character $sChar = StringLeft(ClipGet(), 1) ; Check if letter, digit or something else If StringRegExp($sChar, "[A-Za-z]") Then ConsoleWrite("Letter" & @CRLF) Return EndIf If StringRegExp($sChar, "[0-9]") Then ConsoleWrite("Number" & @CRLF) Return EndIf ConsoleWrite("Other" & @CRLF) EndFunc Func _Exit() Exit EndFuncAll clear? 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 Link to comment Share on other sites More sharing options...
langthang084 Posted July 26, 2014 Author Share Posted July 26, 2014 Thanks you! M23. But how to make script stop at the end of paragraph? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 26, 2014 Moderators Share Posted July 26, 2014 langthang084,First define "end of paragraph"! Seriously, what exactly are you trying to do? If we know the end result we can tailor our advice rather then just throw out random ideas. 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 Link to comment Share on other sites More sharing options...
langthang084 Posted July 26, 2014 Author Share Posted July 26, 2014 Ah! I want to stop at the last character (include "space"), after check character above Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 26, 2014 Moderators Share Posted July 26, 2014 langthang084,So you want to code to move along the text automatically? Again I ask: what is the desired end result of this script? In which app is the text you want to examine? Why are you checking the type of character? And finally, your definition of "end of paragraph" sounds like "end of word" to me. Much more detail, please. 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 Link to comment Share on other sites More sharing options...
langthang084 Posted July 26, 2014 Author Share Posted July 26, 2014 My paragraph like: "Aaasasssssssaaaaaa 2222222222222 33334444 Aaaaaaaaaa 12455666....." Total line is random but a line is only alphabet or number. So, i want to rearrange a number line be connected by the alphabet line. and finish when all line's done. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 26, 2014 Moderators Share Posted July 26, 2014 langthang084,One more attempt to get some sensible answers - and if I do not get any I am out of here. What is the purpose of all this? In what app does this "paragraph" appear? Are the lines separated by @CRLF as they are above, or something else? Please help us to help you by giving us some more information - because at the moment what you want to do is vey unclear. 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 Link to comment Share on other sites More sharing options...
langthang084 Posted July 26, 2014 Author Share Posted July 26, 2014 Hj. Sorry. The app is microsoft word. The lines are seperated by {enter}. All i want is change the layout of this paragraph Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 26, 2014 Moderators Share Posted July 26, 2014 langthang084,Select the paragraph, put the selected text into the ClipBoard and extract it as I showed you above. Then run StringReplace to replace CRLF with an empty string and repaste the result back into Word. M23 langthang084 1 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 Link to comment Share on other sites More sharing options...
langthang084 Posted July 27, 2014 Author Share Posted July 27, 2014 Sorry, My internet was off until now. I dont want to delete all enter. I want to connect all the number lines to the alphabet line abovet it. Like this: "AAAAAAA 111 222 333 BBBB 444 555" ===> "AAAAAAA: 111,222,333 BBBB: 444,555" the total alphabet and number lines are random, and there're many paragraphs like this. So I want to stop the script at "5" (End of paragraph or end of word like you understand) to run again with the new paragraph Link to comment Share on other sites More sharing options...
Malkey Posted July 27, 2014 Share Posted July 27, 2014 Here's to M23's patience. ; Select or highlight the text to be reformated, then press "space" while this script is running.. HotKeySet("{SPACE}", "_TestChar") HotKeySet("{ESC}", "_Exit") ; Press Esc to exit. While 1 Sleep(10) WEnd Func _TestChar() ; Copy selection to the clipboard Send("^c") Sleep(100) ; Extract characters Local $sText = ClipGet() ; Re-format text Local $sFormatedText = StringRegExpReplace($sText, "(?i)([a-z]+)(\v+)", "\1:") ;ConsoleWrite($sFormatedText & @LF & "==============" & @LF) $sFormatedText = StringRegExpReplace($sFormatedText, "(?m)(\d+)(\v+)", "\1,") ;ConsoleWrite($sFormatedText & @LF & "==============" & @LF) $sFormatedText = StringRegExpReplace($sFormatedText, "(?im)(\d+)(,)([a-z]+)", "\1" & @CRLF & "\3") ;ConsoleWrite($sFormatedText & @LF) ; or ClipPut($sFormatedText) Send("^v") EndFunc ;==>_TestChar Func _Exit() Exit EndFunc ;==>_Exit 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