Sign in to follow this  
Followers 0
leuce

To give "overtype" mode in programs that don't have it

1 post in this topic

#1 ·  Posted (edited)

G'day everyone

I want to add "overtype" mode to a text editing program that has only "insert" mode. Can you help me think of ways to do that? At this time I think the overtype mode should work only for letters of the alphabet and numbers (not for all keys). The only way I currently think it can be mimicked is to wait for the user to press a key, and then send "delete" so that the next character is deleted. Here's what I currently have:

#cs
This script adds "overtype" mode in programs that don't have it.  Basically, the script presses "delete" after typing every letter, and every letter is typed using a hotkey.
#ce

#include <Misc.au3>

$dll = DllOpen("user32.dll")

$capslock = 0

HotKeySet("a", "lettera")
HotKeySet("A", "letteracap")

While 1
If _IsPressed("14", $dll) Then ; 14 is CapsLock
If $capslock = 1 Then
$capslock = 0
Sleep ("100")
ElseIf $capslock = 0 Then
$capslock = 1
Sleep ("100")
EndIf
EndIf
WEnd

Func lettera()
HotKeySet("a")
If $capslock = 1 Then
HotKeySet("A")
Send ("A")
HotKeySet("A", "letteracap")
ElseIf $capslock = 0 Then
Send ("a")
EndIf
Send ("{DELETE}")
HotKeySet("a", "lettera")
EndFunc

Func letteracap()
HotKeySet("A")
Send ("A")
Send ("{DELETE}")
HotKeySet("A", "letteracap")
EndFunc

; ...etc for all letters, upper and lower case

DllClose($dll)

I have no idea how the script will perform when I add all 52 letters and 10 numbers. The number of hotkeys would be even higher for language with special characters, but for the moment I'd be happy if the 52 "English" letters are covered.

Can you think of a more economic way of tackling this problem?

Edited: I might add that I don't really care about which key the user pressed, as long as it is a letter or a number, before deleting the next character. The only reason I specify each letter individually in the above script is because I can't think of a way not to have to.

Thanks

Samuel

Edited by leuce

Share this post


Link to post
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
Sign in to follow this  
Followers 0