carlton Posted August 31, 2006 Posted August 31, 2006 Hi, Firstly, I would just to say how brilliant AutoIT is and how shocked I am that it's free! Can you guys help me with the following: 1. Can AutoIT be used to return the currently pointed at word? I'm talking about grabbing words from something like Notepad, not IE. Using textbox commands I can get the current text cursor location, but I don't know how you would translate the mouse position to the textbox co-ords - help!!! 2. I have an AutoIT window with a listbox on it. I want a space bar press to signal that a value has been selected and to close the window. I can achieve this using a hotkey, but does anyone know of a quicker and simpler method? e.g. in VB this would be trapped by the listbox keypress event. Thanks
Thatsgreat2345 Posted August 31, 2006 Posted August 31, 2006 1. Can AutoIT be used to return the currently pointed at word? I'm talking about grabbing words from something like Notepad, not IE. Using textbox commands I can get the current text cursor location, but I don't know how you would translate the mouse position to the textbox co-ords - help!!!try controlgettext2. I have an AutoIT window with a listbox on it. I want a space bar press to signal that a value has been selected and to close the window. I can achieve this using a hotkey, but does anyone know of a quicker and simpler method? e.g. in VB this would be trapped by the listbox keypress event.check out _Ispressed in beta
carlton Posted September 1, 2006 Author Posted September 1, 2006 try controlgettextCan you give me anymore than that? I can read the word closest to the text cursor using ControlCommand, but I don't know how I can translate the current mouse position into a text box co-ord. Has anyone else tried this?If it was a fixed width font then I guess I could calculate the number of lines down and characters across, but it's not fixed width so it'll need a little magic!
Ármányos Kő Posted September 1, 2006 Posted September 1, 2006 Can you give me anymore than that? I can read the word closest to the text cursor using ControlCommand, but I don't know how I can translate the current mouse position into a text box co-ord. Has anyone else tried this?If it was a fixed width font then I guess I could calculate the number of lines down and characters across, but it's not fixed width so it'll need a little magic! I've been trying to get the answer for the same question ("...how I can translate the current mouse position into a text box co-ord....") ending up solving the issue on a totally different way. This script-part gets the length of the text up to the caret when wanted. I could use this data to return the caret later on by using _GUICtrlEditLineScroll or _GUICtrlEditSetSel Send("{SHIFTDOWN}") Send("{CTRLDOWN}") Send("{HOME}") Send("^c") Send("{SHIFTUP}") Send("{CTRLUP}") send("{left}") ;returns to the original caret pos. $uptocaret = Clipget() $uptocaretlength = Stringlen($uptocaret) As $uptocaret includes @CRLF parts, you can count which line you are in. Also, you can see how far you are from the last @CRLF. However this only works if the caret is in the control.If you think on hovering above text and read out words, the only hint I can give you is this> to find out the line number "under" the mouse I've created a small routin to check quickly the MousePos Y difference while doing a DOWNARROW, UPARROW keystroke. This was to measure the character size vertically. This measuring took place right after GUICreate and GUICtrlCreateEdit. Calculating desktopsize and window position values, I could manage to see above which line the mouse was later on.Let me know if anyone knows a solution to read out words (sentences) when hovering above "any wondow".
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