script for treeview of a folder structure?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
BGM
Posts: 496
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
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: 1198
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: 496
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
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: 1198
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”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], lusu2789, zvit and 29 guests