Jump to content

F1-F11 remapping.


ezzetabi
 Share

Recommended Posts

Never felt that in your desktop the Fx keys are a little useless?

There are 11 (actually 12, but you cant use the last one) keys and the ones actually useful are F2, for renaming and F5, for refreshing. And all others?

I would not be cool have the chance of let that key do what you really need?

Like starting applications, web pages, emails or whatever you can start with a "@comspec &' /c start'"!

Of course you do not want that this program block the Fx keys also in your favourite application... Well, this dont!

Here the code. Just start once and it makes a .ini file for you.

Edit that file adding the commands you want.

Leave empty or delete keys you do not want bind and the program will not touch them in any way.

Edit: A little modification that allow to restart the program after a modification in the .ini file without worry about closing the copy is already running. :ph34r:

Edit2: An other mofication that add the hatefuls " in order to allows command with spaces. But this way there are problem with programs that needs arguments... I think a solution.

Edit3: Removed the the modification of Edit2, it more trouble than worth... If you need " just add them in the .ini file in the right position!

If WinExists("FxRemap") Then WinClose("FxRemap")
AutoItWinSetTitle("FxRemap")

AutoItSetOption("MustDeclareVars", 1)
AutoItSetOption("TrayIconDebug", 1)
Dim $BOOLEAN = 0, $F1, $F2, $F3, $F4, $F5, $F6, $F7, $F8, $F9, $F10, $F11, $TAG = ""
If @OSVersion = "WIN_XP" Or @OSVersion = "WIN_2000" Then $TAG = '"" '

If FileExists(@ScriptDir & "\remapf.ini") Then
   $F1 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f1", "")
   $F2 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f2", "")
   $F3 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f3", "")
   $F4 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f4", "")
   $F5 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f5", "")
   $F6 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f6", "")
   $F7 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f7", "")
   $F8 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f8", "")
   $F9 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f9", "")
   $F10 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f10", "")
   $F11 = IniRead(@ScriptDir & "\remapf.ini", "keys", "f11", "")
Else
   FileWrite(@ScriptDir & "\remapf.ini", "[Keys]" & @CRLF & "f1=" & @CRLF & "f2=" & @CRLF & "f3=" & @CRLF & "f4=" & @CRLF & "f5=" & @CRLF & "f6=" & @CRLF & "f7=" & @CRLF & "f8=" & @CRLF & "f9=" & @CRLF & "f10=" & @CRLF & "f11=" & @CRLF)
   Exit
EndIf

While 1
   If WinGetTitle("") == "Program Manager" And $BOOLEAN = 0 Then
      If $F1 <> "" Then HotKeySet("{f1}", "_F1")
      If $F2 <> "" Then HotKeySet("{f2}", "_F2")
      If $F3 <> "" Then HotKeySet("{f3}", "_F3")
      If $F4 <> "" Then HotKeySet("{f4}", "_F4")
      If $F5 <> "" Then HotKeySet("{f5}", "_F5")
      If $F6 <> "" Then HotKeySet("{f6}", "_F6")
      If $F7 <> "" Then HotKeySet("{f7}", "_F7")
      If $F8 <> "" Then HotKeySet("{f8}", "_F8")
      If $F9 <> "" Then HotKeySet("{f9}", "_F9")
      If $F10 <> "" Then HotKeySet("{f10}", "_F10")
      If $F11 <> "" Then HotKeySet("{f11}", "_F11")
      $BOOLEAN = 1
   EndIf
   If WinGetTitle("") <> "Program Manager" And $BOOLEAN = 1 Then
      If $F1 <> "" Then HotKeySet("{f1}")
      If $F2 <> "" Then HotKeySet("{f2}")
      If $F3 <> "" Then HotKeySet("{f3}")
      If $F4 <> "" Then HotKeySet("{f4}")
      If $F5 <> "" Then HotKeySet("{f5}")
      If $F6 <> "" Then HotKeySet("{f6}")
      If $F7 <> "" Then HotKeySet("{f7}")
      If $F8 <> "" Then HotKeySet("{f8}")
      If $F9 <> "" Then HotKeySet("{f9}")
      If $F10 <> "" Then HotKeySet("{f10}")
      If $F11 <> "" Then HotKeySet("{f11}")
      $BOOLEAN = 0
   EndIf
   Sleep(100)
Wend

Exit

Func _F1()
   Run(@ComSpec & ' /c start ' & $TAG & $F1, '', @SW_HIDE)
EndFunc  ;==>_F1

Func _F2()
   Run(@ComSpec & ' /c start ' & $TAG & $F2, '', @SW_HIDE)
EndFunc  ;==>_F2

Func _F3()
   Run(@ComSpec & ' /c start ' & $TAG & $F3, '', @SW_HIDE)
EndFunc  ;==>_F3

Func _F4()
   Run(@ComSpec & ' /c start ' & $TAG & $F4, '', @SW_HIDE)
EndFunc  ;==>_F4

Func _F5()
   Run(@ComSpec & ' /c start ' & $TAG & $F5, '', @SW_HIDE)
EndFunc  ;==>_F5

Func _F6()
   Run(@ComSpec & ' /c start ' & $TAG & $f6,'', @SW_HIDE)
EndFunc  ;==>_F6

Func _F7()
   Run(@ComSpec & ' /c start ' & $TAG & $F7, '', @SW_HIDE)
EndFunc  ;==>_F7

Func _F8()
   Run(@ComSpec & ' /c start ' & $TAG & $F8, '', @SW_HIDE)
EndFunc  ;==>_F8

Func _F9()
   Run(@ComSpec & ' /c start ' & $TAG & $F9, '', @SW_HIDE)
EndFunc  ;==>_F9

Func _F10()
   Run(@ComSpec & ' /c start ' & $TAG & $F10, '', @SW_HIDE)
EndFunc  ;==>_F10

Func _F11()
   Run(@ComSpec & ' /c start ' & $TAG & $F11, '', @SW_HIDE)
EndFunc  ;==>_F11
Edited by ezzetabi
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...