au3 script for ALWAYS auto-expanding the tree-view node

Discussion and questions - donor version.
Post Reply
Message
Author
autocart
Posts: 28
Joined: 27.09.2011, 13:30

au3 script for ALWAYS auto-expanding the tree-view node

#1 Post by autocart » 04.10.2013, 10:02

Hi all,

FC XE offers the tree-settings "Auto expand on click" and "Follow location changes in the active panel", however it does not auto expand the tree node on the location following (only on manual click), which is VERY annoying to me. Therefore I wrote a little AutoIt3 script to add that functionality to FC XE. With this script the tree should ALWAYS, ony any location change, auto-expand the tree node. I would have attached the compiled exe but obviously I can not attach files in this forum?? But here is the code for all who would like to use it for themselfs too:

You need to have AutoIt3 installed for it too work. Save the code into a plain text file with the extension ".au3". Then you can either run the script or compile it to exe and run the exe. It will stay in the background until you exit it manually from the system tray. Hope it works for you but it is only provided "AS IS". Usage is at everybody's own risk. BTW, it works only with ONE FC XE instance at a time. AND the tree-setting "Follow location changes in the active panel" MUST be activated. ("Auto expand on click" does not need to be active - either way, it should not matter, since the script basically overrides this setting.)

Regards, Stephan

Code: Select all

Opt('WinWaitDelay',50)

Func _Expand_FCXE_TreeViewItem($title)
	$controlIDFocus = ControlGetFocus($title, "")
	ControlFocus($title, "", "TfcShellTree1")
	$selectedItem = ControlTreeView($title, "", "TfcShellTree1", "GetSelected", "UseIndex")
	ControlTreeView($title, "", "TfcShellTree1", "Expand", $selectedItem)
	ControlFocus($title, "", $controlIDFocus)
EndFunc

$FCXE_hWnd = 0

While 1
	If Not $FCXE_hWnd Then
		Opt('WinTitleMatchMode',2)
		$FCXE_hWnd = WinWait(" - FreeCommander XE", "")
	EndIf
	$FCXE_fullTitle = WinGetTitle($FCXE_hWnd)
	$titleSubstring = StringLeft(StringRight($FCXE_fullTitle, StringLen(" - FreeCommander XE")+4), 4)
	If WinExists($FCXE_hWnd, "") And $titleSubstring <> ".fcc" And $titleSubstring <> ".zip" Then
		_Expand_FCXE_TreeViewItem($FCXE_hWnd)
	Else
		$FCXE_hWnd = 0
	EndIf
	Opt('WinTitleMatchMode',3)
	WinWaitClose($FCXE_fullTitle, "")
WEnd
EDIT: Script improved.

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests