Jump to content

Keys written are not the good one


 Share

Recommended Posts

Hi

I had a little problem and I was wondering if it happend to you in the past.

From time to time, when I run a script, AutoIt doesn't type the proper keys.

For Exemple if I say to Autoit to execute the following command : Run ("C:\Program files\"), Au3 will type C:|Program files| .

It happens like less than 5% of the time I decide to run a script. I didn't change my keyboard language or my computer language. My keyboard language is in French(Canada) while my pc is in English. On my keyboard to type \ you have to press Ctrl-Alt and the key situated at the left of the number 1. While the | is shift and the same button.

I found a solution to correct the problem, when it happens I run the this script :

run("notepad.exe")
sleep(1000)
WinActivate("Untitled - Notepad")
Send("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\")
Send("|||||||||||||||||||||||||||||||||||||||||")

Then I re-run the script I wanted.

So I was wondering did you had a similar problem and do you have a better way to prevent this from happening again?

Many thanks

J-F

Link to comment
Share on other sites

I have been trying to find the post.. but I believe someone before said that in a low percentage of their Send()'s it would send the wrong key. I still havent found it though.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

  • Moderators

If the object your sending it to has a ControlID you may look at ControlSetText() rather than Send().

@Simucal - it was vollyman and someone else I believe :D

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

If the object your sending it to has a ControlID you may look at ControlSetText() rather than Send().

@Simucal - it was vollyman and someone else I believe :D

i'd put money on it that they're either pressing shift, or they have a shift down somewhere in their script. in situations where i have to use ControlSend or Send instead of ControlSetText, alot of times i'll have it use ascii values instead of typing the characters...example:

$string = "This is the string i want sent"
for $x = 1 to stringlen($string)
    Send(chr(asc(StringMid($string,$x,1))))
Next

it doesn't slow down execution too much, but makes it so that shift or capslock state won't affect keys being transmitted...

Link to comment
Share on other sites

Really usefull informations.

Many thanks to all of you.

Cameronsdad and SmOke_N, your tips are really usefull and it may help my scripts to be "bugs free"

no problem, always gald to help. and debugging is half of the fun....

***edit*** typo

Edited by cameronsdad
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...