Prev: Detect whether a key is being held before script execution?
Next: how to delete the first two characters of each row?
From: Thomas Wilson on 13 Apr 2010 16:46 Command Line. I want to have the script launched at startup, by having a Terminal command call the script, then when the script executes, it determines whether or not the key is being held down and if it is, it then modifies the permissions of certain folders on my hard disk. I am using OSX. Andrew Mcelroy wrote: > On Tue, Apr 13, 2010 at 3:25 PM, Thomas Wilson <t.wilson775(a)gmail.com> > wrote: >> Hi All! >> >> I am looking for a way to have a script detect whether or not a key is >> pressed and held down before it runs. > Is this within the context of a web browser, command line interface, > or gui (like windows start up)? > > Your best bet is to automatically launch your first script which will > watch for user input, then conditionally launch the next part. > Without more info, I am not entirely sure what you are trying to > accomplish. > > > Andrew McElroy -- Posted via http://www.ruby-forum.com/.
From: Thomas Wilson on 13 Apr 2010 21:43
Could anybody possibly give me a code example of how to detect a keyboard event? I am new to Ruby and I am not quite familiar with the syntax yet. Thanks. Thomas Wilson wrote: > > Command Line. I want to have the script launched at startup, by having a > Terminal command call the script, then when the script executes, it > determines whether or not the key is being held down and if it is, it > then modifies the permissions of certain folders on my hard disk. > > I am using OSX. > > > > > Andrew Mcelroy wrote: >> On Tue, Apr 13, 2010 at 3:25 PM, Thomas Wilson <t.wilson775(a)gmail.com> >> wrote: >>> Hi All! >>> >>> I am looking for a way to have a script detect whether or not a key is >>> pressed and held down before it runs. >> Is this within the context of a web browser, command line interface, >> or gui (like windows start up)? >> >> Your best bet is to automatically launch your first script which will >> watch for user input, then conditionally launch the next part. >> Without more info, I am not entirely sure what you are trying to >> accomplish. >> >> >> Andrew McElroy -- Posted via http://www.ruby-forum.com/. |