AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Retrive number of folders in a folder without parsing

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Me!



Joined: 20 Sep 2007
Posts: 23

PostPosted: Sun Jul 20, 2008 8:56 am    Post subject: Retrive number of folders in a folder without parsing Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Sun Jul 20, 2008 9:24 am    Post subject: Re: Retrive number of folders in a folder without parsing Reply with quote

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 Razz
Back to top
Me!



Joined: 20 Sep 2007
Posts: 23

PostPosted: Sun Jul 20, 2008 9:38 am    Post subject: Reply with quote

So why does it take so much longer for AHK to do it?
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Jul 20, 2008 10:45 am    Post subject: Reply with quote

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

PostPosted: Sun Jul 20, 2008 11:06 am    Post subject: Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Sun Jul 20, 2008 11:48 am    Post subject: Reply with quote

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

PostPosted: Sun Jul 20, 2008 12:44 pm    Post subject: Reply with quote

Elegant and informative. I am very grateful.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group