ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

🤔 PixelNotifier alert when color is different, not same as it operates now?

(1/1)

mydo:
"Would it be possible to change PixelNotifier such that an alert is triggered when the monitored pixel changes FROM it's current color value as opposed to when it changes TO a user defined, (anticipated), color value?"

script is by: skrommel, PixelNotifier,  www.dcmembers.com/skrommel/download/pixelnotifier/



--- Code: Text ---#SingleInstance,Force SysGet,workarea,MonitorWorkArea  applicationname=PixelNotifier Gosub,READINIGosub,ACTIVATEALL LOOP:Loop,%alarmscount%{  Sleep,500  If active_%A_Index%=0    Continue  If triggered_%A_Index%=1    Continue  x:=alarms_%A_Index%_1  y:=alarms_%A_Index%_2  pixelcolor:=alarms_%A_Index%_3  relative:=alarms_%A_Index%_4  If relative=1    CoordMode,Pixel,Screen  Else    CoordMode,Pixel,Relative  PixelGetColor,readpixelcolor,x,y,RGB  StringTrimLeft,readpixelcolor,readpixelcolor,2  If readpixelcolor<>%pixelcolor%    Continue  triggered_%A_Index%=1  message:=alarms_%A_Index%_5  fullscreencolor:=alarms_%A_Index%_6  Gui,%A_Index%:+Owner -Resize -SysMenu -MinimizeBox -MaximizeBox -Disabled +Caption +Border -ToolWindow  Gui,%A_Index%:Color,%fullscreencolor%  Gui,%A_Index%:Add,Button,X320 Y240 Default GOK_%A_Index%,%message%  Gui,%A_Index%:Show,X-4 Y-4 W%workareaRight% H%workareaBottom%,%applicationname% %A_Index%  SetTimer,TRIGGERED_%A_Index%,5000  Gosub,TRIGGERED_%A_Index%    }Goto,LOOP  TRIGGERED_9:triggered=9Goto,TRIGGEREDTRIGGERED_8:triggered=8Goto,TRIGGEREDTRIGGERED_7:triggered=7Goto,TRIGGEREDTRIGGERED_6:triggered=6Goto,TRIGGEREDTRIGGERED_5:triggered=5Goto,TRIGGEREDTRIGGERED_4:triggered=4Goto,TRIGGEREDTRIGGERED_3:triggered=3Goto,TRIGGEREDTRIGGERED_2:triggered=2Goto,TRIGGEREDTRIGGERED_1:triggered=1Goto,TRIGGEREDTRIGGERED:sound:=alarms_%triggered%_7SoundPlay,%sound%;WinSet,Top,,%applicationname% %triggered%WinActivate,%applicationname% %triggered%Return  OK_9:ok=9Goto,BUTTONOK_8:ok=8Goto,BUTTONOK_7:ok=7Goto,BUTTONOK_6:ok=6Goto,BUTTONOK_5:ok=5Goto,BUTTONOK_4:ok=4Goto,BUTTONOK_3:ok=3Goto,BUTTONOK_2:ok=2Goto,BUTTONOK_1:ok=1Goto,BUTTONBUTTON:SetTimer,TRIGGERED_%ok%,OffGui,%ok%:Destroyactive_%ok%=0Gosub,TRAYMENUReturn  TOGGLE_9:TOGGLE_8:TOGGLE_7:TOGGLE_6:TOGGLE_5:TOGGLE_4:TOGGLE_3:TOGGLE_2:TOGGLE_1:menu:=A_ThisMenuItemPos-2If active_%menu%=0{  active_%menu%=1  triggered_%menu%=0  Gosub,TRAYMENU}Else{  Gosub,OK_%menu%}Return  ADD:Gosub,DEACTIVATEALLLoop{  CoordMode,Pixel,Screen  CoordMode,Mouse,Screen  MouseGetPos,sx,sy  PixelGetColor,readpixelcolor,sx,sy,RGB  StringTrimLeft,readpixelcolor,readpixelcolor,2  CoordMode,Mouse,Relative  MouseGetPos,x,y  ToolTip,Color:`t%readpixelcolor%`nScreenCoord:`t%sx% %sy%`nWindowCoord:`t%x% %y%`n`nPress`tto add`n1=`tScreenCoord`n2=`tWindowCoord`nEsc=Cancel  GetKeyState,screen,1,P  If screen=D  {    FileAppend,`n%sx%`,%sy%`,%readpixelcolor%`,1`,Message`,FFFFFF`,C:\Windows\Ding.wav,%applicationname%.ini    ToolTip,    Gosub,SETTINGS    Break     }  GetKeyState,window,2,P  If window=D  {    FileAppend,`n%x%`,%y%`,%readpixelcolor%`,2`,Message`,FFFFFF`,C:\Windows\Ding.wav,%applicationname%.ini    ToolTip,    Gosub,SETTINGS    Break     }  GetKeyState,esc,Esc,P  If esc=D  {    ToolTip,    Break  }}Return  SETTINGS:Gosub,DEACTIVATEALLGosub,READINIRun,%applicationname%.iniReturn  READINI:IfNotExist,%applicationname%.ini{ini=`;%applicationname%.iniini=%ini%`n`;ini=%ini%`n`;Syntax:ini=%ini%`n`;ini=%ini%`n`;x,y,pixelcolor,relative,message,fullscreencolor,soundini=%ini%`n`;ini=%ini%`n`; x                               Horizontal positon of the pixel to watchini=%ini%`n`; y                               vertical positon of the pixel to watchini=%ini%`n`; pixelcolor=000000-FFFFFF        RGB-color of the pixel to watchini=%ini%`n`; relative=1,2                    Find pixel relative to 1=the screen or 2=the active windowini=%ini%`n`; message                         The message to displayini=%ini%`n`; fullscreencolor=000000-FFFFFF   Color of the fullscreen notificationini=%ini%`n`; sound                           Path to the WAV-fileini=%ini%`n`;ini=%ini%`n`;Example:ini=%ini%`n`;ini=%ini%`n`;0,0,FFFFFF,White color detected!,0,0000FF,C:\Windows\Media\Ding.wavini=%ini%`n`;  Watches the screenposition 0,0 for the color white and plays a sound and ini=%ini%`n`;  displays a blue message window with the text White color detected!ini=%ini%`nini=%ini%`n200,200,FFFFFF,1,White color detected!,0000FF,C:\Windows\Media\Ding.wavini=%ini%`n400,400,FFFFFF,1,White color detected!,FF0000,C:\Windows\Media\Ding.wavFileAppend,%ini%,%applicationname%.iniini=}alarmscount=0Loop,Read,%applicationname%.ini{  IfInString,A_LoopReadLine,`;    Continue  IfNotInString,A_LoopReadLine,`,    Continue  alarmscount+=1  StringSplit,alarms_%alarmscount%_,A_LoopReadLine,`,}Return............

Ath:
I've modified the original download from the Skrommel site to support your request, and also updated the documentation in the ini file (source and sample ini in the attached zip file)
No compiled exe is provided, so you'll have to have AutoHotKey installed on your computer.

Modification: The pixelcolor can now optionally be prefixed with an exclamation mark, like !FFFFFF, so the pixel is watched for being not-equal to that color. The message should probably be adjusted accordingly.

NB: There is no support for setting this option from using the Add alarm... option from the context menu, but it can easily be set as the ini file is opened after adding an alarm.


--- Code: Autohotkey ---;PixelNotifier.ahk; Watches a screen pixel for a specific color, and notifies the user when it occurs. ;Skrommel @2005; 2019-03-02 Ath: Added inverted check by prefixing the pixelcolor with ! #SingleInstance,Force SysGet,workarea,MonitorWorkArea  applicationname=PixelNotifier Gosub,READINIGosub,ACTIVATEALL LOOP:Loop,%alarmscount%{  Sleep,500  If active_%A_Index%=0    Continue  If triggered_%A_Index%=1    Continue  x:=alarms_%A_Index%_1  y:=alarms_%A_Index%_2  pixelcolor:=alarms_%A_Index%_3  StringLeft,invert,pixelcolor,1  If invert = !  {        checkInvert=1        StringTrimLeft,pixelcolor,pixelcolor,1  }  relative:=alarms_%A_Index%_4  If relative=1    CoordMode,Pixel,Screen  Else    CoordMode,Pixel,Relative  PixelGetColor,readpixelcolor,x,y,RGB  StringTrimLeft,readpixelcolor,readpixelcolor,2  If checkInvert = 1  {        If readpixelcolor=%pixelcolor%          Continue  }  else  {        If readpixelcolor<>%pixelcolor%          Continue  }  triggered_%A_Index%=1  message:=alarms_%A_Index%_5  fullscreencolor:=alarms_%A_Index%_6  Gui,%A_Index%:+Owner -Resize -SysMenu -MinimizeBox -MaximizeBox -Disabled +Caption +Border -ToolWindow  Gui,%A_Index%:Color,%fullscreencolor%  Gui,%A_Index%:Add,Button,X320 Y240 Default GOK_%A_Index%,%message%  Gui,%A_Index%:Show,X-4 Y-4 W%workareaRight% H%workareaBottom%,%applicationname% %A_Index%  SetTimer,TRIGGERED_%A_Index%,5000  Gosub,TRIGGERED_%A_Index%    }Goto,LOOP  TRIGGERED_9:triggered=9Goto,TRIGGEREDTRIGGERED_8:triggered=8Goto,TRIGGEREDTRIGGERED_7:triggered=7Goto,TRIGGEREDTRIGGERED_6:triggered=6Goto,TRIGGEREDTRIGGERED_5:triggered=5Goto,TRIGGEREDTRIGGERED_4:triggered=4Goto,TRIGGEREDTRIGGERED_3:triggered=3Goto,TRIGGEREDTRIGGERED_2:triggered=2Goto,TRIGGEREDTRIGGERED_1:triggered=1Goto,TRIGGEREDTRIGGERED:sound:=alarms_%triggered%_7SoundPlay,%sound%;WinSet,Top,,%applicationname% %triggered%WinActivate,%applicationname% %triggered%Return  OK_9:ok=9Goto,BUTTONOK_8:ok=8Goto,BUTTONOK_7:ok=7Goto,BUTTONOK_6:ok=6Goto,BUTTONOK_5:ok=5Goto,BUTTONOK_4:ok=4Goto,BUTTONOK_3:ok=3Goto,BUTTONOK_2:ok=2Goto,BUTTONOK_1:ok=1Goto,BUTTONBUTTON:SetTimer,TRIGGERED_%ok%,OffGui,%ok%:Destroyactive_%ok%=0Gosub,TRAYMENUReturn  TOGGLE_9:TOGGLE_8:TOGGLE_7:TOGGLE_6:TOGGLE_5:TOGGLE_4:TOGGLE_3:TOGGLE_2:TOGGLE_1:menu:=A_ThisMenuItemPos-2If active_%menu%=0{  active_%menu%=1  triggered_%menu%=0  Gosub,TRAYMENU}Else{  Gosub,OK_%menu%}Return  ADD:Gosub,DEACTIVATEALLLoop{  CoordMode,Pixel,Screen  CoordMode,Mouse,Screen  MouseGetPos,sx,sy  PixelGetColor,readpixelcolor,sx,sy,RGB  StringTrimLeft,readpixelcolor,readpixelcolor,2  CoordMode,Mouse,Relative  MouseGetPos,x,y  ToolTip,Color:`t%readpixelcolor%`nScreenCoord:`t%sx% %sy%`nWindowCoord:`t%x% %y%`n`nPress`tto add`n1=`tScreenCoord`n2=`tWindowCoord`nEsc=Cancel  GetKeyState,screen,1,P  If screen=D  {    FileAppend,`n%sx%`,%sy%`,%readpixelcolor%`,1`,Message`,FFFFFF`,C:\Windows\Ding.wav,%applicationname%.ini    ToolTip,    Gosub,SETTINGS    Break     }  GetKeyState,window,2,P  If window=D  {    FileAppend,`n%x%`,%y%`,%readpixelcolor%`,2`,Message`,FFFFFF`,C:\Windows\Ding.wav,%applicationname%.ini    ToolTip,    Gosub,SETTINGS    Break     }  GetKeyState,esc,Esc,P  If esc=D  {    ToolTip,    Break  }}Return  SETTINGS:Gosub,DEACTIVATEALLGosub,READINIRun,%applicationname%.iniReturn  READINI:IfNotExist,%applicationname%.ini{ini=`;%applicationname%.iniini=%ini%`n`;ini=%ini%`n`;Syntax:ini=%ini%`n`;ini=%ini%`n`;x,y,pixelcolor,relative,message,fullscreencolor,soundini=%ini%`n`;ini=%ini%`n`; x                               Horizontal positon of the pixel to watchini=%ini%`n`; y                               vertical positon of the pixel to watchini=%ini%`n`; pixelcolor=[!]000000-FFFFFF     RGB-color of the pixel to watchini=%ini%`n`;                                 If the RGB color is optionally prefixed with an exclamation mark,ini=%ini%`n`;                                 like !FFFFFF, the pixel is watched for being not-equal to that colorini=%ini%`n`; relative=1,2                    Find pixel relative to 1=the screen or 2=the active windowini=%ini%`n`; message                         The message to displayini=%ini%`n`; fullscreencolor=000000-FFFFFF   Color of the fullscreen notificationini=%ini%`n`; sound                           Path to the WAV-fileini=%ini%`n`;ini=%ini%`n`;Example:ini=%ini%`n`;ini=%ini%`n`;0,0,FFFFFF,White color detected!,0,0000FF,C:\Windows\Media\Ding.wavini=%ini%`n`;  Watches the screenposition 0,0 for the color white and plays a sound and ini=%ini%`n`;  displays a blue message window with the text White color detected!ini=%ini%`nini=%ini%`n200,200,FFFFFF,1,White color detected!,0000FF,C:\Windows\Media\Ding.wavini=%ini%`n400,400,FFFFFF,1,White color detected!,FF0000,C:\Windows\Media\Ding.wavFileAppend,%ini%,%applicationname%.iniini=}alarmscount=0Loop,Read,%applicationname%.ini{  IfInString,A_LoopReadLine,`;    Continue  IfNotInString,A_LoopReadLine,`,    Continue  alarmscount+=1  StringSplit,alarms_%alarmscount%_,A_LoopReadLine,`,}Return  TRAYMENU:Menu,Tray,NoStandard Menu,Tray,DeleteAll Menu,Tray,Add,%applicationname%,TOGGLEMenu,Tray,Add,Loop,%alarmscount%{  message:=alarms_%A_Index%_5  Menu,Tray,Add,&%A_Index%:%message%,TOGGLE_%A_Index%  If active_%A_Index%=1    Menu,Tray,Check,&%A_Index%:%message%}Menu,Tray,Add,Menu,Tray,Add,&Enable All,ACTIVATEALLMenu,Tray,Add,&Disable All,DEACTIVATEALLMenu,Tray,Add,Menu,Tray,Add,&Add alarm...,AddMenu,Tray,Add,&Edit alarms...,SETTINGSMenu,Tray,Add,Menu,Tray,Add,&About...,ABOUTMenu,Tray,Add,E&xit,EXITMenu,Tray,Default,%applicationname%Menu,Tray,Tip,%applicationname%Return   TOGGLE:Pause,ToggleReturn  ACTIVATEALL:Loop,%alarmscount%{  active_%A_Index%=1  triggered_%A_Index%=0  Gosub,TRAYMENU}Return  DEACTIVATEALL:Loop,%alarmscount%{  SetTimer,TRIGGERED_%A_Index%,Off  Gui,%A_Index%:Destroy  active_%A_Index%=0  triggered_%A_Index%=0  Gosub,TRAYMENU}Return  ABOUT:Gui,99:DestroyGui,99:Margin,20,20Gui,99:Add,Picture,xm Icon1,%applicationname%.exeGui,99:Font,BoldGui,99:Add,Text,x+10 yp+10,%applicationname% v1.0Gui,99:FontGui,99:Add,Text,y+10,Watches a screen pixel for a specific color, and notifies the user when it occurs.Gui,99:Add,Text,y+5,- Change settings using Settings in the tray menuGui,99:Add,Text,y+5,- Shows a message, plays a sound and fills the whole screen with color Gui,99:Add,Picture,xm y+20 Icon5,%applicationname%.exeGui,99:Font,BoldGui,99:Add,Text,x+10 yp+10,1 Hour Software by SkrommelGui,99:FontGui,99:Add,Text,y+10,For more tools, information and donations, please visit Gui,99:Font,CBlue UnderlineGui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.comGui,99:Font Gui,99:Add,Picture,xm y+20 Icon7,%applicationname%.exeGui,99:Font,BoldGui,99:Add,Text,x+10 yp+10,DonationCoderGui,99:FontGui,99:Add,Text,y+10,Please support the contributors atGui,99:Font,CBlue UnderlineGui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.comGui,99:Font Gui,99:Add,Picture,xm y+20 Icon6,%applicationname%.exeGui,99:Font,BoldGui,99:Add,Text,x+10 yp+10,AutoHotkeyGui,99:FontGui,99:Add,Text,y+10,This tool was made using the powerfulGui,99:Font,CBlue UnderlineGui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.comGui,99:Font Gui,99:Show,,%applicationname% AbouthCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HANDOnMessage(0x200,"WM_MOUSEMOVE") Return 1HOURSOFTWARE:  Run,http://www.1hoursoftware.com,,UseErrorLevelReturn DONATIONCODER:  Run,http://www.donationcoder.com,,UseErrorLevelReturn AUTOHOTKEY:  Run,http://www.autohotkey.com,,UseErrorLevelReturn 99GuiClose:  Gui,99:Destroy  OnMessage(0x200,"")  DllCall("DestroyCursor","Uint",hCur)Return WM_MOUSEMOVE(wParam,lParam){  Global hCurs  MouseGetPos,,,,ctrl  If ctrl in Static9,Static13,Static17    DllCall("SetCursor","UInt",hCurs)  Return}Return  EXIT:ExitApp

mydo:
This is awesome, thanks so much. 

I feel like this script will be a lot more useful now to a lot of people.  I personally use it for detecting changes in a software which does not have support for notifications.  I have it set up to send me an email anything the color is NOT detected in a pixel 😊

Navigation

[0] Message Index

Go to full version