Page 1 of 1

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

Posted: 04.10.2013, 08:02
by autocart
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


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)

$FCXE_hWnd = 0

While 1
	If Not $FCXE_hWnd Then
		$FCXE_hWnd = WinWait(" - FreeCommander XE", "")
	$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
		$FCXE_hWnd = 0
	WinWaitClose($FCXE_fullTitle, "")
EDIT: Script improved.