Sign in to follow this  
Followers 0
tsue

problems running the script

2 posts in this topic

hello, i have a problem when i set the 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)

here is the full code in case im missing something

;~ @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", "")[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]$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[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif];~ While 1
;~  If @hour = 20 And @MIN = 06 Then
;~   MsgBox(4096, "time", $time)
;~   Send("^!s")
;~   Exit
;~  EndIf
;~ WEnd[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]While 1
matutino()
medio()
tarde()
noche()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]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)[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]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[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]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 ###[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]$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)[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]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))[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]  EndSwitch
WEnd
EndFunc[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]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[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]Func stop()
   Opt("TrayIconHide",0)
    TrayTip("",'"stopped"', 3)
    Sleep(1000)
    Exit
EndFunc

Share this post


Link to post
Share on other sites



tsue,

You already have a thread running on this very same question - how about sticking to just the one at a time. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0