TypeIn - a module that types instead of you!



Variables:
----------
TypeInDownTime:
    you shouldn't have to change this!
    It's the time (in ms) TypeIn waits between the WM_KEYDOWN and WM_KEYUP
    messages, in case your program is really too slow to react. Defaults to 0.
TypeInWaitTime:
    It's the time (in ms) TypeIn waits after each message before sending another
    one. I don't know if it can be of any use, but you never know! Defaults to 0.


Bangs:
------
!TypeIn string
!TypeIn "  string beginnning or ending with spaces that you want to be typed   "

simulates the keyboard entry of the text.
The preceding/trailing spaces are ignored - if you want to have spaces, enclose
the string in double quotes.
Double quotes are special characters used to enclose the string - to actually
have quotes typed in, use a ^" .
The ^ character is used to simulate everything that's not made of plain
printable characters, here's a list of its uses:

^T              TAB
^P              RETURN
^"              regular double quotes
^.              simulates a 10/1000 s. pause
^=000           the character with ANSI code 000... or is it UNICODE? Anyway, test
                by yourselves! (3 digits are expected)
^{@DATEFORMAT}  inserts the date/time in the format defined by the DATEFORMAT string
                (cf. below) - suggested by A.Evans
^{CODE}         simulates the 'virtual key' corresponding to CODE (cf. table below)
^_              toggles the WM_KEYDOWN mode: the following characters will be sent
                using WM_KEYDOWN instead of WM_CHAR messages until the next ^_
                Use it when the normal way doesn't work, or with the following
                modifiers:
^S              the characters will be sent as if the SHIFT key was pressed, until
                the next ^S
^C              the characters will be sent as if the CONTROL key was pressed, until
                the next ^C
^A              the characters will be sent as if the ALT key was pressed, until the
                next ^A

and lastly:
^^	         the ^ itself!

Note that the modifiers will only be used if ^_ was used before.
For instance, the three following commands are equivalent.
 !TypeIn "abcABC"
 !TypeIn "^_abcABC^_"
 !TypeIn "^_abc^Sabc^S^_"




The Virtual keys:
-----------------
They're about the same as those used in Hotkeys - here's a list anyway, straight
from the source:
(note that not all have been tested...)
      RETURN
      HOME	
      END   
      PAGEUP
      PAGEDOWN
      INSERT
      DELETE	
      TAB	  
      F1    
      F2    
      F3    
      F4    
      F5		
      F6		
      F7		
      F8		
      F9		
      F10   
      F11   
      F12   
      ESCAPE
      LEFT  
      RIGHT 
      UP		
      DOWN	
      SPACEBAR
      SPACE (same as SPACEBAR)
      BACKSPACE
      NUM0  
      NUM1  
      NUM2  
      NUM3  
      NUM4  
      NUM5  
      NUM6  
      NUM7  
      NUM8  
      NUM9  
      NUM+  
      NUM-  
      NUM*  
      NUM/  
      NUMDOT
      LMOUSE (does THIS really do anything??)
      RMOUSE
      MMOUSE



The date/time format:
---------------------
The format is the same as the on e used by Re5ource popup.dll, minus the internet time.

DATE
%A Weekday name (%a abbreviated)
%B Month name (%b abbreviated)
%c Date and time representation appropriate for locale
%d Day of month
%j Day of year
%m Month
%p Current locales A.M./P.M. indicator for 12-hour clock
%U Week of year, with Sunday as first day of week (00  53)
%w Weekday (0  6; Sunday is 0)
%W Week of year, with Monday as first day of week (00  53)
%x Date representation for current locale
%Y Year with century (%y without century)
%z, %Z Time-zone name or abbreviation; no characters if time zone is unknown

TIME
%H  Hour in 24-hour format
%I  Hour in 12-hour format
%M  Minute as decimal number
%S  Second as decimal number
%X  Time representation for current locale






Usage/Examples:
---------------
I use it binding the !TypeIn bang to litestep hotkeys.

The following bang will type my login & password in most web pages:
 !TypeIn "login^{TAB}password"

This one will even press the 'Enter' button that's just after:
 !TypeIn "login^{TAB}password^{TAB}^{SPACEBAR}"

And this one is for Hotmail, the well known very secure web based service that
MS could scan to personnal info about you if the hadn't any morals:
 !TypeIn "login^{TAB}^{TAB}password^{TAB}^{SPACEBAR}"

When setting up that kind of automatic job, you can first set
 TypeInDownTime 100
to slow down the whole thing and see every keypress as they happen.

The next one is one more step into writing macros:
 !Typein "^_^Co^C^_^.readme.txt^{RETURN}"
will fire up the 'open file' dialog (CTRL-O), then type in the name of the
desired file (readme.txt), then validate.

To insert the current time (in your current locale):
 !TypeIn ^{@%X}

Bugs/Limitations:
-----------------
- TypeIn probably won't work if you change applications (in fact threads) while
   typing: for instance !TypeIn "^{F1}^{RETURN}" will simulate F1, thus launching
   the help, but the return key will be sent to the original application. And if
   you set TypeInWaitTime so the help window has time to appear before RETURN is
   sent, it will not be sent because the help window belongs to the help program,
   not the original program.

- TypeIn sends the messages to the window currently receiving keyboard input,
   and if you're using desktop shortcuts to call TypeIn, the focus is probably on
   the desktop or anywhere but on your foremost window. So this window won't get
   the text. That's why TypeIn works better used with HotKeys.

- So you could have your mail signatures, name & address, email address, login &
   password typed automatically, just by pressing one key...
   But remember that the text to type is in your step.rc, and anyone could
   obviously read it since it's not coded.
   So don't tell us you've not been warned.

- The normal mode (WM_CHAR) should work with most editors, but some programs may
   not handle quite well the WM_KEYDOWN mode. Normally, WM_KEYDOWN messages are
   translated into WM_CHAR messages, but some applications can feel like
   intercepting it for their own pleasure (hotkeys or whatever). And if the 
   character you typed involves modifiers (for instance | on a french keyboard
   is AltGr 6), it may not work well (Word tranlates it into Ctrl -, the 
   hotkey for 'center text')

... and probably many others.

If you want me to know (and possibly DO something) about it, send the feedback
to:

keith001@writeme.com






Oh yes, and this whole stuff is of course copyrighted, but it's free software
too.
Free as free speech, not as free beer.
Practically, it means that you can freely redistribute it and/or modify it to
fit your needs, provided your modifications are free software too.
More precisely, this piece of code is under the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Of course, I coded this program because I had a use for it, and it's distributed
in the hope that it will be useful to you too, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
See again the GNU General Public License for more details.
Even programs you pay for don't offer you any warranty: you don't really expect
free ones to do so!
However, they offer you the best of all warranties: you can read the source and
check if it's ok.
And when it crashes, you can fix it yourself so next time it'll work.

You can get the GNU General Public License (and show your support to the guys
over there) by writing to the Free Software Foundation, Inc., 59 Temple Place -
Suite 330,
Boston, MA  02111-1307, USA.

But the best you can do for free software is to get a good book about C and
become a part of it.




Have fun!

