litlmike Posted April 6, 2006 Share Posted April 6, 2006 Can't figure out what commands to use for this. I just would like to return to the cursor position I was at. I have a script running in the background that will run under certain conditions. It activates another window, sends a few commands, then re-activates the window I was just at. But I would like to return to where I was typing, etc. without moving my mouse, because I am so-friggin-lazy. So, is there a command like GetCurrentCursorPos, MoveCursorPos, ClickCursorPos, etc? _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
cdkid Posted April 6, 2006 Share Posted April 6, 2006 MouseClick allows X & Y positions, MouseGetPos will return the current X & Y position MouseMove allows X & Y coordinates. ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
seandisanti Posted April 6, 2006 Share Posted April 6, 2006 Can't figure out what commands to use for this. I just would like to return to the cursor position I was at.I have a script running in the background that will run under certain conditions. It activates another window, sends a few commands, then re-activates the window I was just at. But I would like to return to where I was typing, etc. without moving my mouse, because I am so-friggin-lazy.So, is there a command like GetCurrentCursorPos, MoveCursorPos, ClickCursorPos, etc?what kind of control is it that you want to reset the cursor in? you could just set focus to that control probably and controlsend("title","","^{END}") Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 6, 2006 Moderators Share Posted April 6, 2006 Might take a look at WinGetCarrotPos() Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
litlmike Posted April 6, 2006 Author Share Posted April 6, 2006 Might take a look at WinGetCarrotPos() Thanks everyone for the response. It's possible to use Mouse Coords, but it would take extra effort on my part everytime the script is called. Unfortunately, ControlFocus is not an option; the controls on this application are ridiculous. WinGetCaretPos might work. But, what comes after this command? WinPutCaretPos? WinFocusCaretPos? I guess this could work, but is there a better way?: $tmp = WinGetCaretPos () Sleep (2000) MouseClick ("left", $tmp) _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
seandisanti Posted April 6, 2006 Share Posted April 6, 2006 Thanks everyone for the response. It's possible to use Mouse Coords, but it would take extra effort on my part everytime the script is called. Unfortunately, ControlFocus is not an option; the controls on this application are ridiculous. WinGetCaretPos might work. But, what comes after this command? WinPutCaretPos? WinFocusCaretPos? I guess this could work, but is there a better way?: $tmp = WinGetCaretPos () Sleep (2000) MouseClick ("left", $tmp)there's still the control send (control + end) to the control in question, so that you'd be at the end of the text already there... Link to comment Share on other sites More sharing options...
litlmike Posted April 6, 2006 Author Share Posted April 6, 2006 there's still the control send (control + end) to the control in question, so that you'd be at the end of the text already there...That is a clever idea I must say, and I think I will use that on some of my other scripts. Unfortunately, with this app, I can't work with the controls (long story).Is there any other commands besides WinGetCaretPos, that I should be aware of? _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
seandisanti Posted April 6, 2006 Share Posted April 6, 2006 That is a clever idea I must say, and I think I will use that on some of my other scripts. Unfortunately, with this app, I can't work with the controls (long story).Is there any other commands besides WinGetCaretPos, that I should be aware of?what type of controls are you interacting with? are you able to give a screenshot of the app and the autoit window info with the control selected? Link to comment Share on other sites More sharing options...
greenmachine Posted April 6, 2006 Share Posted April 6, 2006 Might take a look at WinGetCarrotPos()The carrot position? Try in front of the rabbit.... Link to comment Share on other sites More sharing options...
seandisanti Posted April 6, 2006 Share Posted April 6, 2006 The carrot position? Try in front of the rabbit....BOOOO! sorry, i'm all about random jokes and what not, but come on man, that was bad. friends don't let friends make puns. Link to comment Share on other sites More sharing options...
pecloe Posted April 6, 2006 Share Posted April 6, 2006 The carrot position? Try in front of the rabbit....wabbit Link to comment Share on other sites More sharing options...
greenmachine Posted April 7, 2006 Share Posted April 7, 2006 BOOOO! sorry, i'm all about random jokes and what not, but come on man, that was bad. friends don't let friends make puns.I know it was bad, I was just pointing it out.. because seriously? WinGetCarrotPos??? What the hell is that? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 7, 2006 Moderators Share Posted April 7, 2006 I know it was bad, I was just pointing it out.. because seriously? WinGetCarrotPos??? What the hell is that?That was my stomach and my head talking at the same time Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
litlmike Posted April 7, 2006 Author Share Posted April 7, 2006 what type of controls are you interacting with? are you able to give a screenshot of the app and the autoit window info with the control selected? Kind of controls? Evil ones. Its an old database, you can see a .jpg at the link below. We in the forums, have had a very hard time interacting with these controls. I tried using my idea, but everytime it would go to the top-left of the screen and click, instead of where it just was. Any ideas? Oh, and I used CaretCoordMode 0, 1, and 2, all gave pretty much the same result. Maybe this means it is MDI, but I have no idea how to fix it. $tmp = WinGetCaretPos () Sleep (2000) MouseClick ("left", $tmp[0], $tmp[0]) ScreenShot of App _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 7, 2006 Moderators Share Posted April 7, 2006 Kind of controls? Evil ones. Its an old database, you can see a .jpg at the link below. We in the forums, have had a very hard time interacting with these controls. I tried using my idea, but everytime it would go to the top-left of the screen and click, instead of where it just was. Any ideas? Oh, and I used CaretCoordMode 0, 1, and 2, all gave pretty much the same result. Maybe this means it is MDI, but I have no idea how to fix it. $tmp = WinGetCaretPos () Sleep (2000) MouseClick ("left", $tmp[0], $tmp[0]) ScreenShot of AppGawd... your still trying to play with ACT...lol What MouseCoordMode did you use? (should probably be 2 if it's going to work at all) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jessem Posted May 21, 2006 Share Posted May 21, 2006 I'm assuming you want to just add into your current script. ;of course our trusty pause/break to trigger the mousegetpos and esc to cancel. HotKeySet("{ESC}", "Terminate") HotKeySet("{PAUSE}", "MOUSELOC") While 1 Sleep(100) WEnd Func MOUSELOC() $pos = MouseGetPos() MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1]); makes a mental note of where the curser curenly is. Sleep(5000); this would be replaced by the call from your script. but gives time to move your mouse in this example. MouseMove($pos[0], $pos[1]); recalls where it used to be and goes there. EndFunc Func Terminate() Exit 0 EndFunc This is what i would do personally, if I understand your need. If you incert the $pos = MouseGetPos() line before your script swtiches calls another screen, you can use the MouseMove($pos[0], $pos[1]) to get back to where your mouse was when you left. My app at work is java and lacks the controlfocus support also, so i feel your pain. =) Good Luck. 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