Sign in to follow this  
Followers 0
suthers

Send(), ControlSend() & ControlCommand() strange behaviour

4 posts in this topic

Hi All,

This one is driving me barmy. In spite of trying many variations of Send(), ControlSend() & ControlCommand() I can't get reliable sending of characters to an edit control in the display properties of XP. The shift state of the characters is changed randomly, which totally mucks you up if it changes ':' to ';' in a file path.

There is a lot of mention of this in the forums, for example here , but no solution that I can find.

Is anyone aware of a solution or a reliable work-around?

Shalom

Bill

Share this post


Link to post
Share on other sites



Do you see the problem when sending single characters at a time? You can do that if you have to. Maybe write a UDF to send individual characters from a string.

Share this post


Link to post
Share on other sites

This is really weird. If I'm sending to an AutoIT GUI, in this case "Display", it messes things up...but when I try to send it to a Windows UI like IE or Notpad...it retains the characters as is.

Not sure what's causing the problem but that' what I've observed.


[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Now that's an approach I hadn't thought to try. Will let you know how I go...

+++++++

Mmmm....looks like setting up a loop to send the string as individual characters works, at least on initial testing. Here's the code. Putting in in a UDF would be trivial, but as it only happens in one place in my script I didn't bother. For my script the fact that this code truncates the $StringToSend variable to one character by the time it's finished didn't matter, but using a temp variable within the loop would be needed in $StringToSend was needed again later.

For $Counter = 1 to StringLen ($StringToSend)
$CharacterToSend = StringLeft ($StringToSend,1)
ControlSend ("Browse","","Edit1",$CharacterToSend,1)
$StringToSend = StringTrimLeft ($StringToSend,1)
Next

If it stands up over time & on multiple machines this will solve my problem.

++++++++++++++++

OK, this just keeps getting weirder. Sending as single characters works on some machines but not others. And on the machines it doesn't work, it's user account dependent. It works under some users but not others. Now to make things really weird, with a user account where it doesn't work, taking Num Lock off on the users keyboard makes it work, and once that's done once you can put Num Lock back on and it STILL works! My head is spinning.....is this totally unexplainable or is there some link between all this? At the moment I'll try switching Num lock off in the script before the characters are sent & see what happens.

++++++++++++++++

Well...partial success. On the user accounts where it wouldn't work before, putting a Send ("{NUMLOCK off}") just before the characters are sent gives a correct result about 70% of the time.

Still not a robust solution.

The ability to send characters is such a basic aspect of AutoIT GUI Automation I can't believe others haven't struck this enough for it to be an 'acknowledged' issue! But the lack of activity on this thread would seem to indicate otherwise....

Edited by suthers

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