bobbyab9987 Posted July 17, 2012 Share Posted July 17, 2012 Hi friends, I have searched this forum thoroughly but I couldn't find my answer yet. Basically I would like to write an AutoIt script to highlight any text (which could be a word, a character, ...) which is under the current position of the mouse cursor. Is this possible? If Yes, please suggest me a way to do it. Thank you very much. Link to comment Share on other sites More sharing options...
czardas Posted July 17, 2012 Share Posted July 17, 2012 (edited) This is not easy and methods will vary depending on circumstances. If you try to do this with an edit control that you created yourself then it should be quite feasible. You will need to use StringRegExp to identify the word at the coordinates. You could find the character nearest the mouse using MouseGetPos combined with _GUICtrlEdit_CharFromPos. However all this seems rather complicated to me. Edited July 17, 2012 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
bobbyab9987 Posted July 18, 2012 Author Share Posted July 18, 2012 This is not easy and methods will vary depending on circumstances. If you try to do this with an edit control that you created yourself then it should be quite feasible. You will need to use StringRegExp to identify the word at the coordinates. You could find the character nearest the mouse using MouseGetPos combined with _GUICtrlEdit_CharFromPos. However all this seems rather complicated to me.Hi czardas,Thank you for your response. However I would like my program to highlight text in any situation, no matter what I am doing. Several examples are reading pdf files, surfing the web, composing email and docs, etc.So in your opinion this task cannot be done with AutoIt? Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 18, 2012 Share Posted July 18, 2012 (edited) So you're reading some text that's on your screen, you see a word that you want to highlight, you move the cursor to that word and hit the HotKey to start the script and it Send's a double click (which selects whatever text is at the cursor postion). Does this meet your scenario? If so, this can probably be done this simply, but maybe not.. Edited July 18, 2012 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
bobbyab9987 Posted July 18, 2012 Author Share Posted July 18, 2012 (edited) So you're reading some text that's on your screen, you see a word that you want to highlight, you move the cursor to that word and hit the HotKey to start the script and it Send's a double click (which selects whatever text is at the cursor postion). Does this meet your scenario? If so, this can probably be done this simply, but maybe not..The functionality you described is exactly what I intend to do. However, if we are handling a hyperlink, we cannot send a double click to it, because if we do so, we would be navigated to the address pointed to by the hyperlink, and the text would not be highlighted in this case.Do you have any idea for special cases like that? Edited July 18, 2012 by bobbyab9987 Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 18, 2012 Share Posted July 18, 2012 I use to use this function, MouseClickDrag, in a similar situation. Maybe this would work too in your case. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
bobbyab9987 Posted July 18, 2012 Author Share Posted July 18, 2012 I use to use this function, MouseClickDrag, in a similar situation. Maybe this would work too in your case.Unfortunately this does not work. I have tried your method with a hyperlink on a google search-result page but nothing is highlighted.Thank you for your answer anyway Link to comment Share on other sites More sharing options...
0mar4fendi Posted January 7, 2015 Share Posted January 7, 2015 Hi everyone. I am very new to AutoIt, and I must thank you all for your support and help. In regards to this issue, I am using AutoIt to look for any word in RED and double click on > my search returns one hit though so you might want to update the script. $pixel = PixelSearch(1242,212,1765,466,0xFF0000) If IsArray($pixel) = True Then MouseMove($pixel [0], $pixel [1], 1) EndIf MouseClick("left",$pixel [0], $pixel [1],2) vicsar 1 -0mar4fendi Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 7, 2015 Moderators Share Posted January 7, 2015 0mar4fendi,Welcome to the AutoIt forums. But if you really must post in a fairly old thread, please at least post something relevant. 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...
vicsar Posted June 21, 2016 Share Posted June 21, 2016 Melba23, actually it is your post the one that does not contribute to this forum. For those interested, based on 0mar4fendim reply, I was able to complete a tiresome task. Here is my approach: ; Triger search Send("^f") Sleep(500) Send("@") Sleep(500) Send("{ENTER}") Sleep(2000) ;Find , in Chrome, the higlighted @ sign, yellow pixel $pixel = PixelSearch(470,193, 845,248, 0xffff00) ;Copy e-mail from X-OnlineApp MouseClick($MOUSE_CLICK_SECONDARY, $pixel[0], $pixel[1], 1, 0) Sleep(500) Send("e") Sleep(1000) Thanks 0mar4fendim, that is a very creative approach. - And yes I know this is an old post; however, even today people may have the same problem. --- vicsarhttps://about.me/vicsar Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 21, 2016 Moderators Share Posted June 21, 2016 vicsar, Thanks for that - I will give myself a stern talking-to sometime later this evening. M23 vicsar 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...
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