Jump to content

Problem with Send cutting off characters


Recommended Posts

I'm having a problem with the Send commend cutting off the first few characters of the test that I'm sending. It doesn't do it always so I'm thinking this is a setting somewhere that can tell thing to slow down.

I already have the SendKeyDelay set to 50!

Any ideas?

Link to comment
Share on other sites

Well the code is pretty simple. I'm sending a file name to a file open box. I know the variable that stuffs the file to open is correct but sometimes it cuts off he first few letters!

In this case it is the Drive letter!

Send( "{DEL}" & $cFile & "{ENTER}" )
Link to comment
Share on other sites

So there is not a general problem with AutoIt and sending keystroks? If I restart the program the problem goes away so it leads me to believe AutoIt is having a buffering problem.

I've notice consistency is weird so I'm wondering if there are preferred practices that should be followed?

Link to comment
Share on other sites

There is a bug tracker you can peruse to see if there is an issue, but I havent seen one.

But seeing as how you seem unprepared to provide a full reproducing code to test, I fear your early days were will be frustrating ones.

Best of luck.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Well, I've been a programmer of one sort or another for over 20 years. I know the difference between a syntax error or a problem that is systemic to the environment and this appear to be a problem with the environment and not my code.

I have a constant HARDCODED that I'm sending to the keyboard and it sends different sometimes.

Thanks for your suggestions, I'm finding that using sleep() often is a good practice.

The only difference between it working and not working is my closing down the program! Sorry, but this is not a code problem.

Edited by Patchworks
Link to comment
Share on other sites

Well, I've been a programmer of one sort or another for over 20 years. I know the difference between a syntax error or a problem that is systemic to the environment and this appear to be a problem with the environment and not my code.

I have a constant HARDCODED that I'm sending to the keyboard and it sends different sometimes.

Thanks for your suggestions, I'm finding that using sleep() often is a good practice.

The only difference between it working and not working is my closing down the program! Sorry, but this is not a code problem.

Send can be unreliable. Usually I find that ControlSend is better but it still isn't certain that you will get what you want. The most common problem is missing characters, even with long delays set, and the next most common for me is wrong shift states which can result in the wrong character being sent, for example I want "(" but "9" is sent. Sending the same thing twice does not always give the same result.

The problems depend on what is receiving the characters. I have an application where the script opens a command prompt, uses SendKeepActive then sends lines of commands. I have used this for the last 4 years and I have cistomers who use it to start up some old DOS programs and there has never been a problem with missing or incorrect characters.

The fact is though that Send is not the same as typing on the keyboard.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 1 year later...

I've got the exact same problem. I suspect that the drive letter is indeed being sent by AutoIt but the FileOpenDialog is dropping it while trying to change drive letter or possibly populate the list of drive letters / paths to choose from.

I worked around the problem with the following

string myFile = @"C:\Path\To\File.txt";

autoit.ClipPut(myFile);

autoit.Send(@"{CTRLDOWN}v{CTRLUP}", 0);

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