Jump to content

Weird problem with ControlSetText/ControlSend


Recommended Posts

Hi,

I've written a script that tries to automate sending of file path strings into a Save Dialog.

$myfile="c:\somedir\somefile.someext"
controlsettext("Save As","","Edit1",$myfile)

Normally it would send the correct string into the text box but after some time (after running other apps) these happens:

1. Using ControlSetText, there would be times that the script couldn't set the text into the text box

2. So I tried using ControlSend instead

controlsend("Save As","","Edit1",$myfile)

and the following string is sent into the textbox

c;-somedir-somefile.someext
or sometimes
C:|SOMEDIR|SOMEFILE.SOMEEXT

I restart windows and ContolSetText/ControlSend already works fine. Kinda weird, does anybody know what might be the problem here?

I'm using the AutoIt 3.2.4.9.

Thanks.

Link to comment
Share on other sites

Hi,

I've written a script that tries to automate sending of file path strings into a Save Dialog.

$myfile="c:\somedir\somefile.someext"
controlsettext("Save As","","Edit1",$myfile)

Normally it would send the correct string into the text box but after some time (after running other apps) these happens:

1. Using ControlSetText, there would be times that the script couldn't set the text into the text box

2. So I tried using ControlSend instead

controlsend("Save As","","Edit1",$myfile)

and the following string is sent into the textbox

c;-somedir-somefile.someext
or sometimes
C:|SOMEDIR|SOMEFILE.SOMEEXT

I restart windows and ContolSetText/ControlSend already works fine. Kinda weird, does anybody know what might be the problem here?

I'm using the AutoIt 3.2.4.9.

Thanks.

I've never experienced the scrambled text, but the occasional "missing" where the data doesn't get set/sent at all is usually fixed by doing ControlFocus() before Send/SetText/Click/etc.

:whistle:

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
Link to comment
Share on other sites

  • 2 weeks later...

I've never experienced the scrambled text, but the occasional "missing" where the data doesn't get set/sent at all is usually fixed by doing ControlFocus() before Send/SetText/Click/etc.

:)

I'll try that one out next time I encounter the problem again.

Thanks for the advice.

Cheers! :P

Link to comment
Share on other sites

controlsend("Save As","","Edit1",$myfile)

and the following string is sent into the textbox

c;-somedir-somefile.someext
or sometimes
C:|SOMEDIR|SOMEFILE.SOMEEXT

Thanks.

I've expereinced a similar problem on and off for some time with various versions of AutoIt3, using both Send() and ContolSend().

I've been able to minimize, but not entirely eliminate it, by checking, saving, and restoring the CapsLock state before/after the sending

(see gafrost's function http://www.autoitscript.com/forum/index.ph...ost&p=96980 for checking keystates)

Also, setting the "SendKeyDelay" option to higher numbers (so sends happen slower). Can be especially problematic if set to "0", but I've even had to make it slower/higher than the default of "5".

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...