AutoHotkey: Unpack each archive to a separate subdir

From TotalcmdWiki
Revision as of 11:29, 8 August 2005 by Hacker (talk | contribs) (Added Script solution 3)
Jump to navigation Jump to search
; Script solution 1

; Whenever the unpack dialog is invoked by Alt+F6 or Alt+F9, the checkbox
; Unpack each archive to a separate subdir is automatically toggled and
; the focus is reset to the path box.
; If you always want to extract to the active panel remove the semicolons
; in front of the lines ;Send {DEL}.
; In contrary to the second solution this script uses no resources when idling but it
; works only with the hotkeys, not by calling the dialog by button, menu entry, etc...

~!F6::
Sleep, 250
IfWinActive, ahk_class TDLGUNZIPALL
{
  ControlSend, TCheckBox1, {SPACE}
  ControlFocus, TEdit2
  ;Send {DEL}
}
Return

~!F9::
Sleep, 250
IfWinActive, ahk_class TDLGUNZIPALL
{
  ControlSend, TCheckBox1, {SPACE}
  ControlFocus, TEdit2
  ;Send {DEL}
}
Return


; Script solution 2

; Whenever the unpack dialog is invoked, the checkbox
; Unpack each archive to a separate subdir is automatically set and the
; focus is reset to the path box.
; If you always want to extract to the active panel remove the semicolons
; in front of the lines ;Send {DEL}.
; In contrary to the first solution this script uses a little CPU performance
; due to the permanent monitoring but its advantage is that it doesn't matter
; how the unpack dialog is invoked.

Loop
{
  WinWaitActive, ahk_class TDLGUNZIPALL
  ControlSend, TCheckBox1, {SPACE}
  ControlFocus, TEdit2
  ;Send {DEL}
  WinWaitNotActive, ahk_class TDLGUNZIPALL
}
Return


/*

Script solution 3

Upon pressing Ctrl+Alt+Shift+F9 this script automatically
unpacks the selected archives to subdirectories of the
current dir.

*/


$^!+F9::
IfWinActive ahk_class TTOTAL_CMD
{
	PostMessage, 1075, 509
	WinWaitActive, ahk_class TDLGUNZIPALL
	Send, {Del}
	Control, Check, , TCheckBox1
	Send, {Enter}
}
else
	Send ^!+{F9}
return


Back to AutoHotkey