Jump to content

Have Autoit ask the user to click, then store?


CrewXp
 Share

Recommended Posts

I have a script that copies text using the mouse and shiftkey on the page by placing the mouse on a certain pixel on the page. Well if other computers want to use it, their resolution might not be the same or the window might not be positioned in the same spot. Is there a way to get it to copy the text when it's not in the same space. I'm thinking... Is there a way for it to ask the user to click somewhere then save that spot in a variable. Then from then on the mouse continue to move to that variable?

Example:

Firstname1 Lastname

Firstname2 Lastname

Firstname3 Lastname

The user would click just to the right of "Lastname" (the edge, but still in the text box so it can select it) and then it would save that pixel dimention in a variable. So from then on, it will copy Firstname1, then go down like 5 pixels, but keep the x-axis the same then do the same to Firstname2 and Lastname.

This may sound confusing, but it could relieve us a lot of trouble.

--What this does is select the text, then press like Ctrl and F6, then it indexes it. It's for a book. It indexes names.

Edited by CrewXp
Link to comment
Share on other sites

This can't be done (without days of scripting).

What I recomend is just saving the entire thing into clipboard, putting into a .txt, then use _FileReadToArray() to access the correct line of code or whatnot.

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

Is there a way for it to ask the user to click somewhere then save that spot in a variable. Then from then on the mouse continue to move to that variable?

To prompt and pick, try the code below.

To not have to pick the spot again, save the data in a file or in the registry and check for it the next time. The position data should be relative to the top left of the window in case the window moves.

HotKeySet("{SPACE}", "_GetMousePos")

; Adjust splash text location as needed (user can't drag)
; If you need to be able to move the splash text, design
; another hot key to move it using WinMove.
$iX = @DesktopWidth * 0.65
$iY = @DesktopHeight * 0.45
SplashTextOn("Get Name", "Place the mouse over last name," & @lf & "then press SPACE bar", 250, 50, $iX, $iY)
Dim $aPos[2]
$aPos[0] = -1
; Wait for space bar to be pressed
While $aPos[0] = -1
WEnd

SplashOff() 
MsgBox(4096, "Mouse Pos", $aPos[0] & "," & $aPos[1])
; do whatever
exit 

Func _GetMousePos ()
    $aPos = MouseGetPos()
; If you want to do anything else before
; exiting the while loop, do it here.
EndFunc; _GetMousePos

Phillip

Link to comment
Share on other sites

Thanks so much! I almost have this Script (Script2) completed due to your help phillip! Now I'm just workin on script1 which involves a read from the. This method will be used for speed, the other: thorough. Thanks!

<{POST_SNAPBACK}>

That's good to hear! Glad to help. Late Monday night, under a post in v3 Support titled "Handle Click Event", Layer gave a couple of examples that you may want to consider. One is the use of function _IsPressed ('01') which could be used to get the pick point by clicking the mouse rather than pressing a hot key. The other is the use of the function ToolTip() to display information. You could use that for the prompt instead of using SplashText so that you don't have to worry about it being in the way.

Phillip

Link to comment
Share on other sites

yea, this script is almost complete, now im just workin on the other

i still had one problem. It never seemed to read right from the file. If you read my post in that thread, it couldn't find the text that was clearly in there. What could be wrong?

http://www.autoitscript.com/forum/index.php?showtopic=7934

Edited by CrewXp
Link to comment
Share on other sites

yea, this script is almost complete, now im just workin on the other

i still had one problem. It never seemed to read right from the file. If you read my post in that thread, it couldn't find the text that was clearly in there. What could be wrong?

http://www.autoitscript.com/forum/index.php?showtopic=7934

<{POST_SNAPBACK}>

No clue, I haven't seen your script. Also, see my reply in the post you refernece.

Phillip

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...