script for treeview of a folder structure?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

script for treeview of a folder structure?

22 Oct 2020, 16:15

Is there a script already made for a treeview to load a folder structure? I don't want to re-invent a wheel.

I want to choose a folder and have it and it's subfolders appear as items in the tree. I can probably figure out how to do this, but was hoping to save some time with kindly-already-existing code.
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: script for treeview of a folder structure?

22 Oct 2020, 18:10

Don’t the docs have an example that does this?
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: script for treeview of a folder structure?

23 Oct 2020, 08:38

The docs have an example of how to make tree items and sub-tree items.

Anyway, I spent the time.

Code: Select all

		loop, files, %rootfolder%\*, D
		{
			parentfolder := a_loopfilename

			parentitem := tv_add(a_loopfilename)
			loop, files, %a_loopfilefullpath%\*, D
			{
				tv_add(a_loopfilename,parentitem)
			}
		}
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: script for treeview of a folder structure?

23 Oct 2020, 08:44

The documentation example I mentioned is here - https://www.autohotkey.com/docs/commands/TreeView.htm#ExAdvanced

I feel like that's pretty self-explanatory. Just modify it to prompt for the folder instead of hard coding the root...

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 190 guests