Jump to content

bug in send key repetition


Recommended Posts

  • Replies 42
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

That's a nice example, but what does it have to do with AutoIT?

Like I said several posts back, put in a feature request to see if it will be changed so that 0 means no keys sent. Other than that, you're just being petulant and wanting things to be your way. It's a valid feature request and might actually get somewhere.

The only thing you can do in the meantime is make sure that if the variable is zero that you skip the Send() function.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

skip the Send() function.

or clean up behind it

$quantity = "}{BS"

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Visual Basic equivalent, SendKeys, help page: http://msdn.microsoft.com/en-us/library/8c6yea83(v=vs.85).aspx

Wondering what it does when repetition quantity is <1...

The link doesnt say anything... What is you urge whit this? what do you expect for something that you dont create...? -.-

You can try this

Func _send($sKey,$iTimes)
    If $iTimes <= 0 then
        seterror(1)
        return ""
    Else
        send('{'&$sKey&' '&$iTimes&'}')
    EndIf
EndFunc
_send("a",0)

Use it every time you need...

Edited by monoscout999
Link to comment
Share on other sites

[alter ego mode = on] How can you be sure? did you read all the help page of AutoIt related to math operators to see if there are exceptions in AutoIt? [alter ego mode = off]

I dont need to pal, I could go to another planet, or dimension and still be sure of it.

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

That's a nice example, but what does it have to do with AutoIT?

From the homepage of this site, in BIG letters:

"autoit

AUTOMATION AND SCRIPTING LANGUAGE

AutoIt v3 is a freeware BASIC-like scripting language"

From http://www.autoitscript.com/site/autoit/

"Features:

Easy to learn BASIC-like syntax

Simulate keystrokes and mouse movements

[...]"

Link to comment
Share on other sites

The link doesnt say anything... What is you urge whit this? what do you expect for something that you dont create...? -.-

It's important for me because I will have to use a variable for quantity in future and this behaviour would force me to put an IF check to avoid the 0=1. I will also likely forget to put the IF check some times, I'm sure, because I use logic more than memory, and this bug will occur who knows when, maybe after months that I'm unaware that my program produced bad results, because there will not be explicit error...

-

Also consider this:

- page http://www.autoitscript.com/trac/autoit#FeatureRequestGuidelines states "Please take a few moment to read over this page to get an understanding of what you need to do in order to help the developers improve the AutoIt language. [...]

General Guidelines

[...]

Search the forum to see if the issue has been discussed there."

What's the meaning of this writings if all most people can do when one wants to propose a change in the forum before "officially" submitting it is to attack him?

You may think that I'm writing and repeating things too much... but it's because I still didn't understand if most of you prefers 0=1, 0=error, 0=0 for this command.

Why submitting a feature request if I'm not with the people?

Link to comment
Share on other sites

Just put in the feature request and stop beating it to death in here.

Just don't expect an overnight response to the Request. The Developers will read it and then decide if it should be implemented and after that (if it's accepted) they will get around to implemeneting it in some future version. Straight forward and simple as long as you follow the guidelines for the request.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

It's important for me because I will have to use a variable for quantity in future and this behaviour would force me to put an IF check to avoid the 0=1. I will also likely forget to put the IF check some times, I'm sure, because I use logic more than memory, and this bug will occur who knows when, maybe after months that I'm unaware that my program produced bad results, because there will not be explicit error...

I really have problems with your logic and fail to see how anyone sees logic in what you are saying.

You want to be able to call some function that you want not to be executed. Is that it?

Normally, exception from execution is done if the condition is already met. This is not the case here. Here it's contradiction.

The purpose of Send() is to send something. If you don't want it to send something then don't send. That's all to it.

Don't feature-request it.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

I really have problems with your logic and fail to see how anyone sees logic in what you are saying.

You want to be able to call some function that you want not to be executed. Is that it?

Normally, exception from execution is done if the condition is already met. This is not the case here. Here it's contradiction.

The purpose of Send() is to send something. If you don't want it to send something then don't send. That's all to it.

I really have problem in understanding how you find 0=1, 1=1, 2=2 ... more logic than 0=0, 1=1, 2=2 ...

Anyway I explain it with my real world case: in my enterprise, like in many enterprises, we use AS/400, that is a network served MS-DOS like text application with 24x80 characters window.

I developed and will develop many macroes that automatize it by reading/evaluating the screen and consequently sending characters to it.

Some times there are screens with lists of selectable lines, for example lists of bank movements in an account, and I need to automatically FIND a particular line of them and select it to make an action on that particular line.

Cursor starts on line 1 and moves to next lines with the TAB key. To move it for example to line 2 I have to press TAB 1 time, to select line 5 I have to press TAB 4 times. The universal rule is simply to press TAB key as many times as the number of the line to select minus 1.

I fastly found the AutoIT syntax to send a character a specified number of time so I thought: I will send TAB $linenumber-1 times (and I thought 1-1=0 so it would logically universally work, even for line 1).

In the following days an user (luckily) noticed me that my script in a case wrongly selected the second line instead than the first line.

I troubleshooted the script and wrote here and discovered what you know...

Func _send($sKey,$iTimes)
    If $iTimes <= 0 then
        seterror(1)
        return ""
    Else
        send('{'&$sKey&' '&$iTimes&'}')
    EndIf
EndFunc
_send("a",0)

¿¿Did you take the time to see this or just trolling??

You only write this once... and use the function _send() instead Send()

I know and I already explained two times why, at least for me, it's not preferable to have to remember to circumvent the problem this way nor to be tied to a function stored who knows why (to be copied or #included every time) in future scripts, when the instruction is so extremely simple and can remain so extremely simple, and as much logical as 0=0 is logical.
Link to comment
Share on other sites

you still miss the point... the help file says 1=1 2=2 3=3 and also says: any < 1 = 0

Who is ilogic? a 10 year old boy can undertand that,

we are speaking different things.

If you come here telling us Send() is wrong, open your eyes, then you fail, send() it`s fine, the help file says how to use it, YOU dont know how to use itYou know how to use it but you prefer to play to the logical mesias. please think where you are posting , this is a General Help and Support section, and we are not your philosophical mates.

If you have a problem with send()...

Just put in the feature request and stop beating it to death in here.

Then you can argue about logic with valik, jos and wherever you want....

Sorry my bad english and please think about the ilogic of discuss this instead of trying to solve it, and if no one give you the reason then be logical and go away, that is what i will do if i was in your possition..

again.... sorry my bad english...

Edited by monoscout999
Link to comment
Share on other sites

you still miss the point... the help file says 1=1 2=2 3=3 and also says: any < 1 = 0

WRONG!!!

The help doesn't say < 1 = 0, it says < 1 = 1 (or 0 = 1), that's the illogicality! your error makes evident to me that you prefer < 1 = 0, just like me! we prefer the same thing!

Edited by Imbuter2000
Link to comment
Share on other sites

The quote: "AutoIt v3 is a freeware BASIC-like scripting language" Implies, that while like BASIC, it is not exactly BASIC.

This is not a bug as you suggested. As the first reply pointed the way it behaves is even mentioned in the helpfile. (The AutoIt helpfile, not the BASIC helpfile, or your VCR manual) . It is at most a non-intuitive feature.

There are other places to request changes. (Or report bugs for that matter). This forum is for help and support, so here is some (more) of that:

This should behave exactly the same as Send(), with the exception that 0 repeates are stripped from the send string.

Func _Send($sKeys, $iFlag = 0)
    $sKeys = StringRegExpReplace($sKeys,"{[^}]+? 0}","")
    Return Send($sKeys, $iFlag)
EndFunc
Link to comment
Share on other sites

The quote: "AutoIt v3 is a freeware BASIC-like scripting language" Implies, that while like BASIC, it is not exactly BASIC.

Sure, I was only answering to the person who wrote that the Visual Basic SendKeys has *nothing* to do with AutoIT.

This is not a bug as you suggested. As the first reply pointed the way it behaves is even mentioned in the helpfile. (The AutoIt helpfile, not the BASIC helpfile, or your VCR manual) . It is at most a non-intuitive feature.

Ok, I agree on the "non-intuitive feature" definition.

There are other places to request changes. (Or report bugs for that matter). This forum is for help and support,

I wanted to discuss it before officially requesting the change and I found no better channel in this forum to do it.

so here is some (more) of that:

This should behave exactly the same as Send(), with the exception that 0 repeates are stripped from the send string.

Func _Send($sKeys, $iFlag = 0)
    $sKeys = StringRegExpReplace($sKeys,"{[^}]+? 0}","")
    Return Send($sKeys, $iFlag)
EndFunc

I know but my point here is not to solve the problem for a specific case. I already solved my first case with something like "If $linenumber > 1 Then send("{TAB " & $linenumber & "}")".

My point is prevention of future problems.

I will likely remember the syntax send("{TAB numberofrepeats}") for all my life but it's easy for me to forget that non-intuitive exception that if numberofrepeats < 1 then numberofrepeats = 1.

Link to comment
Share on other sites

Read this first.

The key will be send at least once even if the count is zero.

and please try to not to be this

# Do not be obnoxious, rude or in general a nuisance to the smooth operation of the forum.

you transform this in some "see me!!! i`m right" post Edited by monoscout999
Link to comment
Share on other sites

It's probably programmed as some type of C(++) equivalent to a Do loop, where a Do...Until loop will always execute at least once regardless of the value of the expression.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Developers

Believe the questions are answered in this thread so what about letting it alone when there is nothing to contribute any more.

Hate having to close threads just because people keep arguing ......

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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