| View previous topic :: View next topic |
| Author |
Message |
Me!
Joined: 20 Sep 2007 Posts: 23
|
Posted: Sun Jul 20, 2008 8:56 am Post subject: Retrive number of folders in a folder without parsing |
|
|
| When you right click on a folder and select properties one of the bits of information you are given is the number of folders it contains. I would like to retrieve that number without having to Loop and count A_index or something similarly slow. Is there a function I am overlooking that does this? |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Jul 20, 2008 9:24 am Post subject: Re: Retrive number of folders in a folder without parsing |
|
|
| Me! wrote: | | When you right click on a folder and select properties one of the bits of information you are given is the number of folders it contains. | Windows also loops to enumerate them  |
|
| Back to top |
|
 |
Me!
Joined: 20 Sep 2007 Posts: 23
|
Posted: Sun Jul 20, 2008 9:38 am Post subject: |
|
|
| So why does it take so much longer for AHK to do it? |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Jul 20, 2008 10:45 am Post subject: |
|
|
It's not slow. it takes only about 0.5 secs to enumerate 1500 folders
| Code: | Begin := A_TickCount
Loop, C:\Windows\*, 2, 1
n := A_Index
msgbox % "Total of " n " Folders`nElapsed " A_TickCount-Begin "ms" |
|
|
| Back to top |
|
 |
Me!
Joined: 20 Sep 2007 Posts: 23
|
Posted: Sun Jul 20, 2008 11:06 am Post subject: |
|
|
You are quite right thank you. That is very speedy. It slows down considerably when I add this:
| Code: | Process Priority,,High
filepattern = %A_MyDocuments%\My Music\*.mp3
Begin := A_TickCount
loop, %FilePattern%,0,1
{
IniWrite, %A_LoopFileFullPath%, MP3Idata, MP3 Search, %A_LoopFileName%
n := A_Index
}
msgbox % "Total of " n " Songs`nElapsed " A_TickCount-Begin "ms"
exitapp |
is there a way to speed that up? |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Jul 20, 2008 11:48 am Post subject: |
|
|
HDD is most slow hardware of computer. don't write to HDD each time. write to RAM then write to HDD only once at the end.
| Code: | Process Priority,,High
filepattern = %A_MyDocuments%\My Music\*.mp3
Begin := A_TickCount
output = [MP3 Search]`n
loop, %FilePattern%,0,1
{
output .= A_LoopFileFullPath "=" A_LoopFileName "`n"
n := A_Index
}
FileAppend, %Output%, MP3Idata.ini
msgbox % "Total of " n " Songs`nElapsed " A_TickCount-Begin "ms" |
|
|
| Back to top |
|
 |
Me!
Joined: 20 Sep 2007 Posts: 23
|
Posted: Sun Jul 20, 2008 12:44 pm Post subject: |
|
|
| Elegant and informative. I am very grateful. |
|
| Back to top |
|
 |
|