Sign in to follow this  
Followers 0
smellyfingers

ControlSend question

4 posts in this topic

Hi all,

I just have 1 simple question, i use ControlSend to fill info into a programs controlinputs, however sometimes it sends a character instead, Example

winwaitactive("myWin")

clipput("myInfo")

sleep(100)

controlfocus("myWin","","[CLASSNN:Ahx:233223]")

ControlSend("","","","^v")

This sends the v instead of pasting from clipboard (sometimes), would it be safer to have it send as a variable instead?

Many thanx!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Use ControlSetText() if you can.

controlfocus("myWin","","[CLASSNN:Ahx:233223]")
ControlSetText("myWin","","[CLASSNN:Ahx:233223]",ClipGet())

; else try
ControlSend("myWin","","[CLASSNN:Ahx:233223]",ClipGet())
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

I have tried that but the program doesn't trigger that a change is made that way it only responds to send and tab :(, i just wonder how it can fail to make a CTRL + V and only send a simple character?

I'm thinking that maybe it does the CTRLDOWN and CTRLUP before the v ? Maybe a workaround would be while Controlgettext <> myInfo, controlsettext "", Paste or send, Controlgettext ?

Share this post


Link to post
Share on other sites

Have you try playing with the SendKeyDownDelay and SendKeyDelay options? As in (help file):

Opt("SendKeyDelay", 5) ;5 milliseconds

Opt("SendKeyDownDelay", 1) ;1 millisecond

... but with bigger values? Their default values are 5, and I don't know what kind of application it is, but if stuff goes wrong with sending keystrokes (which I often get with non-standard window controls), that's always my first trial&error option. I don't really see where it would help with key combos with ctrl/shift/alt, but you never know. No matter how cool AutoIt is, simulating keystrokes remains very useful but murky business :)


Roses are FF0000, violets are 0000FF... All my base are belong to you.

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