Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!feeder3.eweka.nl!81.171.88.15.MISMATCH!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'handler': 0.04; 'much!': 0.05; 'mouse': 0.07; 'strings.': 0.07; 'url:msdn': 0.07; 'valueerror:': 0.07; 'ambiguity': 0.09; 'closest': 0.09; 'handler,': 0.09; 'pressing': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'valueerror': 0.09; 'gui': 0.11; 'library': 0.15; '"key"': 0.16; "(it's": 0.16; 'amiga': 0.16; 'chained': 0.16; 'character:': 0.16; 'clashes': 0.16; 'movements,': 0.16; 'perfect.': 0.16; 'pressed': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'url:visualstudio': 0.16; 'world!")': 0.16; 'string': 0.17; 'wrote:': 0.17; 'certainly': 0.17; 'instance': 0.17; 'pointed': 0.17; "shouldn't": 0.17; 'thu,': 0.17; '>>>': 0.18; 'input': 0.18; 'written': 0.20; 'meant': 0.21; 'releasing': 0.22; 'url:com)': 0.22; 'example': 0.23; 'raise': 0.24; 'idea': 0.24; 'allows': 0.25; 'least': 0.25; 'thanks!': 0.26; 'raw': 0.27; 'wonder': 0.27; 'subject:please': 0.27; 'thoughts': 0.27; "doesn't": 0.28; 'developing': 0.28; 'header:X-Complaints-To:1': 0.28; 'far.': 0.29; 'name?': 0.29; 'probably': 0.29; "i'm": 0.29; 'maybe': 0.29; 'function': 0.30; 'button': 0.30; 'anybody': 0.32; 'could': 0.32; "aren't": 0.33; 'automation': 0.33; 'controlling': 0.33; 'function.': 0.33; 'picking': 0.33; 'url:home': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'another': 0.33; 'that,': 0.34; 'done': 0.34; 'clear': 0.35; 'built-in': 0.35; 'nov': 0.35; 'received:org': 0.36; 'michael': 0.36; 'tool': 0.36; 'but': 0.36; 'wanted': 0.36; 'url:library': 0.36; 'method': 0.36; 'should': 0.36; 'thank': 0.36; 'charset:us-ascii': 0.36; 'uses': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'things': 0.38; 'there,': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'release': 0.39; 'easily': 0.39; 'called': 0.39; 'url:microsoft': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'url:aspx': 0.60; 'most': 0.61; 'letters': 0.62; 'between': 0.63; 'more': 0.63; 'here': 0.65; 'our': 0.65; '20,': 0.65; 'difficulty': 0.65; 'sound': 0.65; 'url:en-us': 0.65; 'wanting': 0.65; 'url:%1': 0.68; 'press': 0.71; 'click': 0.76; 'decades,': 0.84; 'distinguish': 0.84; 'injecting': 0.84; 'keystrokes': 0.84; 'mistaken': 0.84; 'dennis': 0.91; 'justice': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: 10 sec poll - please reply! Date: Fri, 23 Nov 2012 17:10:37 -0500 Organization: > Bestiaria Support Staff < References: <3d71f175-164e-494c-a521-2eaa5679b524@googlegroups.com> <818c157c-1395-441d-ad99-955a31b0d523@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-253-104-21.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 78 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1353708648 news.xs4all.nl 6922 [2001:888:2000:d::a6]:39297 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33865 On Thu, 22 Nov 2012 10:00:54 -0800 (PST), Michael Herrmann declaimed the following in gmane.comp.python.general: > These names aren't perfect. As Emile rightly pointed out, several tools distinguish between 'press' and 'release' and a user might wonder how to release a key that was pressed using 'press'. That's an ambiguity that is certainly there, however we hope that once the user has at least seen > press(ENTER) > it is clear what is meant. Distinguishing between pressing and releasing could we think easily be done with, say > hold_down(SHIFT) > ... > release(SHIFT) > Another ambiguity of 'press' that I pointed out in my original mail is that it could also be understood as "pressing a button". The current idea is to raise a ValueError if the user supplies a string that is longer than one character: > >>> press("OK") > ValueError: 'press' generates keystrokes and can only press single letters at a time. Did you maybe mean click("OK") or press('O', 'K')? > "press", "hold_down", "release" just sound so much like they should be commands to a /user/ not to a means of programmatically controlling an interface. A "user" presses a button -- but a program is just injecting the "event" of a button press into the input processing stream (it's been decades, but I still think in Amiga terms -- where all input events routed through one input handler and chained to the programs wanting to work with raw events... This meant that, but injecting the event codes before the input handler, a program could make another program [including the OS] think one had ejected/inserted floppies, mouse movements, keystrokes) "hold_down" and "release" would seem more memorable, and symmetric, if named "key_down" and "key_up"; and if "press" is limited to single codes -- "key" [or "keystroke"] The closest M$ .Net method is called SendKeys() and works with strings. http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.uitesting.keyboard.sendkeys%28v=vs.100%29.aspx > What do you think of this solution? I hope anybody read this far. I probably shouldn't have written that much but wanted to do justice to your inputs. > > Thanks! > > Michael > > On Tuesday, November 20, 2012 1:18:38 PM UTC+1, Michael Herrmann wrote: > > Hi, > > > > > > > > I'm developing a GUI Automation library (http://www.getautoma.com) and am having difficulty picking a name for the function that simulates key strokes. I currently have it as 'type' but that clashes with the built-in function. Example uses of 'type': > > > > > > > > type(ENTER) > > > > > > > > type("Hello World!") > > > > > > > > type(CTRL + 'a') > > > > > > > > What, in your view, would be the most intuitive alternative name? > > > > > > > > Here are my thoughts so far: I could call it 'press' but then our GUI automation tool also allows you to click things and then "press" might be mistaken for "pressing a button". A less ambiguous alternative is "type_keys" but that is rather long and doesn't read as well, for instance in type_keys(ENTER). > > > > > > > > Thank you very much! -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/