tsue Posted May 7, 2012 Share Posted May 7, 2012 hello, i have a problem when i set a program to load at windows startup, when the computer turns on it runs the program then one of the commands is to grab pixel colors from the same cords for each 30 seconds, here is the problem it should detect different colors because there's a video running but each time it detects the same colors this problem doesn't happen when the program is started manually (when i do double click to run it or f5 on autoit scite script editor) maybe the problem is that i need to run it with other parameters but i dont know how to here is the full code in case im missing something expandcollapse popup;~ @SEC Seconds value of clock. Range is 00 to 59 ;~ @MIN Minutes value of clock. Range is 00 to 59 ;~ @HOUR Hours value of clock in 24-hour format. Range is 00 to 23 ;~ @MDAY Current day of month. Range is 01 to 31 ;~ @MON Current month. Range is 01 to 12 ;~ @YEAR Current four-digit year ;~ @WDAY Numeric day of week. Range is 1 to 7 which corresponds to Sunday through Saturday. ;~ @YDAY Current day of year. Range is 1 to 366 (or 365 if not a leap year) #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <Misc.au3> Global $Paused global $b_Opt=true HotKeySet("^+!h","pause") HotKeySet("^+!c","config") HotKeySet("^+!p","stop") HotKeySet("^+!w","winactivatereload") HotKeySet("^+!q","getpixels") $inireadinpcheckx1=IniRead("config.inf", "pixelcheck", "checkx1", "") $inireadinpchecky1=IniRead("config.inf", "pixelcheck", "checky1", "") $inireadinpcheckcolor1=IniRead("config.inf", "pixelcheck", "checkcolor1", "") $inireadinpcheckx2=IniRead("config.inf", "pixelcheck", "checkx2", "") $inireadinpchecky2=IniRead("config.inf", "pixelcheck", "checky2", "") $inireadinpcheckcolor2=IniRead("config.inf", "pixelcheck", "checkcolor2", "") $inireadinpcheckx3=IniRead("config.inf", "pixelcheck", "checkx3", "") $inireadinpchecky3=IniRead("config.inf", "pixelcheck", "checky3", "") $inireadinpcheckcolor3=IniRead("config.inf", "pixelcheck", "checkcolor3", "") $inireadinpcheckx4=IniRead("config.inf", "pixelcheck", "checkx4", "") $inireadinpchecky4=IniRead("config.inf", "pixelcheck", "checky4", "") $inireadinpcheckcolor4=IniRead("config.inf", "pixelcheck", "checkcolor4", "") $inireadinpcheckx5=IniRead("config.inf", "pixelcheck", "checkx5", "") $inireadinpchecky5=IniRead("config.inf", "pixelcheck", "checky5", "") $inireadinpcheckcolor5=IniRead("config.inf", "pixelcheck", "checkcolor5", "") $time = @hour & ":" & @MIN ;~ MsgBox(4096, "time", $time) $pixellefttop = PixelGetColor($inireadinpcheckx1,$inireadinpchecky1) $pixelrightttop = PixelGetColor($inireadinpcheckx2,$inireadinpchecky2) $pixelleftbotom = PixelGetColor($inireadinpcheckx3,$inireadinpchecky3) $pixelrightbotom = PixelGetColor($inireadinpcheckx4,$inireadinpchecky4) $timecheckcolor = TimerInit() $6a9am = 1 $6a9amend = 0 $2a3pm = 1 $2a3pmend = 0 $5a6pm = 1 $5a6pmend = 0 $9a11pm = 1 $9a11pmend = 0 ;~ While 1 ;~ If @hour = 20 And @MIN = 06 Then ;~ MsgBox(4096, "time", $time) ;~ Send("^!s") ;~ Exit ;~ EndIf ;~ WEnd While 1 matutino() medio() tarde() noche() If (TimerDiff($timecheckcolor) > 30000 And $6a9amend = 1) Or (TimerDiff($timecheckcolor) > 30000 And $2a3pmend = 1) Or (TimerDiff($timecheckcolor) > 30000 And $5a6pmend = 1) Or (TimerDiff($timecheckcolor) > 30000 And $9a11pmend = 1) Then $pixellefttopcheck = PixelGetColor($inireadinpcheckx1,$inireadinpchecky1) $pixelrightttopcheck = PixelGetColor($inireadinpcheckx2,$inireadinpchecky2) $pixelleftbotomcheck = PixelGetColor($inireadinpcheckx3,$inireadinpchecky3) $pixelrightbotomcheck = PixelGetColor($inireadinpcheckx4,$inireadinpchecky4) $timecheckcolor = TimerInit() ;~ TrayTip("hey", $inireadinpcheckx1 & $inireadinpchecky1 & $inireadinpcheckx2 & $inireadinpchecky2 & $inireadinpcheckx3 & $inireadinpchecky3 & $inireadinpcheckx4 & $inireadinpchecky4, 2) ;~ TrayTip("before", $pixellefttopcheck & $pixelrightttopcheck & $pixelleftbotomcheck & $pixelrightbotomcheck, 2) If $pixellefttopcheck = $pixellefttop And $pixelrightttopcheck = $pixelrightttop and $pixelleftbotomcheck = $pixelleftbotom And $pixelrightbotom = $pixelrightbotomcheck Then winactivatereload() TrayTip("hoy", $pixellefttop & $pixelrightttop & $pixelleftbotom & $pixelrightbotom,2) Sleep(10000) $pixellefttop = PixelGetColor($inireadinpcheckx1,$inireadinpchecky1) $pixelrightttop = PixelGetColor($inireadinpcheckx2,$inireadinpchecky2) $pixelleftbotom = PixelGetColor($inireadinpcheckx3,$inireadinpchecky3) $pixelrightbotom = PixelGetColor($inireadinpcheckx4,$inireadinpchecky4) Else $pixellefttop = PixelGetColor($inireadinpcheckx1,$inireadinpchecky1) $pixelrightttop = PixelGetColor($inireadinpcheckx2,$inireadinpchecky2) $pixelleftbotom = PixelGetColor($inireadinpcheckx3,$inireadinpchecky3) $pixelrightbotom = PixelGetColor($inireadinpcheckx4,$inireadinpchecky4) EndIf EndIf WEnd Func matutino() If $6a9am = 1 Then If @hour >= 6 And @hour < 9 And @MIN >= 00 Then If ProcessExists("FlashBack Recorder.exe") Then Send("^!s") TrayTip("hey", "record started", 2) Else Run("C:\Archivos de programa\Blueberry Software\BB FlashBack Pro 3\FlashBack Recorder.exe") WinWaitActive("BB FlashBack Pro 3 Recorder") Sleep(3000) Send("^!s") TrayTip("hey", "record started", 2) EndIf $6a9am = 0 $6a9amend = 1 EndIf EndIf If $6a9amend = 1 Then If @hour >= 9 And @MIN >= 5 Then ;~ If ProcessExists("FlashBack Recorder.exe") Then Send("^+s") TrayTip("hey", "record stopped", 2) ;~ EndIf $6a9am = 1 $6a9amend = 0 EndIf EndIf EndFunc Func medio() If $2a3pm = 1 Then If @hour >= 14 And @hour < 15 And @MIN >= 00 Then If ProcessExists("FlashBack Recorder.exe") Then Send("^!s") TrayTip("hey", "record started", 2) Else Run("C:\Archivos de programa\Blueberry Software\BB FlashBack Pro 3\FlashBack Recorder.exe") WinWaitActive("BB FlashBack Pro 3 Recorder") Sleep(3000) Send("^!s") TrayTip("hey", "record started", 2) EndIf $2a3pm = 0 $2a3pmend = 1 EndIf EndIf If $2a3pmend = 1 Then If @hour >= 15 And @MIN >= 5 Then ;~ If ProcessExists("FlashBack Recorder.exe") Then Send("^+s") TrayTip("hey", "record stopped", 2) ;~ EndIf $2a3pm = 1 $2a3pmend = 0 EndIf EndIf EndFunc Func tarde() If $5a6pm = 1 Then If @hour >= 17 And @hour < 18 And @MIN >= 00 Then If ProcessExists("FlashBack Recorder.exe") Then Send("^!s") TrayTip("hey", "record started", 2) Else Run("C:\Archivos de programa\Blueberry Software\BB FlashBack Pro 3\FlashBack Recorder.exe") WinWaitActive("BB FlashBack Pro 3 Recorder") Sleep(3000) Send("^!s") TrayTip("hey", "record started", 2) EndIf $5a6pm = 0 $5a6pmend = 1 EndIf EndIf If $5a6pmend = 1 Then If @hour >= 18 And @MIN >= 5 Then ;~ If ProcessExists("FlashBack Recorder.exe") Then Send("^+s") TrayTip("hey", "record stopped", 2) ;~ EndIf $5a6pm = 1 $5a6pmend = 0 EndIf EndIf EndFunc Func noche() If $9a11pm = 1 Then If @hour >= 23 And @hour < 24 And @MIN >= 0 Then ;~ If @hour >= 1 And @hour < 3 And @MIN >= 01 Then If ProcessExists("FlashBack Recorder.exe") Then Send("^!s") TrayTip("hey", "record started", 2) Else Run("C:\Archivos de programa\Blueberry Software\BB FlashBack Pro 3\FlashBack Recorder.exe") WinWaitActive("BB FlashBack Pro 3 Recorder") Sleep(3000) Send("^!s") TrayTip("hey", "record started", 2) EndIf $9a11pm = 0 $9a11pmend = 1 EndIf EndIf If $9a11pmend = 1 Then If @hour >= 24 And @MIN >= 0 Then ;~ If ProcessExists("FlashBack Recorder.exe") Then Send("^+s") TrayTip("hey", "record stopped", 2) ;~ EndIf $9a11pm = 1 $9a11pmend = 0 EndIf EndIf EndFunc Func winactivatereload() While 1 If ProcessExists("chrome.exe") Then ProcessClose("chrome.exe") Else ExitLoop EndIf WEnd run("C:\Documents and Settings\Administrador\ConfiguraciĆ³n local\Datos de programa\Google\Chrome\Application\chrome.exe") WinWaitActive("Canal 44 Live | Watch Canal 44 Online - Google Chrome") WinSetState("Canal 44 Live | Watch Canal 44 Online - Google Chrome", "", @SW_MAXIMIZE) EndFunc Func getpixels() $pixellefttop = PixelGetColor($inireadinpcheckx1,$inireadinpchecky1) $pixelrightttop = PixelGetColor($inireadinpcheckx2,$inireadinpchecky2) $pixelleftbotom = PixelGetColor($inireadinpcheckx3,$inireadinpchecky3) $pixelrightbotom = PixelGetColor($inireadinpcheckx4,$inireadinpchecky4) TrayTip("hey", "got pixels", 2) EndFunc Func config() #Region ### START Koda GUI section ### Form=C:\Users\luis\Desktop\autoit\autoit programs\trabajo\pixel checkers 1.0.kxf $Form1 = GUICreate("Form1", 281, 211, 349, 282) $btcheck1 = GUICtrlCreateButton("btcheck1", 16, 16, 59, 25) $btcheck2 = GUICtrlCreateButton("check2", 16, 48, 59, 25) $btcheck3 = GUICtrlCreateButton("check3", 16, 80, 59, 25) $btcheck4 = GUICtrlCreateButton("check4", 16, 112, 59, 25) $btcheck5 = GUICtrlCreateButton("check5", 16, 144, 59, 25) $inpcheckx1 = GUICtrlCreateInput("", 80, 16, 41, 21) $inpchecky1 = GUICtrlCreateInput("", 128, 16, 41, 21) $inpcheckx2 = GUICtrlCreateInput("", 80, 48, 41, 21) $inpchecky2 = GUICtrlCreateInput("", 128, 48, 41, 21) $inpcheckx3 = GUICtrlCreateInput("", 80, 80, 41, 21) $inpchecky3 = GUICtrlCreateInput("", 128, 80, 41, 21) $inpcheckx4 = GUICtrlCreateInput("", 80, 112, 41, 21) $inpchecky4 = GUICtrlCreateInput("", 128, 112, 41, 21) $inpcheckx5 = GUICtrlCreateInput("", 80, 144, 41, 21) $inpchecky5 = GUICtrlCreateInput("", 128, 144, 41, 21) $inpcheckcolor1 = GUICtrlCreateInput("", 176, 16, 65, 21) $inpcheckcolor2 = GUICtrlCreateInput("", 176, 48, 65, 21) $inpcheckcolor3 = GUICtrlCreateInput("", 176, 80, 65, 21) $inpcheckcolor4 = GUICtrlCreateInput("", 176, 112, 65, 21) $inpcheckcolor5 = GUICtrlCreateInput("", 176, 144, 65, 21) $btguardar = GUICtrlCreateButton("Guardar", 16, 176, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $inireadinpcheckx1=IniRead("config.inf", "pixelcheck", "checkx1", "") $inireadinpchecky1=IniRead("config.inf", "pixelcheck", "checky1", "") $inireadinpcheckcolor1=IniRead("config.inf", "pixelcheck", "checkcolor1", "") $inireadinpcheckx2=IniRead("config.inf", "pixelcheck", "checkx2", "") $inireadinpchecky2=IniRead("config.inf", "pixelcheck", "checky2", "") $inireadinpcheckcolor2=IniRead("config.inf", "pixelcheck", "checkcolor2", "") $inireadinpcheckx3=IniRead("config.inf", "pixelcheck", "checkx3", "") $inireadinpchecky3=IniRead("config.inf", "pixelcheck", "checky3", "") $inireadinpcheckcolor3=IniRead("config.inf", "pixelcheck", "checkcolor3", "") $inireadinpcheckx4=IniRead("config.inf", "pixelcheck", "checkx4", "") $inireadinpchecky4=IniRead("config.inf", "pixelcheck", "checky4", "") $inireadinpcheckcolor4=IniRead("config.inf", "pixelcheck", "checkcolor4", "") $inireadinpcheckx5=IniRead("config.inf", "pixelcheck", "checkx5", "") $inireadinpchecky5=IniRead("config.inf", "pixelcheck", "checky5", "") $inireadinpcheckcolor5=IniRead("config.inf", "pixelcheck", "checkcolor5", "") GUICtrlSetData($inpcheckx1, $inireadinpcheckx1) GUICtrlSetData($inpchecky1, $inireadinpchecky1) GUICtrlSetData($inpcheckcolor1, $inireadinpcheckcolor1) GUICtrlSetData($inpcheckx2, $inireadinpcheckx2) GUICtrlSetData($inpchecky2, $inireadinpchecky2) GUICtrlSetData($inpcheckcolor2, $inireadinpcheckcolor2) GUICtrlSetData($inpcheckx3, $inireadinpcheckx3) GUICtrlSetData($inpchecky3, $inireadinpchecky3) GUICtrlSetData($inpcheckcolor3, $inireadinpcheckcolor3) GUICtrlSetData($inpcheckx4, $inireadinpcheckx4) GUICtrlSetData($inpchecky4, $inireadinpchecky4) GUICtrlSetData($inpcheckcolor4, $inireadinpcheckcolor4) GUICtrlSetData($inpcheckx5, $inireadinpcheckx5) GUICtrlSetData($inpchecky5, $inireadinpchecky5) GUICtrlSetData($inpcheckcolor5, $inireadinpcheckcolor5) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() case $btcheck1 ;control key 11 While 1 If _IsPressed("11") Then $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) GUICtrlSetData($inpcheckx1, $pos[0]) GUICtrlSetData($inpchecky1, $pos[1]) GUICtrlSetData($inpcheckcolor1, Hex($var, 6)) ExitLoop EndIf ;shift If _IsPressed("10") Then ExitLoop EndIf Sleep(100) WEnd case $btcheck2 ;control key 11 While 1 If _IsPressed("11") Then $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) GUICtrlSetData($inpcheckx2, $pos[0]) GUICtrlSetData($inpchecky2, $pos[1]) GUICtrlSetData($inpcheckcolor2, Hex($var, 6)) ExitLoop EndIf ;shift If _IsPressed("10") Then ExitLoop EndIf Sleep(100) WEnd case $btcheck3 ;control key 11 While 1 If _IsPressed("11") Then $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) GUICtrlSetData($inpcheckx3, $pos[0]) GUICtrlSetData($inpchecky3, $pos[1]) GUICtrlSetData($inpcheckcolor3, Hex($var, 6)) ExitLoop EndIf ;shift If _IsPressed("10") Then ExitLoop EndIf Sleep(100) WEnd case $btcheck4 ;control key 11 While 1 If _IsPressed("11") Then $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) GUICtrlSetData($inpcheckx4, $pos[0]) GUICtrlSetData($inpchecky4, $pos[1]) GUICtrlSetData($inpcheckcolor4, Hex($var, 6)) ExitLoop EndIf ;shift If _IsPressed("10") Then ExitLoop EndIf Sleep(100) WEnd case $btcheck5 ;control key 11 While 1 If _IsPressed("11") Then $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) GUICtrlSetData($inpcheckx5, $pos[0]) GUICtrlSetData($inpchecky5, $pos[1]) GUICtrlSetData($inpcheckcolor5, Hex($var, 6)) ExitLoop EndIf ;shift If _IsPressed("10") Then ExitLoop EndIf Sleep(100) WEnd Case $btguardar IniWrite("config.inf", "pixelcheck", "checkx1", GUICtrlRead($inpcheckx1)) IniWrite("config.inf", "pixelcheck", "checky1", GUICtrlRead($inpchecky1)) IniWrite("config.inf", "pixelcheck", "checkcolor1", GUICtrlRead($inpcheckcolor1)) IniWrite("config.inf", "pixelcheck", "checkx2", GUICtrlRead($inpcheckx2)) IniWrite("config.inf", "pixelcheck", "checky2", GUICtrlRead($inpchecky2)) IniWrite("config.inf", "pixelcheck", "checkcolor2", GUICtrlRead($inpcheckcolor2)) IniWrite("config.inf", "pixelcheck", "checkx3", GUICtrlRead($inpcheckx3)) IniWrite("config.inf", "pixelcheck", "checky3", GUICtrlRead($inpchecky3)) IniWrite("config.inf", "pixelcheck", "checkcolor3", GUICtrlRead($inpcheckcolor3)) IniWrite("config.inf", "pixelcheck", "checkx4", GUICtrlRead($inpcheckx4)) IniWrite("config.inf", "pixelcheck", "checky4", GUICtrlRead($inpchecky4)) IniWrite("config.inf", "pixelcheck", "checkcolor4", GUICtrlRead($inpcheckcolor4)) IniWrite("config.inf", "pixelcheck", "checkx5", GUICtrlRead($inpcheckx5)) IniWrite("config.inf", "pixelcheck", "checky5", GUICtrlRead($inpchecky5)) IniWrite("config.inf", "pixelcheck", "checkcolor5", GUICtrlRead($inpcheckcolor5)) EndSwitch WEnd EndFunc Func Pause() $Paused = NOT $Paused If $Paused = "False" then TrayTip("",'"Script is "Paused"', 3) While $Paused sleep(100) WEnd Else TrayTip("",'"Script is "Running"', 3) EndIf Sleep(1000) EndFunc Func stop() Opt("TrayIconHide",0) TrayTip("",'"stopped"', 3) Sleep(1000) Exit EndFunc 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