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 

Why does AutoHotKey run so slow?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
newbieEdward
Guest





PostPosted: Thu Jul 02, 2009 5:16 am    Post subject: Why does AutoHotKey run so slow? Reply with quote

Crying or Very sad I am new to autohotkey. when i open a website, such as suggestedin the tutorial, Run www.google.com it takes 5 or 6 seconds, the same just for opening a folder, for example, Run, C:\My Recordings. The only command i have tried so far that is quick is MsgBox. This is on XP home. If anyone knows how to make it run quickly, i would love to know. thanks, edward
Back to top
sinkfaze



Joined: 18 Mar 2008
Posts: 5043
Location: the tunnel(?=light)

PostPosted: Thu Jul 02, 2009 6:09 am    Post subject: Re: Why does AutoHotKey run so slow? Reply with quote

All AHK does when Run www.google.com is executed is call your default web browser to open the website; everthing else in terms of speed is dependent upon your PC and your web browser. The same also applies for Run, C:\My Recordings with an additional factor being the size of the folder being accessed. If you have any doubts here's a way to check how quickly the commands are being executed:

Code:
!x::
Start := A_TickCount
Run www.google.com
MsgBox % A_TickCount - Start "ms have passed."
return

!y::
Start := A_TickCount
Run C:\My Recordings
MsgBox % A_TickCount - Start "ms have passed."
return


Both of those will display a message box that shows the amount of milliseconds it took to process those commands. If you'd like you can let us know how many milliseconds each one took compared to how fast you estimate the whole task was completed in, but chances are the slowness is a result of the PC and/or web browser, which AHK doesn't have any control over in that regard. It can tell them to open, but not how fast.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
pajenn



Joined: 07 Feb 2009
Posts: 384

PostPosted: Thu Jul 02, 2009 8:13 am    Post subject: Reply with quote

try running those commands a few times in a row to make sure the delay is not due to the initialization of your browsers. compare to how quickly they open if you use a regular shortcut.

check that your antivirus/antispyware or firewall isn't delaying ahk to scan it (whitelist autohotkey.exe and *.ahk).

use "SetBatchLines, -1" or "Process, Priority, High" at the beginning of the script, though these are more likely to matter only for larger scripts or when your system is under stress.

I see people debate the usefulness of "defragging" quite a bit, but I'm a proponent of it when done to optimize file arrangement rather than just straight defragmenting of files. I enable last access time stamps i.e. turn off (to 0) NtfsDisableLastAccessUpdate entries in registry (for ntfs only of course), and I use a good defragger to optimize my system. i.e. generally they move the files that are accessed frequently to the faster areas of the hard drive (outer edge), but I also like to move frequently used *.exe, *.dll, *.ahk, etc to the fast areas, and files I never need (*.zip, *.rar, *.iso, ...) to the inner (slower) areas.
_________________
Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler.
Back to top
View user's profile Send private message
BoBoł
Guest





PostPosted: Thu Jul 02, 2009 8:56 am    Post subject: Reply with quote

Quote:
and I use a good defragger to optimize my system
Which one (link) ?
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 7293
Location: Australia

PostPosted: Thu Jul 02, 2009 9:58 am    Post subject: Reply with quote

At least one other user has had this problem. I couldn't find the thread, but I think explicitly specifying the browser exe solved the problem. For instance:
Code:
; Ensure the path is correct before testing:
Run "%A_ProgramFiles%\Mozilla Firefox\firefox.exe" http://www.google.com
; Path usually isn't necessary for IE:
Run iexplore.exe http://www.google.com
sinkfaze wrote:
All AHK does when Run www.google.com is executed is call your default web browser to open the website;
In fact, it does even less: it passes the URL to ShellExecuteEx, and the shell (i.e. Windows Explorer) does the rest.
Back to top
View user's profile Send private message Visit poster's website
pajenn



Joined: 07 Feb 2009
Posts: 384

PostPosted: Thu Jul 02, 2009 11:15 am    Post subject: Reply with quote

BoBoł wrote:
Quote:
and I use a good defragger to optimize my system
Which one (link) ?


I've tried many, but currently I use Disktrix Ultimate Defrag because (a) it can run in safe mode (fewer active/locked processes = better defrags), and (b) it gives user more options to specify how system will be optimized than other defraggers I've tried. But (c) may be confusing to configure for the typical user who has not read the manual and isn't familiar with hard drive optimization concepts, and (d) not free.

link : http://www.disktrix.com/ultimatedefrag_home.htm

There's a free version, but it looks slightly older, and may not have a full boot time defrag feature: http://download.cnet.com/UltimateDefrag-Freeware-Edition/3000-2094_4-10582157.html

Another free one I like is Microsoft's (a la Sysinternals) ScanDefrag with JkDefrag algorithm chosen, PageDefrag added (also from MS a la Sysinternals), and last access time stamps enabled. However, it's slow so when I use it it choose the 'shut computer when done' option and leave it to defrag over night.
http://www.majorgeeks.com/download.php/www.haysoft.com/hs/%94http://www.majorgeeks.com/ScanDefrag_d5108.html
and http://majorgeeks.com/Pagedefrag_d603.html

I also run a Registry Defrag now and then (I think this covers the boot defrag issue). PageDefrag (previous link) works and I think all reg defraggers do exactly the same thing. I mostly use NTREGOPT for no particular reason - it came with ERUNT, which is another great free utility - it backs up reg hives and serves as a system restore replacement): http://majorgeeks.com/Erunt_d1267.html
_________________
Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler.
Back to top
View user's profile Send private message
newbieEdward2
Guest





PostPosted: Thu Jul 02, 2009 2:13 pm    Post subject: Thank you!... for your reply to my slow browser opening Reply with quote

Lexicox, Thank you! Thank you! Thank you! I tried inserting the path as you suggested and the result: (using the timer MsgBox suggested by sinkfaze, for which I am also appreciative) the time to open google.com was reduced as follows: Before: 14656 ms. After: 94 ms.!!!!!! I had tried opening the browser repeatedly and the timing did not change. Even opening C:\My Recording took over 7 seconds (for example,7844 ms, 7656 ms, 7938 ms on three successive attempts. And, the size of the MyRecording file is only 252 mb). So, the path is the answer. I studied a little bit of VB (back in the day of VB 4.0), so boy am I going to enjoy AutoHotkey. This looks like a great forum. If I had not found a solution to this slow opening issue, I would not used this terrific program. I think I already said it, but I will say it again to make sure: Thank you, Lexicos!!!!! Edward in Seattle, Washington. Very Happy Very Happy Very Happy
Back to top
newbieEdward3
Guest





PostPosted: Thu Jul 02, 2009 2:16 pm    Post subject: Thank you Lexikos! Reply with quote

Thank you Lexikos! Sorry I so badly mispelled your name!!! Don't know what I was thinking, if anything
Back to top
Jayman



Joined: 21 Oct 2007
Posts: 54

PostPosted: Thu Jul 02, 2009 2:41 pm    Post subject: Reply with quote

Quote:
Lexicox


I wont laugh, I promise.
Back to top
View user's profile Send private message
hutch@edge.net



Joined: 16 Sep 2008
Posts: 77

PostPosted: Thu Jul 02, 2009 3:39 pm    Post subject: Reply with quote

Too late for me. I cracked up, already. LOL. (I'm soooo freakin' immature.)
Back to top
View user's profile Send private message
Miles11
Guest





PostPosted: Fri Jul 03, 2009 5:41 am    Post subject: Explorer slow to open C:\ Reply with quote

Does anyone know why explorer is much slower to open c:\ than google, as below? I can click Start, My Computer and then C: much faster than AutoHotKey opens C: as per the second script below.

!x::
Start := A_TickCount
Run iexplore.exe http://www.google.com
MsgBox % A_TickCount - Start "ms have passed."
return

!y::
Start := A_TickCount
Run iexplore.exe C:\
MsgBox % A_TickCount - Start "ms have passed."
return
Back to top
Z_Gecko
Guest





PostPosted: Fri Jul 03, 2009 5:50 am    Post subject: Reply with quote

Code:
!y::
Start := A_TickCount
Run explorer.exe C:\
MsgBox % A_TickCount - Start "ms have passed."
return
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 7293
Location: Australia

PostPosted: Fri Jul 03, 2009 6:53 am    Post subject: Reply with quote

Btw, you can also open an explorer window with a particular object selected:
Code:
Run explorer.exe /select,c:
This opens My Computer with C: selected.
Back to top
View user's profile Send private message Visit poster's website
pajenn



Joined: 07 Feb 2009
Posts: 384

PostPosted: Fri Jul 03, 2009 9:55 am    Post subject: Re: Explorer slow to open C:\ Reply with quote

Miles11 wrote:
Does anyone know why explorer is much slower to open c:\ than google, as below? I can click Start, My Computer and then C: much faster than AutoHotKey opens C: as per the second script below.

!x::
Start := A_TickCount
Run iexplore.exe http://www.google.com
MsgBox % A_TickCount - Start "ms have passed."
return

!y::
Start := A_TickCount
Run iexplore.exe C:\
MsgBox % A_TickCount - Start "ms have passed."
return


C:\ opens faster for me using the above tickcounts as measures. ~200ms if no explorer windows are open. opening to google takes 500-600ms if internet explorer isn't previously open.

However, I don't understand why they should be equal. You are loading two different things so obviously there will be a difference. Personally I find Sean's ShellNavigate() function fastest because it uses an already existing explorer window if one is available. Also, I use Firefox as my default internet browser, and have not optimized internet explorer's configuration - I only keep it around to get Windows Updates.
_________________
Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler.
Back to top
View user's profile Send private message
Display posts from previous:   
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