Sign in to follow this  
Followers 0
rezz

ClipGet and then Send to Form

3 posts in this topic

I am trying to setup a script that will get clipboard contents, a 10 digit phone number, and paste that number into a web form that has 3 sections and does not allow pasting. The form is divided like many phone # forms, area code, prefix, and number and automatically jumps to the next section after typing the required number of characters in a section. This prevents a straight copy/paste action and requires the data to be entered as individual numbers.

Here's the code I have came up with:

While 1
HotKeySet("+d", "PutPhone")
HotKeySet("{ESC}", "ExitPhone")
Sleep(300)
WEnd

Func PutPhone()
Local $temp = ClipGet()
$clip = $temp
Send($clip)
EndFunc   ;==>PutPhone

Func ExitPhone()
    Exit
EndFunc   ;==>ExitPhone

This works to send the clipboard contents as individual numbers and fills out the form correctly.

The problem arises after the hotkey is used.

Then, if you click on the page or even the desktop multiple items get highlighted and when trying to edit in Scite or another text editor multiple random text gets highlighted when clicking on the document.

Anyone know what is wrong or causing this after effect or how to prevent it and still accomplish the paste/send operation with the phone number?

Share this post


Link to post
Share on other sites



You don't do HotKeySet() in a loop like that. Nothing needs to be inside your loop except the sleep.

ControlSend() will target the data to the window/control instead of putting it in whatever happens to be active at the time, making it much better than Send().

"Then, if you click on the page..." Does that mean you are working with a web page? If so, investigate using the _IE* functions like _IEFormElementSetValue() (see help file).

:graduated:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I removed the hotkey from the while loop. Thanks.

Yes, this is a web-based database to search for people by phone number.

It seems that everything is working pretty good right now.

I noticed at one point that if I hit the shift key after using the hotkey shift+d everything seemed to be back to normal with no strange highlighting.

The while loop addition cured a problem with high CPU usage that was occurring at one point.

Does it make sense to move the clip to a temp file first before sending it as text characters via Send() ?

Thats why I added Local $temp = ClipGet()

Not sure if it is doing anything though with just that entry.

Share this post


Link to post
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
Sign in to follow this  
Followers 0