AutoHotkey Community

It is currently May 27th, 2012, 6:09 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: September 14th, 2009, 7:38 am 
Offline

Joined: June 4th, 2005, 1:54 am
Posts: 146
This is truly fantastic, Shaun. I've been waiting for something like this for a long long time. Awesome!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2010, 6:52 pm 
Hi this is great, now I can map my keyboard without microsoft drivers. The only thing is that is a problem now is I am so new to AHK that I do not understand the script. If anyone can help me out here would be great. I want to map zoom slider to "[" "]" keys on the keyboard.

thanks


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 18th, 2010, 3:58 am 
Offline

Joined: March 18th, 2008, 12:31 am
Posts: 63
Location: Barcelona, Catalonia
sutari wrote:
Hi this is great, now I can map my keyboard without microsoft drivers. The only thing is that is a problem now is I am so new to AHK that I do not understand the script. If anyone can help me out here would be great. I want to map zoom slider to "[" "]" keys on the keyboard.

thanks


hi sutari, I don't know much about AutoHotkey (and I don't know if you'll read this after 4 months), but I think that this code will do what you want, although the zoom slider is not suposed to send normal keys as the hardware sends repeated strokes.


Code:
; Capture input from the "Zoom" slider on the Natural Keyboard 4000
; and use it to scroll up and scroll down

; The HID top level collection for the Natural Keyboard 4000 is:
;   Usage         1
;   Usage Page   12

#NoTrayIcon

; Replace any previous instance
#SingleInstance force

DetectHiddenWindows, on
OnMessage(0x00FF, "InputMessage")

SizeofRawInputDeviceList := 8
SizeofRidDeviceInfo := 32

RIM_TYPEMOUSE := 0
RIM_TYPEKEYBOARD := 1
RIM_TYPEHID := 2

RIDI_DEVICENAME := 0x20000007
RIDI_DEVICEINFO := 0x2000000b

RIDEV_INPUTSINK := 0x00000100

RID_INPUT       := 0x10000003

Usage := 1
UsagePage := 12

Gui, Show, Hide, NaturalCapture

HWND := WinExist("NaturalCapture")

; Keyboards are always Usage 6, Usage Page 1, Mice are Usage 2, Usage Page 1,
; HID devices specify their top level collection in the info block   

VarSetCapacity(RawDevice, 12)
NumPut(RIDEV_INPUTSINK, RawDevice, 4)
NumPut(HWND, RawDevice, 8)
NumPut(UsagePage, RawDevice, 0, "UShort")
NumPut(Usage, RawDevice, 2, "UShort")     

Res := DllCall("RegisterRawInputDevices", "UInt", &RawDevice, UInt, 1, UInt, 12)
if (Res = 0)
   MsgBox, Failed to register for Natural Keyboard

InputMessage(wParam, lParam, msg, hwnd)
{
   global DoCapture
   global RIM_TYPEMOUSE, RIM_TYPEKEYBOARD, RIM_TYPEHID
   global RID_INPUT
   
   if (DoCapture = 0)
      return
   
   Res := DllCall("GetRawInputData", UInt, lParam, UInt, RID_INPUT, UInt, 0, "UInt *", Size, UInt, 16)
     
   VarSetCapacity(Buffer, Size)
   
   Res := DllCall("GetRawInputData", UInt, lParam, UInt, RID_INPUT, UInt, &Buffer, "UInt *", Size, UInt, 16)
   
   Type := NumGet(Buffer, 0 * 4)
   Size := NumGet(Buffer, 1 * 4)
   Handle := NumGet(Buffer, 2 * 4)
   
   ;AppendOutput("Got Input with " . Res . " size " . Size . " Type " . Type . " Handle " . Handle . "`r`n")
   
   if (Type = RIM_TYPEHID)
   {
      SizeHid := NumGet(Buffer, (16 + 0))
      InputCount := NumGet(Buffer, (16 + 4))
      ;Debug("HND " . Handle . " HID Size " . SizeHid . " Count " . InputCount . " Ptr " . &Buffer . "`r`n")
      Loop %InputCount% {
         Addr := &Buffer + 24 + ((A_Index - 1) * SizeHid)
         BAddr := &Buffer
         ;MsgBox, BAddr %BAddr% Addr %Addr%
         Input := Mem2Hex(Addr, SizeHid)
         ;Debug("Input " . Input . "`r`n")
         if (IsLabel(Input))
            Gosub, %Input%
      }
   }
   
   return
}
return

Exit

GuiClose:
ExitApp

; 1 = UP, 2 = DOWN
ScrollDir := 0

DoScroll:
ControlGetFocus, fcontrol, A
; WM_VSCROLL = 0x115, SB_LINEUP = 0, SB_LINEDOWN = 1

WinGetClass, ClassName, A
;Debug("Class " . ClassName)
if (InStr(ClassName, "Mozilla"))
{
   IsMozilla := 1
}
else
{
   IsMozilla := 0
}
Loop 1 {
   if (ScrollDir = 1)
   {
      if (IsMozilla)
         SendInput, {Up}
      else
         Send [
   }
   else
   {
      if (IsMozilla)
         SendInput, {Down}
      else
         Send ]
   }
}
;Debug("Done")
Return

; Zoom down
012E020000010000:
ScrollDir := 2
GoSub, DoScroll
SetTimer, DoScroll, 1080
return

; Zoom up
012D020000010000:
ScrollDir := 1
GoSub, DoScroll
SetTimer, DoScroll, 1080
return

; All up
0100000000010000:
ScrollDir := 0
SetTimer, DoScroll, Off
return

Debug(msg)
{
   OutputDebug, %msg%
   return
}

Mem2Hex( pointer, len )
{
 A_FI := A_FormatInteger
 SetFormat, Integer, Hex
 Loop, %len%  {
                   Hex := *Pointer+0
                   StringReplace, Hex, Hex, 0x, 0x0
                   StringRight Hex, Hex, 2           
                   hexDump := hexDump . hex
                   Pointer ++
                 }
 SetFormat, Integer, %A_FI%
 StringUpper, hexDump, hexDump
Return hexDump
}


What I did is remove the loop so it only sends one keystroke and increase the timer so it takes a long time to send two keystrokes. It still scrolls on Mozilla, you can eliminate that if you want.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 3rd, 2010, 4:02 am 
Offline

Joined: July 14th, 2010, 9:50 pm
Posts: 6
First of all, thank you so much for this thread!
Well, when I remap the arrow keys into favorite keys, I can get the navigation correctly (i.e. word processor), but when I try it with shortcut keys, it does not work. For example, Win+Left will not give me the half screen in Windows 7.
I can remap left key into 'b' like this
Code:
*b::SendInput {Blind}{Right}

and it works, but if I do
Code:
 ; Favorites 2
 0100000000090000:
 SendInput {Blind}{Left}
 return

it does not work. Is there any way to key around this problem?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2010, 3:08 pm 
Offline

Joined: October 31st, 2010, 6:27 am
Posts: 2
this is awesome! Thank you very much. I've tamed my MS keyboard horse )

But actually I've spent a few hours for that... And the problem was DLL calls you use do not work under win7x64 if you install 64-bit version of autohotkey... But discovering that took me whole life...

But now It is ok. I do not remap all the extra keys - I use intelliType too (but disabled remapped keys, otherwise events duplicate each other and do double work). Remapped keys are very clever now =) for example, My Favorites launches Total Commander if it is not launched or brings to front if it exist. So do PlayPause button with aimp.

Code:
; My Favorites
0182010000010000:
   If WinExist("ahk_class TTOTAL_CMD")
       WinActivate ; use the window found above
   else
       Run d:\distrib\TotalCommander\Totalcmd7\LaunchTC.lnk


Code:
; Play-Pause button
01CD000000010000:
    If WinExist("ahk_class TAIMP2MainW")
    {
        Send ^!+p ; this is my AIMP's global hot key - CtrlAltShiftP
    }
    else
    {
        Run d:\distrib\AIMP\AIMP2\AIMP2.exe
        while !(WinExist("ahk_class TAIMP2MainW"))
        {
            Sleep 333
        }
        Sleep 999
        Send ^!+p
    }


To find out this key code 01CD000000010000 I have to use VMWare and WinXP 32 bit (this is how I've managed to run all these scripts at all including AHKHID http://www.autohotkey.com/forum/viewtop ... 910226214f


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2010, 7:03 pm 
wow I can not reproduce catching codes for special buttons =(( I mean favorites keys and other extra. I use vmware and WinXP, I use my win7x64 and autohotkey in all of them... different versions of autohotkey. Just do not know what to do )))


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2010, 7:23 pm 
Offline

Joined: October 31st, 2010, 6:27 am
Posts: 2
oh I have just misplaced usage and usage page.

Use AHKHID example 2 and type 12 as usage page and 1 as usage. Then you will be able to catch ms natural 4000 extra buttons


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2011, 2:29 pm 
Offline

Joined: March 18th, 2008, 12:31 am
Posts: 63
Location: Barcelona, Catalonia
blablaman1 wrote:
the problem was DLL calls you use do not work under win7x64 if you install 64-bit version of autohotkey... But discovering that took me whole life...


I also found that the script doesn't work when using the new AutoHotkey_L v1.0.92.00. What should we do? Does anybody know how to fix it?

When I load the script it says "Failed to register for Natural Keyboard". :cry:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 5th, 2011, 8:35 pm 
OK, so I butchered the original script a little to adapt it for x64 platform. The problem was with the fact that Windows pointer types became twice as big in x64 so the original structs didn't fit the actual messages. NumGet is also platform sensitive so the data sizes need to be stated explicitly in every call. I also tried to get rid of all the "magic numbers" in the original code to improve readability a little.

Code:
; Capture input from the "Zoom" slider on the Natural Keyboard 4000
; and use it to scroll up and scroll down

; The HID top level collection for the Natural Keyboard 4000 is:
;   Usage         1
;   Usage Page   12

#NoTrayIcon

; Replace any previous instance
#SingleInstance force

C(str) ; const container
{
return, (%str%)
static MS_SHORT := 2
static MS_DWORD := 4
static MS_PTR := 8 ;x64 specific

static SizeofRawInputDevice := MS_SHORT*2 + MS_DWORD + MS_PTR
/*
typedef struct tagRAWINPUTDEVICE {
  USHORT usUsagePage;
  USHORT usUsage;
  DWORD  dwFlags;
  HWND   hwndTarget;
} RAWINPUTDEVICE, *PRAWINPUTDEVICE, *LPRAWINPUTDEVICE;
*/

static SizeofRawInputDataHeader := MS_DWORD*2 + MS_PTR*2
/*
typedef struct tagRAWINPUTHEADER {
  DWORD  dwType;
  DWORD  dwSize;
  HANDLE hDevice;
  WPARAM wParam;
} RAWINPUTHEADER, *PRAWINPUTHEADER;
*/

static RIM_TYPEMOUSE := 0
static RIM_TYPEKEYBOARD := 1
static RIM_TYPEHID := 2

static RIDI_DEVICENAME := 0x20000007
static RIDI_DEVICEINFO := 0x2000000b

static RIDEV_INPUTSINK := 0x00000100 ; receive in foreground
static RID_INPUT       := 0x10000003 ; request header

; Keyboards are always Usage 6, Usage Page 1, Mice are Usage 2, Usage Page 1,
; HID devices specify their top level collection in the info block   
static Usage := 1
static UsagePage := 12
}

HID_Input_Init:
{
DetectHiddenWindows, on
OnMessage(0x00FF, "InputMessage")

Gui, Show, Hide, NaturalCapture

HWND := WinExist("NaturalCapture")

VarSetCapacity(RawInputDevice, C("SizeofRawInputDevice"))
NumPut(C("UsagePage"), RawInputDevice, 0)
NumPut(C("Usage"), RawInputDevice, C("MS_SHORT"))
NumPut(C("RIDEV_INPUTSINK"), RawInputDevice, C("MS_SHORT")*2)
NumPut(HWND, RawInputDevice, C("MS_SHORT")*2 + C("MS_DWORD"))

Res := DllCall("RegisterRawInputDevices", "UInt", &RawInputDevice, UInt, 1, UInt, C("SizeofRawInputDevice"))
if (Res = 0)
    MsgBox, Failed to register for Natural Keyboard

return
}

InputMessage(wParam, lParam, msg, hwnd)
{
    Res := DllCall("GetRawInputData", UInt, lParam, UInt, C("RID_INPUT"), UInt, 0, "UInt *", Size, UInt, C("SizeofRawInputDataHeader"))

    VarSetCapacity(RawInputData, Size)

    Res := DllCall("GetRawInputData", UInt, lParam, UInt, C("RID_INPUT"), UInt, &RawInputData, "UInt *", Size, UInt, C("SizeofRawInputDataHeader"))

    SetFormat, Integer, Hex
    Type := NumGet(RawInputData, 0, "UInt")
    Size := NumGet(RawInputData, 1 * C("MS_DWORD"), "UInt")
    Handle := NumGet(RawInputData, 2 * C("MS_DWORD"), "UInt64") ; x64 specific

    if (Type = C("RIM_TYPEHID"))
    {
        SizeHid := NumGet(RawInputData, (C("SizeofRawInputDataHeader") + 0), "UInt")
        InputCount := NumGet(RawInputData, (C("SizeofRawInputDataHeader") + C("MS_DWORD")), "UInt")
        Loop %InputCount% {
            Addr := &RawInputData + C("SizeofRawInputDataHeader") + C("MS_DWORD")*2 + ((A_Index - 1) * SizeHid)
            BAddr := &RawInputData
            Input := Mem2Hex(Addr, SizeHid)
          ;MsgBox, %Input%
         /*
         if (Input != 0100000000010000 && Input != 0100000000000000)
         {
             SoundPlay, *64
             clipboard = %clipboard%`r`n%Input%
         }
         */
            if (IsLabel(Input))
            Gosub, %Input%
        }
    }
    else

    return
}

Scroll:
{
    if (ScrollDirection == 1)
   {
      SendInput, {up}
   }
   else if (ScrollDirection == 2)
   {
      SendInput, {down}
   }
   return
}

; Zoom up
012D020000010000:
ScrollDirection := 1
GoSub Scroll
SetTimer, Scroll, 50
return

; Zoom down
012E020000010000:
ScrollDirection := 2
GoSub Scroll
SetTimer, Scroll, 50
return

; All up
0100000000010000:
ScrollDirection := 0
SetTimer, Scroll, Off
return

Mem2Hex(pointer, len)
{
    A_FI := A_FormatInteger
    SetFormat, Integer, Hex
   Loop, %len% {
                    Hex := *Pointer+0
                    StringReplace, Hex, Hex, 0x, 0x0
                    StringRight Hex, Hex, 2
                    hexDump := hexDump . hex
                    Pointer ++
                }
    SetFormat, Integer, %A_FI%
    StringUpper, hexDump, hexDump
    Return hexDump
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2011, 3:38 pm 
Kuklakot you are my hero :D

I don't like using up and down as scrolling though so here is my take on it (plus a few hotkeys and different keycodes)

Code:
; Capture input from the "Zoom" slider on the Natural Keyboard 4000
; and use it to scroll up and scroll down

; The HID top level collection for the Natural Keyboard 4000 is:
;   Usage         1
;   Usage Page   12

#NoTrayIcon

; Replace any previous instance
#SingleInstance force

C(str) ; const container
{
return, (%str%)
static MS_SHORT := 2
static MS_DWORD := 4
static MS_PTR := 8 ;x64 specific

static SizeofRawInputDevice := MS_SHORT*2 + MS_DWORD + MS_PTR
/*
typedef struct tagRAWINPUTDEVICE {
  USHORT usUsagePage;
  USHORT usUsage;
  DWORD  dwFlags;
  HWND   hwndTarget;
} RAWINPUTDEVICE, *PRAWINPUTDEVICE, *LPRAWINPUTDEVICE;
*/

static SizeofRawInputDataHeader := MS_DWORD*2 + MS_PTR*2
/*
typedef struct tagRAWINPUTHEADER {
  DWORD  dwType;
  DWORD  dwSize;
  HANDLE hDevice;
  WPARAM wParam;
} RAWINPUTHEADER, *PRAWINPUTHEADER;
*/

static RIM_TYPEMOUSE := 0
static RIM_TYPEKEYBOARD := 1
static RIM_TYPEHID := 2

static RIDI_DEVICENAME := 0x20000007
static RIDI_DEVICEINFO := 0x2000000b

static RIDEV_INPUTSINK := 0x00000100 ; receive in foreground
static RID_INPUT       := 0x10000003 ; request header

; Keyboards are always Usage 6, Usage Page 1, Mice are Usage 2, Usage Page 1,
; HID devices specify their top level collection in the info block   
static Usage := 1
static UsagePage := 12
}

HID_Input_Init:
{
DetectHiddenWindows, on
OnMessage(0x00FF, "InputMessage")

Gui, Show, Hide, NaturalCapture

HWND := WinExist("NaturalCapture")

VarSetCapacity(RawInputDevice, C("SizeofRawInputDevice"))
NumPut(C("UsagePage"), RawInputDevice, 0)
NumPut(C("Usage"), RawInputDevice, C("MS_SHORT"))
NumPut(C("RIDEV_INPUTSINK"), RawInputDevice, C("MS_SHORT")*2)
NumPut(HWND, RawInputDevice, C("MS_SHORT")*2 + C("MS_DWORD"))

Res := DllCall("RegisterRawInputDevices", "UInt", &RawInputDevice, UInt, 1, UInt, C("SizeofRawInputDevice"))
if (Res = 0)
    MsgBox, Failed to register for Natural Keyboard

return
}

InputMessage(wParam, lParam, msg, hwnd)
{
    Res := DllCall("GetRawInputData", UInt, lParam, UInt, C("RID_INPUT"), UInt, 0, "UInt *", Size, UInt, C("SizeofRawInputDataHeader"))

    VarSetCapacity(RawInputData, Size)

    Res := DllCall("GetRawInputData", UInt, lParam, UInt, C("RID_INPUT"), UInt, &RawInputData, "UInt *", Size, UInt, C("SizeofRawInputDataHeader"))

    SetFormat, Integer, Hex
    Type := NumGet(RawInputData, 0, "UInt")
    Size := NumGet(RawInputData, 1 * C("MS_DWORD"), "UInt")
    Handle := NumGet(RawInputData, 2 * C("MS_DWORD"), "UInt64") ; x64 specific

    if (Type = C("RIM_TYPEHID"))
    {
        SizeHid := NumGet(RawInputData, (C("SizeofRawInputDataHeader") + 0), "UInt")
        InputCount := NumGet(RawInputData, (C("SizeofRawInputDataHeader") + C("MS_DWORD")), "UInt")
        Loop %InputCount% {
            Addr := &RawInputData + C("SizeofRawInputDataHeader") + C("MS_DWORD")*2 + ((A_Index - 1) * SizeHid)
            BAddr := &RawInputData
            Input := Mem2Hex(Addr, SizeHid)
          ;MsgBox, %Input%
         /*
         if (Input != 0100000000010000 && Input != 0100000000000000)
         {
             SoundPlay, *64
             clipboard = %clipboard%`r`n%Input%
         }
         */
            if (IsLabel(Input))
            Gosub, %Input%
        }
    }
    else
    return
}

; 1 = UP, 2 = DOWN
ScrollDir := 0

DoScroll:
ControlGetFocus, fcontrol, A
; WM_VSCROLL = 0x115, SB_LINEUP = 0, SB_LINEDOWN = 1

Loop 1
{
   if (ScrollDir = 1)
      SendInput, {WheelUp} 
   else
      SendInput, {WheelDown}
}
Return

; //  Special Keys  //
   ; ++  Function Keys  ++
      ; Function Key "="
      0100006700000000:
      Send {=}
      return
      
      ; Function Key "("
      010000B600000000:
      Send {(}
      return
      
      ; Function Key ")"
      010000B700000000:
      Send {)}
      return

   ; ++  Favorites Keys  ++
      ; Favorites 1
      0100000000040000:
      Send {)}
      return
      
      ; Favorites 2
      0100000000080000:
      Send {)}
      return
      
      ; Favorites 3
      0100000000100000:
      Send {)}
      return
      
      ; Favorites 4
      0100000000200000:
      Send {)}
      return
      
      ; Favorites 5
      0100000000400000:
      Run "C:\Program Files\uTorrent\utorrent.exe"
      return
      
      ; My Favorites
      0182010000000000:
      Run "C:\Program Files\uTorrent\utorrent.exe"
      return

   ; ++  Media Keys  ++
      ; Play/Pause
      01CD000000000000:
      If WinExist("ahk_class XMPLAY-MAIN")
            ControlSend, , {Media_Play_Pause}, ahk_class XMPLAY-MAIN
      else
      {
         Run "D:\Archiwum\Programy\Inne\Music Players\XMPlay\XMPlay.exe"
         while !(WinExist("ahk_class XMPLAY-MAIN"))         
            Sleep 333         
         Sleep 999
         ControlSend, , {Media_Play_Pause}, ahk_class XMPLAY-MAIN
      }
      return

      ; Calculator
      0192010000000000:
      Run "D:\Archiwum\Programy\System\Narzedzia\Windows7-calculator\Calc.exe"
      return
   ; ++  Zoom/Scroll Keys  ++
      ; Zoom Down
      012E020000000000:
      ScrollDir := 2
      GoSub, DoScroll
      SetTimer, DoScroll, 80
      return

      ; Zoom Up
      012D020000000000:
      ScrollDir := 1
      GoSub, DoScroll
      SetTimer, DoScroll, 80
      return
      
   ; All up
   0100000000000000:
   ScrollDir := 0
   SetTimer, DoScroll, Off
   return
   
   ; ++  Standard Special Keys  ++
   Launch_Mail::Run "C:\Program Files (x86)\Mozilla\Thunderbird\thunderbird.exe"
   Browser_Search::Run "C:\Program Files (x86)\Avira\AntiVir Desktop\avscan.exe" /GUIMODE=1 /PATH="c:\"
   Browser_Home::DllCall("PowrProf\SetSuspendState", "int", 0, "int", 1, "int", 0)

; //  Combinations  //
   ^PgUp::ControlSend, , ^{PgUp}, ahk_class XMPLAY-MAIN
   ^PgDn::ControlSend, , ^{PgDn}, ahk_class XMPLAY-MAIN
   ^End::ControlSend, , ^{End}, ahk_class XMPLAY-MAIN

; //  Buttons Customized for Applications  //
   if (InStr(ClassName, "Mozilla") or InStr(ClassName, "Opera"))
       Browser_Forward::^Right
   
Debug(msg)
{
   OutputDebug, %msg%
   return
}

Mem2Hex( pointer, len )
{
   A_FI := A_FormatInteger
   SetFormat, Integer, Hex
   Loop, %len% 
   {
        Hex := *Pointer+0
        StringReplace, Hex, Hex, 0x, 0x0
        StringRight Hex, Hex, 2           
        hexDump := hexDump . hex
        Pointer ++
    }
   SetFormat, Integer, %A_FI%
   StringUpper, hexDump, hexDump
   Return hexDump
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2011, 10:13 am 
Offline

Joined: November 16th, 2011, 9:42 pm
Posts: 5
Hi, I am trying to use the script and I get this error message:

Quote:
Warning: Local variable with same name as global.

Specifically: Res (in function InputMessage)

I use AutoHotKey_L and I haven't loaded the IntelliType Driver.

The script is not loaded (although problem is a Warning and not an Error)

Any ideas what am I doing wrong?

EDIT: Sorry, the script is actually loaded but the icon is not shown. I can tell this because I have remapped some keys to skip to next and previous media track and it works. However, zoom button is not responding


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 22nd, 2011, 10:39 pm 
Offline

Joined: January 28th, 2006, 1:23 am
Posts: 89
Location: Germany
Very useful script. One thing to add:

0100000000010000 means that no key is pressed.

If you want to find out when Key <insert single key here> was released you have to write into a variable, which one was used. This can be quite annoying with many hotkeys. Can you add a workaround so you know which key was released in addition to no key being pressed.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 1st, 2012, 5:14 pm 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
How can we find out those strings for the various labels?

Code:
Zoom down
012E020000010000:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Remapping F-Lock
PostPosted: February 12th, 2012, 9:20 am 
Offline

Joined: February 12th, 2012, 8:53 am
Posts: 21
@automaticman: You have to use the first script posted in this thread. Copy the code into an .ahk file and run it. Click on "Capture on" button and press the key you need. Click on "Capture off" and copy the information. Voila.

If anyone wants to script the F-Lock key, several changes need to be made as its status changes the messages sent by many of the other special keys. Here is what I use in my script:

Code:
; Zoom down
012E020000000000:
012E020000010000:
ScrollDir := 2
GoSub, DoScroll
SetTimer, DoScroll, 80
return

; Zoom up
012D020000000000:
012D020000010000:
ScrollDir := 1
GoSub, DoScroll
SetTimer, DoScroll, 80
return

; All up
0100000000000000:
0100000000010000:
ScrollDir := 0
SetTimer, DoScroll, Off
return

;numpad=
0100006700000000:
0100006700010000:
msgbox equal
return

;numpad(
010000B600000000:
010000B600010000:
msgbox (
return

;numpad)
010000B700000000:
010000B700010000:
msgbox )
return

; My Favorites
0182010000000000:
0182010000010000:
   MsgBox My Favorites Button
return
; Favorites 1
0100000000040000:
0100000000050000:
   MsgBox Favorites 1
return
; Favorites 2
0100000000080000:
0100000000090000:
   MsgBox Favorites 2
return
; Favorites 3
0100000000100000:
0100000000110000:
   MsgBox Favorites 3
return
; Favorites 4
0100000000200000:
0100000000210000:
   MsgBox Favorites 4
return
; Favorites 5
0100000000400000:
0100000000410000:
   MsgBox Favorites 5
return

; F-lock - message alternates with each press (shifted / not shifted)
0100000000020000:
0100000000030000:
   MsgBox F-lock
return

; F-keys when F-lock enabled
; F1
0195000000000000:
SendInput, {f1}
return
;F2
011A020000000000:
SendInput, {f2}
return
;F3
0179020000000000:
SendInput, {f3}
return
;F4
0101020000000000:
SendInput, {f4}
return
;F5
0102020000000000:
SendInput, {f5}
return
;F6
0103020000000000:
SendInput, {f6}
return
;F7
0189020000000000:
SendInput, {f7}
return
;F8
018B020000000000:
SendInput, {f8}
return
;F9
018C020000000000:
SendInput, {f9}
return
;F10
01AB010000000000:
SendInput, {f10}
return
;F11
0107020000000000:
SendInput, {f11}
return
;F12
0108020000000000:
SendInput, {f12}
return


Of course you could assign different actions to any of the keys with F-Lock enabled to get even more functionality out of your keyboard...


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Remapping F-Lock
PostPosted: February 12th, 2012, 12:22 pm 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
Philister wrote:
@automaticman: You have to use the first script posted in this thread. Copy the code into an .ahk file and run it. Click on "Capture on" button and press the key you need. Click on "Capture off" and copy the information. Voila.
For a keyboard capture shows

Code:
AppendOutput("HND " . Handle . " KBD ScanCode " . ScanCode . " VKey " . VKey . " Msg " . Message . "`r`n")

Which one to use?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, Bing [Bot], Exabot [Bot], Google Feedfetcher, JamixZol and 17 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group