Newbie needing guidance

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Mike199028
Posts: 10
Joined: 05 Aug 2018, 18:12

Newbie needing guidance

05 Aug 2018, 18:18

I found this script on this forum it does what I want, I’ve learnt the code I know what each command does but with the many loops I don’t know the flow of the script. I don’t want to learn something and not 100% know how it works.

Like after it’s finished recursing into folders, how does it -1 on the Int value? The flow of the script itself is confusing

Code: Select all

Global strFile := A_ScriptDir . "\Liste.txt"
FileDelete, %strFile%

SetWorkingDir, C:\Program Files
Sub(A_WorkingDir . "\*.*", 0)

run, %strFile%
ToolTip,
Exit

Sub(strDir, intLevel)
{
	ToolTip, Level #%intLevel% %strDir%
	Loop, %intLevel%
		strTabs := strTabs . A_Tab
	Loop, %strDir%, 2 ; scan folders
	{
		FileAppend, %strTabs%\%A_LoopFileName%`n, %strFile%
		Sub(A_LoopFileFullPath . "\*.*", intLevel + 1) ; Recurse to subdirectory
	}
	Loop, %strDir%, 0 ; now scan files only
	{
		FileAppend, %strTabs%\%A_LoopFileName%`n, %strFile%
	}
}
gregster
Posts: 9067
Joined: 30 Sep 2013, 06:48

Re: Newbie needing guidance

05 Aug 2018, 20:11

You would probably make it a bit easier for most readers, if you would add the actual goal of your script; perhaps show the expected result.
Many here can probably make an educated guess, but this is more a general recommendation in order to organize help efficiently.
Mike199028
Posts: 10
Joined: 05 Aug 2018, 18:12

Re: Newbie needing guidance

06 Aug 2018, 04:49

Basically I want to go through a directory listing the whole subfolders and files, using a tab to separate each level but I want to understand the flow of the script
Mike199028
Posts: 10
Joined: 05 Aug 2018, 18:12

Re: Newbie needing guidance

07 Aug 2018, 12:44

Anyone be able to give me some guidance?
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Newbie needing guidance

07 Aug 2018, 13:09

I think I understand the code. I might have written something similar before. What do you need exactly? There is useless ToolTips popping up. Start by removing those.
Mike199028
Posts: 10
Joined: 05 Aug 2018, 18:12

Re: Newbie needing guidance

07 Aug 2018, 14:16

Yeah I’ve removed the tooltip, I understand every command but the amount of loops I’m not entirely sure of the flow of the script. Plus how do the function take back it’s int value when it’s finished searching through subfolders? I get that it recurses Into each folder until it finds nothing else THEN lists the files, I don’t know just something makes me feel I don’t understand the flow correctly. Plus the formatting(A_tab), id like to format it some more somehow, but stumped on which direction to take on it
Mike199028
Posts: 10
Joined: 05 Aug 2018, 18:12

Re: Newbie needing guidance

11 Aug 2018, 17:57

That’s brilliant! Understand it more now!

What would I need to do to format it better? Meaning improving the tabs?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 134 guests