AutoHotkey: Paste TC's active path anywhere: Difference between revisions

From TotalcmdWiki
Jump to navigation Jump to search
mNo edit summary
(added better version by SanskritFritz)
Line 2: Line 2:
<br />
<br />
<br />
<br />
#IfWinExist, ahk_class TTOTAL_CMD
; Default shortcut is Win-A
$#a::
; Read current TC dir from the panel left of the command line
ControlGetText, Path, TMyPanel2
; Replace the trailing > with a \
StringReplace, Path, Path, >, \
; Type it
Send, %Path%
Return
''Alternative version, using the clipboard:''
  #IfWinExist, ahk_class TTOTAL_CMD
  #IfWinExist, ahk_class TTOTAL_CMD
   
   

Revision as of 08:14, 25 June 2006

This script pastes the path from TC's active panel to any window that is currently active. Should be especially useful for Save or Open dialog boxes. It was inspired by majkinetor's TC Fav Menu.

#IfWinExist, ahk_class TTOTAL_CMD

; Default shortcut is Win-A
$#a::

	; Read current TC dir from the panel left of the command line
	ControlGetText, Path, TMyPanel2

	; Replace the trailing > with a \
	StringReplace, Path, Path, >, \

	; Type it
	Send, %Path%
Return


Alternative version, using the clipboard:

#IfWinExist, ahk_class TTOTAL_CMD

; Default shortcut is Win-A
$#a::

	; Backup the clipboard
	ClipboardBackup = %ClipboardAll%

	; Empty the clipboard
	Clipboard =

	; Ask TC for the path
	PostMessage, 1075, 2029, , , ahk_class TTOTAL_CMD

	; Wait at most 2 seconds for the path
	; You can change the value below
	ClipWait, 2

	; Paste and append a backslash
	; You can remove the backslash from the following line if you prefer
	Send, ^v\

	; Restore clipboard from backup
	Clipboard = %ClipboardBackup%

	; Release memory
	ClipboardBackup =
Return


Back to AutoHotkey