Patchworks Posted July 20, 2011 Share Posted July 20, 2011 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 More sharing options...
JohnOne Posted July 20, 2011 Share Posted July 20, 2011 Its difficult to see where you are going wrong without any code to look at. 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 More sharing options...
Patchworks Posted July 20, 2011 Author Share Posted July 20, 2011 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 More sharing options...
JohnOne Posted July 20, 2011 Share Posted July 20, 2011 Cannot produce a problem, try something like this maybe. $cFile = "C:\dir\file.txt" Send( "{DEL}") Sleep(100) Send($cFile & "{ENTER}" ) 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 More sharing options...
Patchworks Posted July 21, 2011 Author Share Posted July 21, 2011 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 More sharing options...
JohnOne Posted July 21, 2011 Share Posted July 21, 2011 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 More sharing options...
Patchworks Posted July 21, 2011 Author Share Posted July 21, 2011 (edited) 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 July 21, 2011 by Patchworks Link to comment Share on other sites More sharing options...
martin Posted July 21, 2011 Share Posted July 21, 2011 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 More sharing options...
Xandy Posted July 21, 2011 Share Posted July 21, 2011 SendKeepActive, is looking promising. Thanks Martin, I'm going to keep investigating SendKeepActive(), I wasn't aware of this function. Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Patchworks Posted July 22, 2011 Author Share Posted July 22, 2011 Thanks guys for the explaination! I'll try these solution and see if I get the same erratic behavior! Link to comment Share on other sites More sharing options...
ryanwilliams Posted January 31, 2013 Share Posted January 31, 2013 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now