AutoHotkey: Unpack each archive to a separate subdir

From TotalcmdWiki
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. 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...

; If you always want to extract to the active panel remove the semicolons
; in front of the lines ;Send {DEL}.

~!F6::
If WinActive("ahk_class TTOTAL_CMD") or WinActive("ahk_class TDLGUNZIPALL")
{
  WinWaitActive, ahk_class TDLGUNZIPALL
  ControlSend, TCheckBox1, {SPACE}
  ControlFocus, TEdit2
  ;Send {DEL}
}
Return

~!F9::
If WinActive("ahk_class TTOTAL_CMD") or WinActive("ahk_class TDLGUNZIPALL")
{
  WinWaitActive, ahk_class TDLGUNZIPALL
  ControlSend, TCheckBox1, {SPACE}
  ControlFocus, TEdit2
  ;Send {DEL}
}
Return

Script solution 2

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.

; If you always want to extract to the active panel remove the semicolons
; in front of the lines ;Send {DEL}.

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