ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > Living Room

Daily Autohotkey

<< < (3/4) > >>

capitalH:
By me (or modified by me)
AltTab - based on http://www.autohotkey.net/~evl/AltTab/AltTab.ahk, but heavily modified.
BetterPaste - Plain text pasting
AutoBackup - Detects if my external HD is inserted and the starts the backup (after a confirmation of course, otherwise if I want to do a restore it would be a problem!)
SimpleVersionControl - Once every hour, makes a copy of every changed dox, docx, xls, xlsx etc. and renames it with the time-date in the filename (heavy lifting done by RoboCopy+Dos Batch File (Renaming part), SVC is just a scheduler)
KeePassByPass - Simple script to have KeePass work properly with IE (some passwords were sent incomplete with 1/2 characters missing)
Startup - Runs a list of programs depending if I am at work or at home

By other people
ShutDown Timer - ShutDown after a specified amount of time
FolderMenu - not done by me, but was written in AHK

Stuff that I am working on (but not usable)
Work Logger - Capturing of active window titles, assignment to projects based on rules, and reporting of time spent on those projects
TDL Sync - Sync ToDoList http://www.codeproject.com/KB/applications/todolist2.aspxto GroupWise
ShutDown Timer2 - ShutDown when a process cease to exist (should be easy - but just have not started with it yet)

MilesAhead:

* lanux128's OSD-Mute
* my own DriveKeysAtoZ
* Skwire's Trout
-app103 (May 05, 2011, 10:53 AM)
--- End quote ---

DriveKeysAtoZ is handy. I like the RControl as it doesn't interfere with say Control-t or other use of left control key.

I reworked it just a tad, mainly to add EmptyWorkingSet() call that reduces memory usage to around 328 KB sitting in the tray. I also added a 2 second time-out to the error box so that the user isn't forced into a key press to clear it.

Edit: also added ifwinactive so that the hotkeys would only work if Explorer or the Desktop is that active window.  Avoids conflicts with editors etc..

Edit2: also added tray and taskbar to make life a bit easier.


--- ---#NoEnv
#SingleInstance,Force
SetBatchLines,-1
SetTitleMatchMode,RegEx
GroupAdd,DesktopGroup, ahk_class CabinetWClass
GroupAdd,DesktopGroup, ahk_class ExploreWClass
GroupAdd,DesktopGroup, ahk_class Progman
GroupAdd,DesktopGroup, ahk_class WorkerW
GroupAdd,DesktopGroup, ahk_class Tray
Hotkey, IfWinActive, ahk_Group DesktopGroup

Loop,% Asc("Z")-Asc("A")+1
{
  drive:=Chr(Asc("A")+A_Index-1)
  Hotkey,RCtrl & %drive%,OPEN
}
  _EmptyWorkingSet()
Return

OPEN:
  StringTrimLeft,drive,A_ThisHotkey,8
  IfNotExist, %drive%:\
  MsgBox, 4112, DriveKeysAtoZ, %drive% drive does not exist, 2
  Else
  {
    Run,Explorer.exe /e`,%drive%:\
  }
  _EmptyWorkingSet()
Return

_EmptyWorkingSet()
{
  Return DllCall("psapi.dll\EmptyWorkingSet", "UInt", -1)
}

MilesAhead:
Ok, now I see why you did it the long way using all :: for hotkeys.

Basically I went back to the source in your download and just added the
IfWinActive bit.  The other wrinkle is holding the Left Mouse Button down while
hitting a key.  That way I can use the mouse click to make the desktop or some
non application space active, such as task tray.  While holding the left mouse
button down I just hit a letter key.  Otherwise I have to click someplace to make
a safe window the active window, then let go of the mouse and hit a key combo.
If you are more keyboard oriented this is probably no hassle as you may hit
AltTab to go to another window or some other key combo.  But I'm mouse
oriented.  This is just a variation more comfortable for me. I hope you don't
mind me tromping on your ahk code. It's just a handy util so I wanted to
modify for the mouse oriented types like myself. :)

edit: even with the hotkeys all hard coded using :: the calls to EmptyWorkingSet()
keep memory usage in the tray under a MB.


--- ---;DriveKeysAtoZ.ahk
;Opens Explorer to the root of the desired drive letter.
;Version 1.0
;April 23, 2007
;Author: A. Russo (app103)
;Home page: http://www.appsapps.info
;Email:  [email protected]

;Visit DonationCoder.com for more great original software.

;NOTE:
;The hotkey combination I used will not work on 9x systems.
;I will change it or compile a 9x version as soon as I can think of
;   an appropriate key to use in place of the Right Control key.

; limitations on active window and change of RCtrl modifier to
; left mouse button by MilesAhead

SetTitleMatchMode,RegEx
GroupAdd,DesktopGroup, ahk_class CabinetWClass
GroupAdd,DesktopGroup, ahk_class ExploreWClass
GroupAdd,DesktopGroup, ahk_class Progman
GroupAdd,DesktopGroup, ahk_class WorkerW
GroupAdd,DesktopGroup, ahk_class Tray
Hotkey, IfWinActive, ahk_Group DesktopGroup

~LButton & a::
IfNotExist, A:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore A:\
_EmptyWorkingSet()
return

~LButton & b::
IfNotExist, B:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore B:\
_EmptyWorkingSet()
return

~LButton & c::
IfNotExist, C:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore C:\
_EmptyWorkingSet()
return

~LButton & d::
IfNotExist, D:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore D:\
_EmptyWorkingSet()
return

~LButton & e::
IfNotExist, E:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore E:\
_EmptyWorkingSet()
return

~LButton & f::
IfNotExist, F:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore F:\
_EmptyWorkingSet()
return

~LButton & g::
IfNotExist, G:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore G:\
_EmptyWorkingSet()
return

~LButton & h::
IfNotExist, H:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore H:\
_EmptyWorkingSet()
return

~LButton & i::
IfNotExist, I:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore I:\
_EmptyWorkingSet()
return

~LButton & j::
IfNotExist, J:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore J:\
_EmptyWorkingSet()
return

~LButton & k::
IfNotExist, K:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore K:\
_EmptyWorkingSet()
return

~LButton & l::
IfNotExist, L:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore L:\
_EmptyWorkingSet()
return

~LButton & m::
IfNotExist, M:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore M:\
_EmptyWorkingSet()
return

~LButton & n::
IfNotExist, N:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore N:\
_EmptyWorkingSet()
return

~LButton & o::
IfNotExist, O:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore O:\
_EmptyWorkingSet()
return

~LButton & p::
IfNotExist, P:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore P:\
_EmptyWorkingSet()
return

~LButton & q::
IfNotExist, Q:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore Q:\
_EmptyWorkingSet()
return

~LButton & r::
IfNotExist, R:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore R:\
_EmptyWorkingSet()
return

~LButton & s::
IfNotExist, S:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore S:\
_EmptyWorkingSet()
return

~LButton & t::
IfNotExist, T:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore T:\
_EmptyWorkingSet()
return

~LButton & u::
IfNotExist, U:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore U:\
_EmptyWorkingSet()
return

~LButton & v::
IfNotExist, V:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore V:\
_EmptyWorkingSet()
return

~LButton & w::
IfNotExist, W:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore W:\
_EmptyWorkingSet()
return

~LButton & x::
IfNotExist, X:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore X:\
_EmptyWorkingSet()
return

~LButton & y::
IfNotExist, Y:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore Y:\
_EmptyWorkingSet()
return

~LButton & z::
IfNotExist, Z:\
MsgBox, 4112, DriveKeysAtoZ, Drive not found, 2
else
Run,explore Z:\
_EmptyWorkingSet()
return

_EmptyWorkingSet()
{
  Return DllCall("psapi.dll\EmptyWorkingSet", "UInt", -1)
}

MilesAhead:
After messing around I decided staying away from the mouse may be better.
This seems like a simple approach.  You may want to stick in an #IfWinActive
but I don't use Control-UpArrow much that I can remember. With calls to
EmptyWorkingSet it hangs in the tray at around 350 KB.

Edit: added an error notifier ToolTip for drive letters than don't exist.
It disappears after 3 seconds.


--- ---; KeyDrive - another approach to opening a drive with a hotkey
;
; Author - MilesAhead
;
; Usage - Press Control Up Arrow, and when prompted, press a letter.
; if that drive letter exists it should open in Explorer.
;
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, ToolTip,Screen
Menu Tray,NoStandard
Menu Tray,Add,About,DoAbout
Menu Tray,Add
Menu Tray,Add,Quit,DoQuit
Menu Tray,Default,About
Menu Tray,Tip,KeyDrive

_EmptyWorkingSet()

^Up::
  ToolTip,Press a letter to open Explorer to that drive,(A_ScreenWidth / 2) - 100,A_ScreenHeight / 2
  Input,keypress,L1
  ToolTip
  dr := keypress . ":\"
  If FileExist(dr)
  {
Run,Explorer.exe /e`,%keypress%:\
  }
  else
  {
    ToolTip,%keypress%:\  Drive Does Not Exist!,(A_ScreenWidth / 2) - 100,A_ScreenHeight / 2
    Sleep,3000
    ToolTip
  }
  _EmptyWorkingSet()
Return

_EmptyWorkingSet()
{
  Return DllCall("psapi.dll\EmptyWorkingSet", "UInt", -1)
}

DoAbout:
  MsgBox, 4160, KeyDrive, Press Control Up Arrow then a letter to Open that drive in Explorer, 10
Return 
 
DoQuit:
  ExitApp

MilesAhead:
Sorry to keep doing follow-ups. But when I see a good idea I like to try to add variations or features.

I added a couple more hotkeys with sort of a fake Snap functionality.  Unlike Windows7 where you hit Winkey Left Arrow to put the active window on the left half of the screen, here you use RWinKey Left Arrow and hit a letter to open an Explorer window for that drive on the left half of the screen.  Also you can hit RWinKey Up Arrow and 2 letters to put up 2 drives side by side. They can be the same letter to allow 2 views of C: as example.

It's good for a couple of quick drag & drops.  Complicated file maintenance and you may as well bring up a file manager.  But this snaps up quickly.

The latest version can be downloaded here:
http://www.favessoft.com/hotkeys.html

I called it KeyDrive. I included source and custom icon as well as .exe file. See the About box for hotkeys.

Thanks to App for the inspiration and working code.   :Thmbsup:

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version