Skip to content

Instantly share code, notes, and snippets.

@zoltrain
Created January 29, 2013 11:51
Show Gist options
  • Save zoltrain/4663702 to your computer and use it in GitHub Desktop.
Save zoltrain/4663702 to your computer and use it in GitHub Desktop.
; Redefine only when the active window is a console window
#IfWinActive ahk_class ConsoleWindowClass
; Close Command Window with Ctrl+w
#IfWinActive ahk_class ConsoleWindowClass
#!c::
Send,{LAlt Down}{Space Down}{Space Up}{LAlt Up}{c Down}
return
#IfWinActive
return
; Ctrl+up / Down to scroll command window back and forward
^Up::
Send {WheelUp}
return
^Down::
Send {WheelDown}
return
#IfWinActive ahk_class ConsoleWindowClass
^V::
SendInput {Raw}%clipboard%
return
#IfWinActive
#IfWinActive
#c::
WinGetText, text, A ; This is required to get the full path of the file ftom the address bar
StringSplit, word_array, text, `n ; Get the first string which is usually full path in the address bar
t = %word_array1% ; Take the first element from the array
StringReplace, t, t, `r, , all ; Just in case
clipboard_prev = %clipboard%
clipboard =
Send, {F2}
Send, ^c
Send, {Esc}
cb = %clipboard%
clipboard = %clipboard_prev%
IfInString t, \
{
IfInString cb, .
{
Run, cmd /K cd "%t%"
WinWaitActive, cmd.exe,,1
Send, %cb%
}
else
Run, cmd /K cd "%t%"
}
else
Run, cmd /K cd "C:\"
return
^!r::
Run, %windir%\system32\mstsc.exe
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment