Kotomoto82 Posted March 22, 2014 Share Posted March 22, 2014 Hello! I'm trying a simple script:$speedTimer = TimerInit()while $step <= $coordEnd $check = PixelGetColor($step, $y) if $check > 3615000 and $check < 3619000 then ExitLoop endif $step = $step + 1WEndConsoleWrite(TimerDiff($speedTimer) & " " & @CRLF)My puter gives me 0,034 sec while my wife's PC -- 3,6 sec. The both computers are: intel-core i5-3450 CPU @3.10 Ghz 3.10 Ghz, 8 Gb, gforce 550 latest drivers, Windows 7 SP-1. I tried switching off antiviruses but it didn't help. Even simple notepad script takes ages to run... And ideas?Thanks in advance! Link to comment Share on other sites More sharing options...
water Posted March 22, 2014 Share Posted March 22, 2014 Welcome to AutoIt and the forum! Working with pixels isn't very fast. Which program do you try to automate? Most of the time there are faster ways to do what you want to do. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted March 22, 2014 Share Posted March 22, 2014 Your wifes probably has aero theme employed. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Kotomoto82 Posted March 22, 2014 Author Share Posted March 22, 2014 Running this script on windows desktop just for tests. Okay, I made it 'Windows Classic' theme and 'Highest performance". It's better .. a bit. 3,4 sec. Any more ideas please? Link to comment Share on other sites More sharing options...
water Posted March 22, 2014 Share Posted March 22, 2014 (edited) Why do you want to spend time to improve the performance of a test script? I suggest to grab a real life problem, write a script and then make it faster. Edited March 22, 2014 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Kotomoto82 Posted March 22, 2014 Author Share Posted March 22, 2014 I'm trying to figure out the source of the problem. ANY autoit script works 1000 times slower on my wife's machince for some reason. AutoIT version 3.3.10.2. Link to comment Share on other sites More sharing options...
JohnOne Posted March 22, 2014 Share Posted March 22, 2014 Could be a shit or badly configured antivirus app. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Guest Posted March 22, 2014 Share Posted March 22, 2014 (edited) Try this: #include <Constants.au3> $speedTimer = TimerInit() $PowerScheme = GetCurrentPowerScheme() DllCall("dwmapi.dll", "hwnd", "DwmEnableComposition", "uint", 0) ; Disable windows aero effect Run(@ComSpec & " /c Powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ; Change power plan to 'Highest performance" while $step <= $coordEnd $check = PixelGetColor($step, $y) if $check > 3615000 and $check < 3619000 then ExitLoop endif $step = $step + 1 WEnd ConsoleWrite(TimerDiff($speedTimer) & " " & @CRLF) DllCall("dwmapi.dll", "hwnd", "DwmEnableComposition", "uint", 1) ; Enable windows aero effect Run(@ComSpec & " /c Powercfg -setactive "&$PowerScheme, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ; Change power plan to previous power plan Func GetCurrentPowerScheme() Local $PowerScheme = -1 , $DOS $DOS = Run(@ComSpec & " /c " & 'Powercfg -getactivescheme', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS, 5) $PowerScheme = StdoutRead($DOS) $PowerScheme = StringTrimLeft($PowerScheme, StringLen("Power Scheme GUID: ")) $PowerScheme = StringSplit($PowerScheme, " ", 1) $PowerScheme = $PowerScheme[1] Return $PowerScheme EndFunc ;==>GetCurrentPowerScheme Add the missing variables. Edited March 22, 2014 by Guest Link to comment Share on other sites More sharing options...
Kotomoto82 Posted March 22, 2014 Author Share Posted March 22, 2014 (edited) Try this: #include <Constants.au3> $speedTimer = TimerInit() $PowerScheme = GetCurrentPowerScheme() DllCall("dwmapi.dll", "hwnd", "DwmEnableComposition", "uint", 0) ; Disable windows aero effect Run(@ComSpec & " /c Powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ; Change power plan to 'Highest performance" while $step <= $coordEnd $check = PixelGetColor($step, $y) if $check > 3615000 and $check < 3619000 then ExitLoop endif $step = $step + 1 WEnd ConsoleWrite(TimerDiff($speedTimer) & " " & @CRLF) DllCall("dwmapi.dll", "hwnd", "DwmEnableComposition", "uint", 1) ; Enable windows aero effect Run(@ComSpec & " /c Powercfg -setactive "&$PowerScheme, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ; Change power plan to previous power plan Func GetCurrentPowerScheme() Local $PowerScheme = -1 , $DOS $DOS = Run(@ComSpec & " /c " & 'Powercfg -getactivescheme', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS, 5) $PowerScheme = StdoutRead($DOS) $PowerScheme = StringTrimLeft($PowerScheme, StringLen("Power Scheme GUID: ")) $PowerScheme = StringSplit($PowerScheme, " ", 1) $PowerScheme = $PowerScheme[1] Return $PowerScheme EndFunc ;==>GetCurrentPowerScheme Add the missing variables. The result is 5103.710790044. Basically 5secs. Edited March 22, 2014 by Kotomoto82 Link to comment Share on other sites More sharing options...
Guest Posted March 22, 2014 Share Posted March 22, 2014 The result is 5103.710790044. Basically 5secs. Maybe it's because the line: $PowerScheme = GetCurrentPowerScheme() is after the line: $speedTimer = TimerInit() try to move $PowerScheme = GetCurrentPowerScheme() to before $speedTimer = TimerInit() But in this case, you do not count the time that GetCurrentPowerScheme() takes. If you get better result then you can delete lines: $PowerScheme = GetCurrentPowerScheme() and Run(@ComSpec & " /c Powercfg -setactive "&$PowerScheme, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) that way you can save time but the script will not restore the power plan settings. I do not believe that GetCurrentPowerScheme() takes more than half a second. But if that is the case then it can help. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 22, 2014 Developers Share Posted March 22, 2014 Am I correct when you stated that the most simple au3 script are slow on that one PC? Even when it contains only: $a=1 Are you running from SciTE? If so, could you post all SciTE outputpane information? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Kotomoto82 Posted March 22, 2014 Author Share Posted March 22, 2014 $timer = TimerInit() $a = 1 $b = 2 $c = $a + $b ToolTip(TimerDiff($timer), 0, 0) ----------------- 4377.00343477 Just deinstalled Norton 360 so it's not the fault of the antivirus. ------------------ In the previous script, yes, indeed moving $PowerScheme = GetCurrentPowerScheme() up improved it by 0.5 sec. Link to comment Share on other sites More sharing options...
Guest Posted March 22, 2014 Share Posted March 22, 2014 What happens if you run this script? DllCall("dwmapi.dll", "hwnd", "DwmEnableComposition", "uint", 0) ; Disable windows aero effect Sleep(5000) DllCall("dwmapi.dll", "hwnd", "DwmEnableComposition", "uint", 1) ; Enable windows aero effect Do you see any change?I'm afraid not.What operating system are you using? Link to comment Share on other sites More sharing options...
Kotomoto82 Posted March 22, 2014 Author Share Posted March 22, 2014 it's windows 7 SP-1. Just tried it on my laptop, windows 8.1. " $timer = TimerInit() $a = 1 $b = 2 $c = $a + $b ToolTip(TimerDiff($timer), 0, 0) " gives 0.0027 etc but my first script same result as my wife's computer -- 3,4+ sec. Maybe it's a virus after all. Too tired ot figure it out now. i'll try tomorrow. Your help is appreciated! Thanks. Link to comment Share on other sites More sharing options...
Guest Posted March 22, 2014 Share Posted March 22, 2014 (edited) If your code checks every pixel on the screen/whatever, you can do it faster if your code will not check all pixels .. this code not checks all pixel but and much much faster. And still can do the job Local $x , $y , $timer = TimerInit() Do $x = 1 Do $y = 1 Do ToolTip("X",$x,$y) $y = $y+10 Until $y >= @DesktopHeight $x = $x+10 Until $x >= @DesktopWidth Until $x >= @DesktopWidth And $y >= @DesktopHeight ConsoleWrite("time: "&TimerDiff($timer)&@CRLF) EDIT: and if you disable the ToolTip then it will be much much much faster Edited March 22, 2014 by Guest Link to comment Share on other sites More sharing options...
Zedna Posted March 23, 2014 Share Posted March 23, 2014 (edited) I recommend to use SysInternals Process Explorer http://technet.microsoft.com/en-us/sysinternals/bb896653 or Process Monitor http://technet.microsoft.com/en-us/sysinternals/bb896645 to see what (undesirable) processes are running at backround and slowing down your system. It's probably some virus or malware or forgotten antivirus. I heard about some computers with more than one antivirus installed! I would expect that this may be also your case ;-) Edited March 23, 2014 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Kotomoto82 Posted March 23, 2014 Author Share Posted March 23, 2014 Thanks, Zedna, i'll try it now. Link to comment Share on other sites More sharing options...
Kotomoto82 Posted March 24, 2014 Author Share Posted March 24, 2014 gil900 thanks for the tip. Do .. until is faster. I tried Bart PE with Win Xp on my laptop. The script works ok, as fast as on my puter. So it must be some driver that slows down autoit script. To be continued... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now