Jump to content

Keyboard mapping from early version not working


Recommended Posts

G'day,

I have an ".AHK" program from an early version of AutoIt and I can't make it work anymore.

What would be an equivalent approach in version 3? Or

has anyone still got an earlier version that would run this code?

I am using Windows 7 Pro, 64-bit

Here is the code:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
;
; Umlauts for German typing
!1::Send ä
!2::Send ö
!3::Send ü
!4::Send ß
!5::Send Ä
!6::Send Ö
!7::Send Ü
;
; Accent grave and acute lc
!a::Send à
!e::Send è
!i::Send ì
!o::Send ò
!u::Send ù
;
^!a::Send á
^!e::Send é
^!i::Send í
^!o::Send ó
^!u::Send ú
;
+^!a::Send Á
+^!e::Send É
+^!i::Send Í
+^!o::Send Ó
+^!u::Send Ú
;
+!a::Send À
+!e::Send È
+!i::Send Ì
+!o::Send Ò
+!u::Send Ù
;

I have tried using HotKeySet and Send, in this case inserting text, but I don't seem to be able to call up a Function.

HotKeySet("!0", "MyHotkeyHandler")
While 1
   Sleep(100)
WEnd

Func MyHotkeyHandler()
   $key = @HotKeyPressed
   Send("You pressed: " & $key,)
   MsgBox(0,"","Inside Function")
EndFunc

I would like to drop text or a special character into a document whenever I press the hot key combination.

Apart from the above dated program, I am new to AutoIt, but would like to get a handle one it.

Regards,

Paul K

 

Link to comment
Share on other sites

G'day,

I have an ".AHK" program from an early version of AutoIt and I can't make it work anymore.

What would be an equivalent approach in version 3? Or

has anyone still got an earlier version that would run this code?

I am using Windows 7 Pro, 64-bit

Here is the code:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
;
; Umlauts for German typing
!1::Send ä
!2::Send ö
!3::Send ü
!4::Send ß
!5::Send Ä
!6::Send Ö
!7::Send Ü
;
; Accent grave and acute lc
!a::Send à
!e::Send è
!i::Send ì
!o::Send ò
!u::Send ù
;
^!a::Send á
^!e::Send é
^!i::Send í
^!o::Send ó
^!u::Send ú
;
+^!a::Send Á
+^!e::Send É
+^!i::Send Í
+^!o::Send Ó
+^!u::Send Ú
;
+!a::Send À
+!e::Send È
+!i::Send Ì
+!o::Send Ò
+!u::Send Ù
;

I have tried using HotKeySet and Send, in this case inserting text, but I don't seem to be able to call up a Function.

HotKeySet("!0", "MyHotkeyHandler")
While 1
   Sleep(100)
WEnd

Func MyHotkeyHandler()
   $key = @HotKeyPressed
   Send("You pressed: " & $key,)
   MsgBox(0,"","Inside Function")
EndFunc

I would like to drop text or a special character into a document whenever I press the hot key combination.

Apart from the above dated program, I am new to AutoIt, but would like to get a handle one it.

Regards,

Paul K

 

I see 2 issues here.

First off, if hit Alt+0, it'll start itself into a loop because Send will trigger HotKeySet again, and again, and again.

Secondly, there's an extra comma after $key which is causing an error.

If we completely remove the line containing the send function:

HotKeySet("!0", "MyHotkeyHandler")
While 1
   Sleep(100)
WEnd

Func MyHotkeyHandler()
   $key = @HotKeyPressed
   MsgBox(0,"","Inside Function")
EndFunc

The code works and displays the message box.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

  • 3 weeks later...

I see 2 issues here.

First off, if hit Alt+0, it'll start itself into a loop because Send will trigger HotKeySet again, and again, and again.

Secondly, there's an extra comma after $key which is causing an error.

If we completely remove the line containing the send function:

HotKeySet("!0", "MyHotkeyHandler")
While 1
   Sleep(100)
WEnd

Func MyHotkeyHandler()
   $key = @HotKeyPressed
   MsgBox(0,"","Inside Function")
EndFunc

The code works and displays the message box.

Thank you. Solved. Apologies for answering late - I was away in hospital. pk

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