Jump to content
Sign in to follow this  

Incorrect String Being Sent via ControlSend()

Recommended Posts


The following code gives me inconsistent results. Sometimes the string is sent correctly, but sometimes it is sent with minor variations. The latest one was supposed to send the following string:

"C:\_Work1\Dispense_Before.txt", but it sent this instead:

"C:|_Work1\Dispense_Before.txt". Close, but not quite, although, the same string is displayed in a msgbox at the end, and it was displayed correctly. In this case, it is sending the string to an Edit box in a Save As dialog, but I got the same results when sending strings to TMemo controls, too.

$saveAsName = $workLoc & $arTables[$tableIndx] & $suffix

$doesItExist = FileExists($saveAsName)

ControlSend("Save As", "", "[CLASS:Edit; INSTANCE:1]", $saveAsName)

ControlClick("Save As", "", "[CLASS:Button; INSTANCE:2]")

;if the file had already existed, then we will need to Confirm its replacement

if $doesItExist Then

ControlClick("Save As", "", "[CLASS:Button; INSTANCE:1]")



MsgBox(0, "File Saved", "File Saved as: " & $saveAsName)

Maybe I should mention that before this, the script is copying very large amounts of text to and from the clipboard. I have put what seems to be sufficient sleep() delays to allow the copy and pasting to complete. I have tested with extremely long delays, with the same inconsistent results.


Pete S

Share this post

Link to post
Share on other sites

This is mentioned in the helpfile and many times on the forum: Do you have CapsLock on?

As mention in the Send help the keyboard that send different chars when in CAPS LOCK and using the Shift Key cannot be simulated. An example is the Czech Keyboard. A good workaround is to use the ControlSetText.

Try using ControlSetText() for the control you want to update.

Jos :)

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
Live for the present,
Dream of the future,
Learn from the past.

Share this post

Link to post
Share on other sites

ive also had somthing close to this where it would capitalize random leters that wherent spose to be caped but not all where caped and not all where lower case... and delay didnt help either, but i used it on 2 or 3 different computers and 1 worked fine the other gave me this problem and the 3rd i dont remebere

Share this post

Link to post
Share on other sites

Using ControlSetText() worked beautifully for me. I do not have the CAPS lock on, am not using Shift, and I am not Czech or using a Czech keyboard, this is strange behavior.


I have also seen the random capitalization in some of the strings on a couple executions of this script. All seems well with the ControlSetText() function.

Thanks, Jos!

Pete S

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.