petrovu4 Posted October 13, 2022 Posted October 13, 2022 $start = True HotKeySet("{NUMPAD1}","Press") HotKeySet("{p}", "Terminate") While 1 Sleep(1000) WEnd Func Press() If $start Then $start = False While 1 $coord = PixelSearch(2986, 284, 2986, 284, 0xFFE595,4) If IsArray($coord) Then Send("{SPACE}") MsgBox(0, "","Desktop") $start = True ExitLoop EndIf WEnd EndIf EndFunc Func Terminate() MsgBox(4096, "", "end") Exit 0 EndFunc Since there is no way to search for more than one pixel in one program, I run several such programs. But no matter if 10 or 3 programs are running, the pixel search becomes very bad as soon as more than one program is running. I use pixel search to find certain frames in my video and cut them out. 60 frames per second. Pixel search can handle that speed. But if run 2 or more programs it starts to run slower. I don't understand what the problem is. My video is 3+ hours long and I need to check 27 pixels to find certain frames. Checking each pixel separately would be a living hell and a waste of time. Maybe there is a way to run at least 3 or 5 programs at the same time.
Nine Posted October 13, 2022 Posted October 13, 2022 26 minutes ago, petrovu4 said: Since there is no way to search for more than one pixel in one program False. You can search as many pixels as you want into a single script. PixelSearch can be quite slow with Win10 +. You could consider using my screen scraping UDF (see my signature). “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Multi-Threading Made Easy
petrovu4 Posted October 13, 2022 Author Posted October 13, 2022 30 minutes ago, Nine said: False. You can search as many pixels as you want into a single script. I tried similar scripts, but they didn't work. HotKeySet("{NUMPAD2}","Press2") HotKeySet("{NUMPAD1}","Press1") Func Press1() While 1 $coord = PixelSearch(2986, 284, 2986, 284, 0xFFE595,4) If IsArray($coord) Then Send("{SPACE}") MsgBox(0, "","1") ExitLoop EndIf WEnd EndFunc Func Press2() While 1 $coord = PixelSearch(1186, 912, 1186, 912, 0x24E602,2) If IsArray($coord) Then Send("{SPACE}") MsgBox(0, "","2") ExitLoop EndIf WEnd EndFunc Then I read somewhere that autoit is not multi-threaded, so it can't run multiple loops simultaneously. I need all colors to be checked simultaneously, not sequentially. And I also can't find a way to run multiple loops at once, except through a key. Even if you can run multiple cycles and I'm wrong. Then how do you run them? I haven't found a way to do something like Press1() ; calls a function without waiting for the end Press2() ; calls a function without waiting for the end Press3() ; calls a function without waiting for the end .... There is Call("fun") but it stops the code
petrovu4 Posted October 13, 2022 Author Posted October 13, 2022 Maybe Sleep(10) will help in optimization. It seems that it should not affect the quality of response because 60 frames per second = 1000/60 = 16.67 milliseconds per frame
petrovu4 Posted October 16, 2022 Author Posted October 16, 2022 (edited) I installed Windows 7, and I had ~100,000 there. But after I downloaded something I got the same ~60 as on Windows 10. Test code(NOT MY): $t = TimerInit() $n = 0 While TimerDiff($t) < 1000 $n += 1 pixelsearch(500, 500, 500, 500, 0) WEnd MsgBox(0,"",$n & " Repetitions done" & @CRLF) That is, the program worked fine on 7, but after I downloaded something, some software, with new tests there was the same problem as on 10. My point is that maybe the problem is not in the operating system at all, but in some program. I have already made the video I need, but can someone not too lazy to experiment with removing something like this: Here's everything I had when it worked correctly: Honestly I don't understand anything about this, but maybe the problem is some software that just conflicts with PixelSearch, or limits it Edited October 16, 2022 by petrovu4
Werty Posted October 16, 2022 Posted October 16, 2022 (edited) On Win7 with classic theme it should be fast, on Win7 with Aero (DWM.EXE) things are slow, as with win10. I havent tried myself on Win10, but on win7 you could just open taskmanager and shut down DWM.EXE and pixel searches was fast again. /edit just read around and it seems that DWM is under services now, and can still be disabled (according to the web, havent tried myself) But Win7 with classic theme is fast, i dont know if there is a classic theme for win10/11, i'm running unactivated windows so cant check, else try and disable dwm in sevices. Edited October 16, 2022 by Werty Some guy's script + some other guy's script = my script!
dmob Posted October 18, 2022 Posted October 18, 2022 Try this UDF by NHD. I have used it successfully to launch multiple "processes" and works as expected.
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