Friday, July 20, 2012

AutoHotKey Script

Running the autocorrect script you may need to modify if using win+h for voice.
In the ahk search for #H and add ; to disable.

I need a place to keep some AutoHotKey script.
Great Hot Key List 

; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a
; semicolon, such as this one, are comments.  They are not executed.

; This script has a special filename and path because it is automatically
; launched when you run the program directly.  Also, any text file whose
; name ends in .ahk is associated with the program, which means that it
; can be launched simply by double-clicking it.  You can have as many .ahk
; files as you want, located in any folder.  You can also run more than
; one .ahk file simultaneously and each will get its own tray icon.

; SAMPLE HOTKEYS: Below are two sample hotkeys.  The first is Win+Z and it
; launches a web site in the default browser.  The second is Control+Alt+N
; and it launches a new Notepad window (or activates an existing one).  To
; try out these hotkeys, run AutoHotkey again, which will load this file.

http://xahlee.info/mswin/autohotkey_key_notations.html syntax list
https://www.youtube.com/watch?v=MJxteBFvuEU best video
;`n (next line) ` is on the tilde key
; :: (runs command)
; ::xyz:: (auto correct)
;'n will force next line
;adding the letter o in the first :o: will eliminate space after line
:r: treats everything in the string as raw text "!"for example
; Examples
;::bla:: blahblah@hotmail.com (this is auto correct)
; #z::Run www.autohotkey.com
;opens a web page
;Repurpose function keys
;F4::Run "C:\Program Files\Open\Program.exe"
;return
;Open folders
;#1:: Run, Explorer "C:\Downloads" ;Win + 1
;return

#SingleInstance,Force
; Windows=# Alt=! Shift=+ Conyrol=^

; v1
CoordMode, Mouse, Screen

^+m::
MouseGetPos, x, y
WinMove A,, %x%, %y%
return

; not needed use Win own ctl + w or alt + F4
 ^q::Send !{F4} (closes current window)

;pin window on top
^SPACE:: Winset, AlwaysOnTop, , A 
return

;Run Notepad
^!n::
IfWinExist Untitled - Notepad
WinActivate
else
Run Notepad
return

;Run Notepad++
!n::
IfWinExist Untitled - Notepad++.exe
WinActivate
else
Run Notepad++.exe
return

;opens Chrome still open new chrome session not sure how to fix
#c::
IfWinExist chrome.exe
WinActivate
else
Run chrome.exe
return

; Convert text to upper
^u::                                                               
 StringUpper Clipboard, Clipboard
 Send %Clipboard%
RETURN

; Convert text to capitalized
+^u::                                                             
 StringUpper Clipboard, Clipboard, T
 Send %Clipboard%
RETURN

; Google Search select text - Ctrl + Shift + C
 ^+c::
 {
  Send, ^c
  Sleep 50
  Run, http://www.google.com/search?q=%clipboard%
  Return
 }
return

^!d::
FormatTime, CurrentDateTime,, dd-MMM-yyyy
StringUpper, CurrentDateTime, CurrentDateTime
SendInput %CurrentDateTime%
return

^!0::
FormatTime, CurrentDateTime,, yyyy-MM-dd
SendInput %CurrentDateTime%
return

SwitchToWindowsTerminal()
{
  windowHandleId := WinExist("ahk_exe WindowsTerminal.exe")
  windowExistsAlready := windowHandleId > 0

  ; If the Windows Terminal is already open, determine if we should put it in focus or minimize it.
  if (windowExistsAlready = true)
  {
    activeWindowHandleId := WinExist("A")
    windowIsAlreadyActive := activeWindowHandleId == windowHandleId

    if (windowIsAlreadyActive)
    {
      ; Minimize the window.
      WinMinimize, "ahk_id %windowHandleId%"
    }
    else
    {
      ; Put the window in focus.
      WinActivate, "ahk_id %windowHandleId%"
      WinShow, "ahk_id %windowHandleId%"
    }
  }
  ; Else it's not already open, so launch it.
  else
  {
    Run, *RunAs wt
  }
}

; Hotkey to use Win + T to launch/restore the Windows Terminal.
^!t::SwitchToWindowsTerminal()

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Pin Not Available

Crazy Error I had not seen before. Pin not available blah blah. I restarted a few times and it finally worked. If it doesn't some say to...