Jump to content

Quick Keys v1.1


LiquidNitrogen
 Share

Recommended Posts

Quick Keys an Application Made to Allow You to Set Hot Key Shortcuts for Any Application OR File. It Runs in the Background When You Open it, Ready to Detect the Keys and Open the Application you Set it to. Just Add your Entries in the INI File and Launch Quick Keys!

Its Still a Work in Progress and I'm Adding Error Checks.

#include <Misc.au3>

CheckInstance()
ErrorCheck()
StartUp()
CheckKeys()

Func CheckInstance()
If _Singleton("QuickKeys", 1) = 0 Then
  MsgBox(0, "Already Open!", "An instance of Quick Keys Is Already Running. This Will Now Exit.")
  Exit
EndIf
EndFunc   ;==>CheckInstance

Func ErrorCheck()
If Not FileExists("keys.ini") Then
  IniWrite("keys.ini", "APPS", "1", "")
  IniWrite("keys.ini", "KEYS", "1", "")
EndIf
$Apps = IniReadSection("keys.ini", "APPS")
$Keys = IniReadSection("keys.ini", "KEYS")
For $i = 1 To $Apps[0][0]
  If Not FileExists($Apps[$i][1]) Then
   MsgBox(16, "Error In Keys.ini!", "Section: APPS" & @LF & @LF & "App Number: " & $i & @LF & @LF & "Description: The File Doesnt Exist!")
   Exit
  EndIf
Next
For $i = 1 To $Keys[0][0]
  $SplitKey = StringSplit($Keys[$i][1], "+")
  If Not StringInStr($Keys[$i][1], "+") Then
   MsgBox(16, "Error In Keys.ini!", "Section: KEYS" & @LF & @LF & "Key Set Number: " & $i & @LF & @LF & 'Description: The "+" Sign is Missing to Seperate the 2 Keys.')
   Exit
  EndIf
Next
EndFunc   ;==>ErrorCheck

Func StartUp()
MsgBox(0, "Quick Keys by ReaperX", "Quick Keys is Now Active!")
If Not FileExists("keys.ini") Then
  MsgBox(0, "Error!", "'keys.ini' Doesnt Exist So It Will Be Created.")
  IniWrite("keys.ini", "APPS", "1", "")
  IniWrite("keys.ini", "KEYS", "1", "")
EndIf
EndFunc   ;==>StartUp

Func CheckKeys()
$Apps = IniReadSection("keys.ini", "APPS")
$Keys = IniReadSection("keys.ini", "KEYS")
$DLL = DllOpen("user32.dll")
While 1
  For $i = 1 To $Apps[0][0]
   $Split = StringSplit($Keys[$i][1], "+")
   If $Split[1] = "ENTER" Then $HexKey1 = "0D"
   If $Split[1] = "SHIFT" Then $HexKey1 = "10"
   If $Split[1] = "CTRL" Then $HexKey1 = "11"
   If $Split[1] = "ALT" Then $HexKey1 = "12"
   If $Split[1] = "F1" Then $HexKey1 = "70"
   If $Split[1] = "F2" Then $HexKey1 = "71"
   If $Split[1] = "F3" Then $HexKey1 = "72"
   If $Split[1] = "F4" Then $HexKey1 = "73"
   If $Split[1] = "F5" Then $HexKey1 = "74"
   If $Split[1] = "F6" Then $HexKey1 = "75"
   If $Split[1] = "F7" Then $HexKey1 = "76"
   If $Split[1] = "F8" Then $HexKey1 = "77"
   If $Split[1] = "F9" Then $HexKey1 = "78"
   If $Split[1] = "F10" Then $HexKey1 = "79"
   If $Split[1] = "F11" Then $HexKey1 = "7A"
   If $Split[1] = "F12" Then $HexKey1 = "7B"
   If $Split[2] = "0" Then $HexKey2 = "30"
   If $Split[2] = "1" Then $HexKey2 = "31"
   If $Split[2] = "2" Then $HexKey2 = "32"
   If $Split[2] = "3" Then $HexKey2 = "33"
   If $Split[2] = "4" Then $HexKey2 = "34"
   If $Split[2] = "5" Then $HexKey2 = "35"
   If $Split[2] = "6" Then $HexKey2 = "36"
   If $Split[2] = "7" Then $HexKey2 = "37"
   If $Split[2] = "8" Then $HexKey2 = "38"
   If $Split[2] = "9" Then $HexKey2 = "39"
   If $Split[2] = "A" Then $HexKey2 = "41"
   If $Split[2] = "B" Then $HexKey2 = "42"
   If $Split[2] = "C" Then $HexKey2 = "43"
   If $Split[2] = "D" Then $HexKey2 = "44"
   If $Split[2] = "E" Then $HexKey2 = "45"
   If $Split[2] = "F" Then $HexKey2 = "46"
   If $Split[2] = "G" Then $HexKey2 = "47"
   If $Split[2] = "H" Then $HexKey2 = "48"
   If $Split[2] = "I" Then $HexKey2 = "49"
   If $Split[2] = "J" Then $HexKey2 = "4A"
   If $Split[2] = "K" Then $HexKey2 = "4B"
   If $Split[2] = "L" Then $HexKey2 = "4C"
   If $Split[2] = "M" Then $HexKey2 = "4D"
   If $Split[2] = "N" Then $HexKey2 = "4E"
   If $Split[2] = "O" Then $HexKey2 = "4F"
   If $Split[2] = "P" Then $HexKey2 = "50"
   If $Split[2] = "Q" Then $HexKey2 = "51"
   If $Split[2] = "R" Then $HexKey2 = "52"
   If $Split[2] = "S" Then $HexKey2 = "53"
   If $Split[2] = "T" Then $HexKey2 = "54"
   If $Split[2] = "U" Then $HexKey2 = "55"
   If $Split[2] = "V" Then $HexKey2 = "56"
   If $Split[2] = "W" Then $HexKey2 = "57"
   If $Split[2] = "X" Then $HexKey2 = "58"
   If $Split[2] = "Y" Then $HexKey2 = "59"
   If $Split[2] = "Z" Then $HexKey2 = "60"
   If $Split[2] = "LEFT" Then $HexKey2 = "25"
   If $Split[2] = "UP" Then $HexKey2 = "26"
   If $Split[2] = "RIGHT" Then $HexKey2 = "27"
   If $Split[2] = "DOWN" Then $HexKey2 = "28"
   If _IsPressed($HexKey1, $DLL) And _IsPressed($HexKey2, $DLL) Then
    If Not WinActive($Apps[$i][1]) Then
     Run($Apps[$i][1])
     $HexKey1 = ""
     $HexKey2 = ""
    EndIf
   EndIf
   Sleep(50)
  Next
  CheckKeys()
  DllClose($DLL)
WEnd
EndFunc   ;==>CheckKeys

You need to Create a Ini Config File called "keys.ini". Use the Following Format:

[APPS]
1=Application/File 1
2=Application/File 2
[KEYS]
1=Key1+Key2 (Launch App 1)
2=Key1+Key2 (Launch App 2)

Below, Are the Keys That Can be Used for Key1 and Key2:

Put These in the INI File As They Typed Are Here!

** Key 1 Choices **
----------------------
ENTER
SHIFT
CTRL
ALT
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12

** Key 2 Choices **
----------------------
Keys 0-9
Keys A-Z
UP
DOWN
LEFT
RIGHT
Edited by ReaperX

Formerly ReaperX

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