Scripts

Copy and paste the code below into a new text file and save it with the scripts name and the .ahk extention: K – ScriptName.ahk

AutoHotkey Scripts.

(Tip: Press “Backspace“, “Alt Left” or “Home” to get back to this list.)

K – tFindGUI *NEW
K – FKee3
K – Convert Case
K – Thunderbird2Tray
K – Mouse Edit
K – ExecuText

K – tFindGUI

Frontend for tFind a NTFS disk searcher.

;__________________________
; \____K - tFindGUI_____/

; Coded by MsgBox.                                          Last Edit:- 08/02/09

; This script is only for systems where the filesystem is NTFS. It is a front
; end for "TFind - NTFS Disk Searcher" -- http://deadnode.org/sw/tfind/
; which is a VERY VERY FAST command line NTFS MFT (Master File Table) search tool.
;
; To use, download tFind: http://cdn.deadnode.org/tfind32.zip
; and place tFind.exe in %SYSTEMROOT%\System32 folder or any directory in your PATH.

#SingleInstance Force
SetBatchLines -1

; This is needed for (my!) Windows Vista. The drawback is that all files and folders
; opened with K - tFindGUI will be run in Admin mode! -- Remove if not needed.
if not A_IsAdmin
{
   DllCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, A_AhkPath
      , str, """" . A_ScriptFullPath . """", str, A_WorkingDir, int, 1)
   ExitApp
}

DriveGet allDrives, list, fixed           ; Get drive list
Loop Parse, allDrives                     ; Extract all NTFS drives
{
   l := A_LoopField
   DriveGet thisDrive, FS, %l%:
   If thisDrive = ntfs
   {
      If !firstDrive                      ; First drive found (usually C:)
         firstDrive := l
      ntfsDrives = %ntfsDrives%  %l%
      }
   }

progName = K - tFindGui
progNameSB = %progName% - Click status bar to copy files full path.
driveShow = Available NTFS drives: %ntfsDrives%

Gui Margin, 5, 5
Gui Add, GroupBox, w300 h70
Gui Add, Text, xs+10 ys23, Drive:
Gui Add, Text, x+63 , Find this:
Gui Add, CheckBox, x+10 vpartialMatch, &Partial match
Gui Add, Button, x+18 ys+15 h20 gsHelp, &Help

Gui Add, Button, x+50 yp-9 w232 h25 vss Disabled, %driveShow%
Gui Add, Text, yp+50 w130 vnof, Files found: 0
Gui Add, Text, x+10 w120 vst, Start time: 00:00:00


Gui Add, Edit, xs+10 ys+40 w70 vfDrive Uppercase, %firstDrive%
Gui Add, Edit, x+20 w150 vfQuery
Gui Add, Button, x+5 h20 gGetResults Default, &Find

Gui Add, Text, x+50 yp+2 w120 vtt, Total time:   0
Gui Add, Text, x+21 w120 vet, End time:  00:00:00

Gui Add, ListView, xm w700 r15 gopenFolder AltSubmit, Result|File|Ext|Size|Path
LV_ModifyCol(1, 0)
LV_ModifyCol(2, 200)
LV_ModifyCol(3, 45)
LV_ModifyCol(4, 60)
LV_ModifyCol(5, 370)
Gui Add, StatusBar, gcopyPath, %progNameSB%
Gui Show,, %progName%
GuiControl focus, edit2
Return

fillInfo:
GuiControl,, nof, Files found: %Cnt%
GuiControl,, st, Start time: %startTime%
GuiControl,, tt, Total time:   %totalSpeed% %sSeconds%
GuiControl,, et, End time:  %endTime%
Return

GetResults:
Gui Submit, NoHide
If !fQuery
{
   MsgBox,, %progName%, No query entered.
   Return
   }
If partialMatch
   fQuery = *%fQuery%*
If !fDrive
   cmdInput = "%fQuery%" %ntfsDrives%  ; Bugfix. If drive letter is omitted (search all),
Else                                   ; tFind produces "Unable to access volume '\\.'"
   cmdInput = "%fQuery%" %fDrive%      ; along with the results.
GuiControl,, ss, Searching.....
CMDin := "cmd /c tFind " . cmdInput
LV_Delete()

FormatTime startTime,,H:mm:ss
startSpeed := A_Now

CMDret_Stream(CMDin)
LV_ModifyCol(1 ,"Sort")
FormatTime endTime,,H:mm:ss
endSpeed := A_Now
totalSpeed := endSpeed-startSpeed
If totalSpeed > 8*A_Index-8)
    DllCall("RtlFillMemory", UInt,&pa+8+A_Index-1, UInt,1, UChar,1 >> 8*A_Index-8)
  }
  IF (DllCall("CreatePipe", "UInt*",hRead, "UInt*",hWrite, "UInt",&pa, "Int",0)  0) {
    Loop, 4
      DllCall("RtlFillMemory", UInt,&sui+A_Index-1, UInt,1, UChar,68 >> 8*A_Index-8)
    DllCall("GetStartupInfo", "UInt", &sui)
    Loop, 4 {
      DllCall("RtlFillMemory", UInt,&sui+44+A_Index-1, UInt,1, UChar,257 >> 8*A_Index-8)
      DllCall("RtlFillMemory", UInt,&sui+60+A_Index-1, UInt,1, UChar,hWrite >> 8*A_Index-8)
      DllCall("RtlFillMemory", UInt,&sui+64+A_Index-1, UInt,1, UChar,hWrite >> 8*A_Index-8)
      DllCall("RtlFillMemory", UInt,&sui+48+A_Index-1, UInt,1, UChar,0 >> 8*A_Index-8)
    }
    IF (DllCall("CreateProcess", Int,0, Str,CMDin, Int,0, Int,0, Int,1, "UInt",0, Int,0, tcWrk, WorkingDir, UInt,&sui, UInt,&pi)  0) {
      Loop, 4
        cmdretPID += *(&pi+8+A_Index-1) << 8*A_Index-8
      Loop {
        idltm2 := A_TickCount - idltm
        If (idltm2 < 15) {
          DllCall("Sleep", Int, 15)
          Continue
        }
        IF (DllCall("PeekNamedPipe", "uint", hRead, "uint", 0, "uint", 0, "uint", 0, "uint*", bSize, "uint", 0 )  0 ) {
          Process, Exist, %cmdretPID%
          IF (ErrorLevel OR bSize > 0) {
            IF (bSize > 0) {
              VarSetCapacity(lpBuffer, bSize+1, 0)
              IF (DllCall("ReadFile", "UInt",hRead, "Str", lpBuffer, "Int",bSize, "UInt*",bRead, "Int",0) > 0) {
                IF (bRead > 0) {
                  IF (StrLen(lpBuffer)  bRead2)
                        break
                    }
                  }
              VarSetCapacity(lpBuffer, -1)
                  CMDout .= lpBuffer
                  bRead = 0
                }
              }
            }
          }
          ELSE
            break
        }
        ELSE
          break
        idltm := A_TickCount
        LiveFound := RegExMatch(CMDout, "m)^(.*)", LiveOut, LivePos)
        Sleep 100 ; kj
        If (LiveFound)
          SetTimer, cmdretSTR, 5
      }
      cmdretPID=
      DllCall("CloseHandle", UInt, hWrite)
      DllCall("CloseHandle", UInt, hRead)
    }
  }
  ;msgbox "%cmdout%" ; kj
  StringTrimLeft, LiveRes, CMDout, %LivePos%
  If LiveRes 
    Loop, Parse, LiveRes, `n
    {
      FileLine = %A_LoopField%
      StringTrimRight, FileLine, FileLine, 1
      CMDret_Output(FileLine, CMDname)
    }
  StringTrimLeft, CMDout, CMDout, 1
  cmdretPID = 0
  Return, CMDout
cmdretSTR:
SetTimer, cmdretSTR, Off
If (LivePosLast  LiveFound) {
  FileLine = %LiveOut1%
  LivePos := LiveFound + StrLen(FileLine) + 1
  LivePosLast := LivePos
  CMDret_Output(FileLine, CMDname)
}
Return
}

K – Thunderbird2Tray

Hides Thunderbird and other windows to the system tray.

;__________________________________
; \____K - Thunderbird2Tray_____/

; Coded by MsgBox.                                          Last Edit:- 28/01/09

; Hides Mozilla Thunderbird email client to the system tray ... hides other windows too!

; To use:
; Keyboard: Windows key-Ctrl-H (for hide!).
; Mouse: Ctrl-Click the minimise button. An option is available not to use the Ctrl key.
; Tray Menu: Click tray icon to "Get ALL Mail". "Write New Mail" and "Address Book" are
;            accessed via the menu, as are various startup options and hidden windows.

; The script also monitors for Thunderbird being trayed, restored and shut down.

; Bugs:
; Thunderbird window sometimes shows its self on screen, usually if you click the envelope
; icon when you have new mail. If this happens, use the menu to untray Thunderbird then
; re-minimise as normal.

#SingleInstance Force
#NoEnv
BlockInput, SendAndMouse          ; Better safe than sorry
CoordMode ToolTip, Screen
progName = K - Thunderbird2Tray
iniPath = %progName%.ini
tbPath = C:\Program Files\Mozilla Thunderbird\thunderbird.exe
HWMenuStart = 2                   ; two default menu entries
HWs := HWMenuStart                ; no hidden windows
Gosub cfgLoad                     ; Load Settings.
Gosub trayMenu                    ; Build the menu.
Gosub menuEvent                   ; Update tray menu.
OnExit, HWExit
If (RunTB)                        ; Run Thunderbird on TB2Tray start.
  Gosub startTB
Return

~*LButton::                       ; Watch windows minimise button for click.
If (CtrlKey) {                    ; LCtrl option is selected.
  If !GetKeyState("LCtrl", "P")   ; LCtrl wasn't pressed so minimise as normal.
    Return
  Send {LCtrl UP}                 ; LCtrl pressed so release key.
  }
If GetKeyState("LCtrl", "P")      ; If no modifier option used, LCtrl to
  Return                          ; override click producing normal minimise.
SetBatchLines,-1
Temp := WinExist("A")             ; Get window ID, needed for hide function.
CoordMode,Mouse,Screen
MouseGetPos,mx,my,WinID
SendMessage,0x84,,(my < 32) {
    StringLeft, Begin, Temp, 14
    StringRight, Temp, Temp, 15
    Temp := Begin "..." Temp
    }
  HW%HWs%T := Temp
  ShowToolTip( progName ":`nHiding " HW%HWs%T)
  WinHide, % "ahk_id" HW%HWs%
  If (HWs = HWMenuStart + 1)
    Menu, tray, enable, Hidden Windows
  If (tbID = TBh) {
     Menu, HWMenu, Add, Mozilla Thunderbird, HWHandler
     Menu Tray, Icon, %TBPath%, 1
     Menu HWMenu, Default, Mozilla Thunderbird
     }
  Else
     Menu, HWMenu, Add, % HW%HWs%T " (" HW%HWs% ")", HWHandler
}

ShowHiddenWindow(HWNo)            ; Show window function.
{
  Global
  Local i, j
  WinShow, % "ahk_id" HW%HWNo%
  WinRestore % "ahk_id" HW%HWNo%  ; Restore window to the desktop.
  TBu := HW%HWNo%
  If (tbID = TBu) {
     Menu HWMenu, Delete, Mozilla Thunderbird
     Menu Tray, Icon, %A_AhkPath%, 1
     isTrayed=
     SetTimer watchTB4Close, 1000 ; Watch for TB closing.
     }
  Else
     Menu, HWMenu, Delete, % HW%HWNo%T " (" HW%HWNo% ")"
  IfGreater, HWs, %HWNo%
    Loop, % HWs - HWNo
    {                             ; No real arrays, drop line
      j := A_Index + HWNo
      i := j - 1
      HW%i% := HW%j%
      HW%i%T := HW%j%T
      }
  HW%HWs%=
  HW%HWs%T=
  HWs := HWs - 1
  IfEqual, HWs, %HWMenuStart%
    Menu, tray, disable, Hidden Windows
}

ShowAll()
{
  Global
  Loop, % HWs - HWMenuStart
    ShowHiddenWindow(HWMenuStart + 1)
}

HWHandler:
IfEqual, A_ThisMenuItem, Unhide All
  ShowAll()
Else
  ShowHiddenWindow(A_ThisMenuItemPos)
Return

AddressBook:
DetectHiddenWindows On
ControlSend ,, {LCtrl Down}{2 Down}{2 Up}{LCtrl Up}, ahk_id %tbID%
DetectHiddenWindows Off
Return

GetMail:
DetectHiddenWindows On
ControlSend ,, {LCtrl Down}{LShift Down}{t Down}{t Up}{LShift Up}{LCtrl Up}, ahk_id %tbID%
If (!ErrorLevel)                  ; No problem.
  Gosub fetchingMail
DetectHiddenWindows Off
Return

fetchingMail:                     ; Show mail icon when checking for mail.
Menu Tray, Icon, %TBPath%, 2
Sleep 3000
If (isTrayed)
  Menu Tray, Icon, %TBPath%, 1
Else
  Menu Tray, Icon, %A_AhkPath%, 1
Return

WriteMail:
DetectHiddenWindows On
ControlSend ,, {LCtrl Down}{m Down}{m Up}{LCtrl Up}, ahk_id %tbID%
DetectHiddenWindows Off
Return

trayMenu:
Menu Tray, Tip, %progName%
Menu Tray, Click, 1
Menu Tray, NoStandard
Menu Tray, Add, %progName%, menuEvent
Menu Tray, Disable, %progName%
Menu Tray, Add
Menu Tray, Add, Start Thunderbird, menuEvent
Menu Tray, Add
Menu Tray, Add, Address Book, AddressBook
Menu Tray, Add, Write New Mail, WriteMail
Menu Tray, Disable, Write New Mail
Menu Tray, Add, Get All Mail, GetMail
Menu Tray, Disable, Get All Mail
Menu Tray, Default, Get All Mail
Menu Tray, Add
Menu Prefs, Add, Reload Script, menuEvent
Menu Prefs, Add, Edit Script, menuEvent
Menu Prefs, Add
Menu Prefs, Add, Run TB on startup, menuEvent
Menu Prefs, Add, Send TB to tray on startup, menuEvent
Menu Prefs, Add, Close TB on TB2Tray exit, menuEvent
Menu Prefs, Add
Menu Prefs, Add, Use Ctrl key, menuEvent
Menu Tray, Add, Options, :Prefs
Menu HWMenu, Add, Unhide All, HWHandler
Menu HWMenu, Add
Menu Tray, Add, Hidden Windows, :HWMenu
Menu Tray, Disable, Hidden Windows
Menu Tray, Add
Menu Tray, Add, Exit, menuEvent
Return

menuEvent:
If ( !ThisMenuItem )
	ThisMenuItem = %A_ThisMenuItem%
If (ThisMenuItem = "Reload Script")
  Reload
If (ThisMenuItem = "Edit Script")
  Edit
If ( ThisMenuItem = "Run TB on startup")
  RunTB := !RunTB
If (RunTB) {

  Menu Prefs, Check, Run TB on startup
  Menu Prefs, Enable, Send TB to tray on startup
  Menu Prefs, Enable, Close TB on TB2Tray exit
  }
Else {
  Menu Prefs, UnCheck, Run TB on startup
  Menu Prefs, Disable, Send TB to tray on startup
  Menu Prefs, Disable, Close TB on TB2Tray exit
  }
If ( ThisMenuItem = "Send TB to tray on startup")
  RunTBHide := !RunTBHide
If (RunTBHide)
  Menu Prefs, Check, Send TB to tray on startup
Else
  Menu Prefs, UnCheck, Send TB to tray on startup
If (ThisMenuItem = "Use Ctrl Key")
  CtrlKey := !CtrlKey
If (CtrlKey)
  Menu Prefs, Check, Use Ctrl Key
Else
  Menu Prefs, UnCheck, Use Ctrl Key
If ( ThisMenuItem = "Close TB on TB2Tray exit")
  CloseTBOnExit := !CloseTBOnExit
If (CloseTBOnExit)
  Menu Prefs, Check, Close TB on TB2Tray exit
Else
  Menu Prefs, UnCheck, Close TB on TB2Tray exit
If (ThisMenuItem = "Start Thunderbird")
  Gosub startTB
If (ThisMenuItem = "Exit")
  ExitApp
ThisMenuItem =
Gosub cfgSave
Return

cfgLoad:
IniRead RunTB, %iniPath%, Thunderbird, RunTBONStart, 1
IniRead RunTBHide, %iniPath%, Thunderbird, HideTBOnTB2TrayStart, 1
IniRead CloseTBOnExit, %iniPath%, Thunderbird, CloseTBOnTB2TrayExit, 1
IniRead CtrlKey, %inPath%, Modifier, CtrlModifierKey, 1
Return

cfgSave:
IniWrite %RunTB%, %iniPath%, Thunderbird, RunTBONStart
IniWrite %RunTBHide%, %iniPath%, Thunderbird, HideTBOnTB2TrayStart
IniWrite %CloseTBOnExit%, %iniPath%, Thunderbird, CloseTBOnTB2TrayExit
IniWrite %CtrlKey%, %iniPath%, Modifier, CtrlModifierKey
Return

ShowToolTip(ToolTip)
{
  wx := A_ScreenWidth
  wy := A_ScreenHeight -65
  ToolTip, %ToolTip%, %wx%, %wy%
  SetTimer, RemoveToolTip, 5000
}

RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
Return

HWExit:
ShowToolTip(progName ":`nUnhiding all ...")
ShowAll()
If (CloseTBOnExit) {
  If (tbID)
    ControlSend ,, {LCtrl Down}{q Down}{q Up}{LCtrl Up}, ahk_id %tbID%
  }
ExitApp

K – FKee3

Run any program or code by tapping the F-Keys.

;_______________________
; \____K - FKee3_____/

; Coded by MsgBox.                                          Last Edit:- 05/06/06

; Adds extra {F1}nctionality to your {F2}unction keys.

; With this script you can add two extra actions to an F-Key without using a Modifier.
; Using a Modifier adds another three actions per key.
; Two Modifier keys have been defined, "Win" and "Ctrl", giving a possable total of
; 96 actions on twelve keys. More can easily be added IF needed!
;
; How to use:-
;  1 key press = {default F-Key action}. With a Modifier {your action}.
;  2 key presses = {your action} ie. Send,^a^c
;  3 key presses = {your action} ie. Run, MyMostUsedPrograms.exe
;
; F1 is aready set up as a demonstration with AHK help (2nd key press) and a version
; (can't find the original) of Rajat's IntelliSence (3rd key press).
; Actions are defined in a separate file, " FKee3Actions.ahk "
; (which needs to be created manually on first use) in the script directory.
; If a key press is triggered that has not been assigned an action, you will
; be given the opportunity to do so. (Just press "Yes"). When FKee3Actions.ahk
; is saved, FKee3 will automatically reload.

#UseHook
#SingleInstance, force
SetTitleMatchMode 2
SetTimer UpdatedActions, 1000

; **Settings**********
FK3_ShowHowToMsg = 1                                       ; Show/hide "how-to" message box. 1=Show 0=Hide.
FK3_Editor = %Windir%\Notepad.exe                          ; Alternative action's editor?
; **Settings**********

Loop 12 {                                                  ; Defines hotkeys.
   Hotkey F%A_Index%, FK3_Hoty
   Hotkey #F%A_Index%, FK3_Hoty
   Hotkey ^F%A_Index%, FK3_Hoty
   }
Return

FK3_Hoty:                                                  ; Counts key presses.
If ( A_ThisHotKey = A_PriorHotKey and A_TimeSincePriorHotkey < 250 )
   FK3_KeyPresses++
Else FK3_KeyPresses = 1
SetTimer FK3_KeyCheck, 275
Return

FK3_KeyCheck:
SetTimer FK3_KeyCheck, Off
If Asc(A_ThisHotkey) = Asc("F") and FK3_KeyPresses < 2 {   ; Check first character of A_ThisHotkey for "F"...
   Send {%A_ThisHotkey%}                                   ; ie. no Modifier, and 1 key press. Send {F1}...{F12}.
   Return
   }
IfGreater FK3_KeyPresses,3, SetEnv FK3_KeyPresses,3        ; If more than 3 key presses are detected, FK3_KeyPresses = 3.
If Asc(A_ThisHotkey) = Asc("#")                            ; Check A_ThisHotkey for Win Modifier.
   StringReplace Modi, A_ThisHotKey, #, Win-               ; #FKey now = Win-FKey. For msgbox and action file.
;Else
If Asc(A_ThisHotkey) = Asc("^")                            ; Check A_ThisHotkey for Ctrl Modifier.
   StringReplace Modi, A_ThisHotKey, ^, Ctrl-              ; ^FKey now = Ctrl-FKey.
;Else
Modi = %A_ThisHotKey%                                      ; No modifier found.
Gosub %Modi%_%FK3_KeyPresses%                              ; Do action for pressed hotkey.
Return

#Include FKee3Actions.ahk                                  ; Include external FKee3 action file.

FK3_MsgBoxSetup:                                           ; If no action is defined for hotkey, show msgbox.
IfEqual FK3_KeyPresses, 1, SetEnv, FK3_MsgPresses, One     ; Set up text for msgbox.
IfEqual FK3_KeyPresses, 2, SetEnv, FK3_MsgPresses, Two
IfEqual FK3_KeyPresses, 3, SetEnv, FK3_MsgPresses, Three
Press = Presses
IfEqual FK3_MsgPresses, One, SetEnv, Press, Press
MsgBox 4100, %A_ThisHotKey% :- %FK3_MsgPresses% Key %Press% , [ %Modi%_%FK3_KeyPresses% ]`nNo action has been defined for this hotkey yet.`nWould you like to open your editor and add one?
IfMsgBox yes                                               ; If enabled, show how-to msgbox.
{
   If FK3_ShowHowToMsg = 1
   {
      MsgBox,, Q - HOW DO I SET AN ACTION FOR [ %Modi%_%FK3_KeyPresses% ]?, [ %Modi%_%FK3_KeyPresses% ]`nYour editor (if defined in Settings) or notepad will open and go to the`ncorrect line in " FKee3Actions.ahk " for your hotkey.`nReplace " Gosub, FK3_MsgBoxSetup " with your code.`nSave file.`nFKee3 will automatically reload. Your new actions can then be used.`nThis MsgBox can (and probably should) be disabled. See  Settings.
      Gosub FK3_EditActions
      }
   Else
   Gosub FK3_EditActions
   }
Return

FK3_EditActions:
Run %FK3_Editor% %A_WorkingDir%\FKee3Actions.ahk           ; Start editor and load FKee3Actions.ahk
WinWaitActive FKee3Actions.ahk
Send ^{Home}^f%Modi%_%FK3_KeyPresses%{enter}{Home}{Down}+{End} ; Find and highlight correct line for the pressed hotkey.
Return

UpdatedActions:                                            ; Reload script if FKee3Actions.ahk has changed.
FileGetAttrib attribs, %A_ScriptDir%\FKee3Actions.ahk
IfInString attribs, A
   {
      FileSetAttrib -A, %A_ScriptDir%\FKee3Actions.ahk
      SplashTextOn 250,50,FKee3:- Status,
      (
         FKee3Actions.ahk has changed. FKee3 will now RELOAD.
      )
      Sleep 5000
      Reload
      }
Return

The code below should be saved to a separate file named "FKee3Actions.ahk" in the same directory as K – FKee3

; Replace " Gosub, FK3_MsgBoxSetup " with your code.

; FKey_2 or 3 presses.
F1_2:
Gosub, FK3_MsgBoxSetup
return
F1_3:
Gosub, FK3_MsgBoxSetup
return
F2_2:
Gosub, FK3_MsgBoxSetup
return
F2_3:
Gosub, FK3_MsgBoxSetup
return
F3_2:
Gosub, FK3_MsgBoxSetup
return
F3_3:
Gosub, FK3_MsgBoxSetup
return
F4_2:
Gosub, FK3_MsgBoxSetup
return
F4_3:
Gosub, FK3_MsgBoxSetup
return
F5_2:
Gosub, FK3_MsgBoxSetup
return
F5_3:
Gosub, FK3_MsgBoxSetup
return
F6_2:
Gosub, FK3_MsgBoxSetup
return
F6_3:
Gosub, FK3_MsgBoxSetup
return
F7_2:
Gosub, FK3_MsgBoxSetup
return
F7_3:
Gosub, FK3_MsgBoxSetup
return
F8_2:
Gosub, FK3_MsgBoxSetup
return
F8_3:
Gosub, FK3_MsgBoxSetup
return
F9_2:
Gosub, FK3_MsgBoxSetup
return
F9_3:
Gosub, FK3_MsgBoxSetup
return
F10_2:
Gosub, FK3_MsgBoxSetup
return
F10_3:
Gosub, FK3_MsgBoxSetup
return
F11_2:
Gosub, FK3_MsgBoxSetup
return
F11_3:
Gosub, FK3_MsgBoxSetup
return
F12_2:
Gosub, FK3_MsgBoxSetup
return
F12_3:
Gosub, FK3_MsgBoxSetup
return

; Win-FKey_1,2 or 3 presses.
Win-F1_1:
Gosub, FK3_MsgBoxSetup
return
Win-F1_2:
Gosub, FK3_MsgBoxSetup
return
Win-F1_3:
Gosub, FK3_MsgBoxSetup
return
Win-F2_1:
Gosub, FK3_MsgBoxSetup
return
Win-F2_2:
Gosub, FK3_MsgBoxSetup
return
Win-F2_3:
Gosub, FK3_MsgBoxSetup
return
Win-F3_1:
Gosub, FK3_MsgBoxSetup
return
Win-F3_2:
Gosub, FK3_MsgBoxSetup
return
Win-F3_3:
Gosub, FK3_MsgBoxSetup
return
Win-F4_1:
Gosub, FK3_MsgBoxSetup
return
Win-F4_2:
Gosub, FK3_MsgBoxSetup
return
Win-F4_3:
Gosub, FK3_MsgBoxSetup
return
Win-F5_1:
Gosub, FK3_MsgBoxSetup
return
Win-F5_2:
Gosub, FK3_MsgBoxSetup
return
Win-F5_3:
Gosub, FK3_MsgBoxSetup
return
Win-F6_1:
Gosub, FK3_MsgBoxSetup
return
Win-F6_2:
Gosub, FK3_MsgBoxSetup
return
Win-F6_3:
Gosub, FK3_MsgBoxSetup
return
Win-F7_1:
Gosub, FK3_MsgBoxSetup
return
Win-F7_2:
Gosub, FK3_MsgBoxSetup
return
Win-F7_3:
Gosub, FK3_MsgBoxSetup
return
Win-F8_1:
Gosub, FK3_MsgBoxSetup
return
Win-F8_2:
Gosub, FK3_MsgBoxSetup
return
Win-F8_3:
Gosub, FK3_MsgBoxSetup
return
Win-F9_1:
Gosub, FK3_MsgBoxSetup
return
Win-F9_2:
Gosub, FK3_MsgBoxSetup
return
Win-F9_3:
Gosub, FK3_MsgBoxSetup
return
Win-F10_1:
Gosub, FK3_MsgBoxSetup
return
Win-F10_2:
Gosub, FK3_MsgBoxSetup
return
Win-F10_3:
Gosub, FK3_MsgBoxSetup
return
Win-F11_1:
Gosub, FK3_MsgBoxSetup
return
Win-F11_2:
Gosub, FK3_MsgBoxSetup
return
Win-F11_3:
Gosub, FK3_MsgBoxSetup
return
Win-F12_1:
Gosub, FK3_MsgBoxSetup
return
Win-F12_2:
Gosub, FK3_MsgBoxSetup
return
Win-F12_3:
Gosub, FK3_MsgBoxSetup
return

; Ctrl-FKey_1,2 or 3 presses.
Ctrl-F1_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F1_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F1_3:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F2_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F2_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F2_3:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F3_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F3_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F3_3:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F4_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F4_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F4_3:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F5_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F5_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F5_3:
Gosub, FK3_MsgBoxSetup
return

Ctrl-F6_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F6_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F6_3:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F7_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F7_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F7_3:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F8_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F8_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F8_3:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F9_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F9_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F9_3:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F10_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F10_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F10_3:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F11_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F11_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F11_3:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F12_1:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F12_2:
Gosub, FK3_MsgBoxSetup
return
Ctrl-F12_3:
Gosub, FK3_MsgBoxSetup
return

K – Mouse Edit

Cut, copy paste, select all, undo and enter ALL WITH JUST THE MOUSE!!

;__________________________
; \____K - Mouse Edit_____/

; Coded by MsgBox.                                          Last Edit:- 20/05/07

; Hold down LButton and click RButton:-
;   Once to "Copy".
;   Twice to "Paste".
;   Thrice to "Cut".
; Hold down LButton and scroll MouseWheel:-
;   Down to "Select All".
;   Up to "Undo".
; Holding down LButton and clicking MouseWheel sends "Enter".
;
; Tip: Functions can be used one after another if LButton isn't released
;      ie.  Hold down LButton
;           scroll MouseWheel Down (Select All), click RButton once (Copy) etc.

; Cut Copy & Paste.
~LButton & RButton::
If (RMB_Click) {
	RMB_Click++
	Return
	}
RMB_Click = 1
SetTimer WaitForClicks, 800
Return

WaitForClicks:
SetTimer WaitForClicks, Off
If (RMB_Click = 1) {
	Clipboard=
	Send {LButton Up}^c
	ClipWait 2
	String = %clipboard%
	TrayTip ________ COPIED TO CLIPBOARD. _______, %String%
   SetTimer RemoveTrayTip, 3000
   }
If (RMB_Click = 2) {
	Send {LButton Up}^v
	String = %clipboard%
   TrayTip ________ PASTED FROM CLIPBOARD. _______, %String%
   SetTimer RemoveTrayTip, 2000
   }
If (RMB_Click = 3) {
	Send {LButton Up}^x
	ClipWait 2
	String = %clipboard%
	TrayTip ________ CUT TO CLIPBOARD. _______, %String%
	SetTimer RemoveTrayTip, 1000
	}
If (RMB_Click > 3) {
	Send {LButton Up}
	TrayTip ___ TOO MANY CLICKS! ___,Edit Aborted.
	SetTimer RemoveTrayTip, 5000
	}
RMB_Click=
Return

; Undo Enter & Select All.
~Lbutton & WheelUp::
Send {LButton Up}
GetKeyState State, WheelUp
If (State = "U") {
   Send ^z
	ToolTip Undo
	SetTimer RemoveToolTip, 2000
	}
Return

~LButton & WheelDown::
Send {LButton Up}
GetKeyState State, WheelDown
If (State = "U") {
	Send ^a
	ToolTip Select All
	SetTimer RemoveToolTip, 2000
	}
Return

~LButton & MButton::
Send {LButton Up}
If GetKeyState("LButton", "P")
	Send {Enter}
Return

RemoveTrayTip:
SetTimer RemoveTrayTip, Off
TrayTip
Return

RemoveToolTip:
SetTimer RemoveToolTip, Off
ToolTip
Return

K – Convert Case

Converts case of selected text.

;___________________________
; \____K - Convert Case_____/  

; Coded by MsgBox.                                          Last Edit:- 20/05/07

; Mouse Selection:-
; Select text with left mouse button. Do not release it!
; Select appropriate key.

; Keyboard Selection:-
; Hold down CapsLock, and select appropriate key.

; Keys:-
; U = UPPER  L = lower  T =Title  I = iNVERT  R = rANdoM

~CapsLock & U::										;Change Case "UPPER"
~LButton & U::
Keywait u, U
If GetKeyState("CapsLock", "P")
	GoSub COPY
Else {
	Send {LButton Up}
	GoSub COPY
	}
StringUpper String, String
GoSub PASTE
TrayTip CASE CONVERSION:-, Case has been changed to " UPPER " case.
SetTimer RemoveTrayTip, 3000
Return

~CapsLock & L::										;Change Case "lower"
~LButton & L::
Keywait l, U
If GetKeyState("CapsLock", "P")
	GoSub COPY
Else {
	Send {LButton Up}
	GoSub COPY
	}
StringLower String, String
GoSub PASTE
TrayTip CASE CONVERSION:-, Case has been changed to " lower " case.
SetTimer RemoveTrayTip, 3000
Return

~CapsLock & T::										;Change Case "Title"
~LButton & T::
Keywait t, U
If GetKeyState("CapsLock", "P")
	GoSub COPY
Else {
	Send {LButton Up}
	GoSub COPY
	}
StringLower String, String, T
GoSub PASTE
TrayTip CASE CONVERSION:-, Case has been changed to " Title " case.
SetTimer RemoveTrayTip, 3000
Return

~CapsLock & I::										;Change Case "iNVERT"
~LButton & I::
Keywait i, U
If GetKeyState("CapsLock", "P")
	GoSub COPY
Else {
	Send {LButton Up}
	GoSub COPY
	}
StringLen length, String
Loop %length% {
	StringLeft char, String, 1
	If char Is Upper
		StringLower char, char
	Else If char Is Lower
		StringUpper, char, char
	StringTrimLeft, String, String, 1
	String = %String%%char%
	}
GoSub PASTE
TrayTip CASE CONVERSION:-, Case has been " iNVERTED ".
SetTimer RemoveTrayTip, 3000
Return

~CapsLock & R::										;Change Case "rANdoM"
~LButton & R::
Keywait r, U
If GetKeyState("CapsLock", "P")
	GoSub COPY
Else {
	Send {LButton Up}
	GoSub COPY
	}
StringLen length, String
Loop %length% {
	StringLeft char, String,1
	Random random, 1, 2
	IfEqual random, 1, StringLower, char, char
	Else StringUpper char, char
	StringTrimLeft String, String,1
	String = %String%%char%
	}
GoSub PASTE
TrayTip CASE CONVERSION:-, Case has been " raNDOMisED ".
SetTimer RemoveTrayTip, 3000
Return

COPY:
ClipSaved := ClipboardAll
Clipboard=
Send ^c
ClipWait 2
String = %Clipboard%
Return

PASTE:
Clipboard = %String%
Send ^v
Clipboard := ClipSaved
ClipSaved=
Return

RemoveTrayTip:
SetTimer RemoveTrayTip, Off
TrayTip
Return

K – ExecuText

This little script saves highlighted AHK code to a tempory file and the runs it.

;_________________________
; \____K - ExecuText_____/ 

; Coded by MsgBox.                                          Last Edit:- 20/05/07

; Copies selected text to a Temp ahk file and runs it.

~CapsLock & E::                     ;Run selected Ahk code
~LButton & E::
ClipSaved := ClipboardAll
Clipboard=
If GetKeyState("CapsLock","P")
	Send {CapsLock Up}{e Up}^c
Else
	Send {LButton Up}{e Up}^c
ClipWait 2
TmpFile = %TEMP%\Execute!.ahk
Clipboard = %Clipboard%
FileDelete %TmpFile%
FileAppend %Clipboard%, %TmpFile%
Run %TmpFile%
Clipboard := ClipSaved
ClipSaved=
Return

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s