1
Post New Requests Here / 🤔 PixelNotifier alert when color is different, not same as it operates now?
« on: February 27, 2019, 06:38 PM »
"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/
script is by: skrommel, PixelNotifier, www.dcmembers.com/skrommel/download/pixelnotifier/
Code: Text [Select]
- #SingleInstance,Force
- SysGet,workarea,MonitorWorkArea
- applicationname=PixelNotifier
- Gosub,READINI
- Gosub,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=9
- Goto,TRIGGERED
- TRIGGERED_8:
- triggered=8
- Goto,TRIGGERED
- TRIGGERED_7:
- triggered=7
- Goto,TRIGGERED
- TRIGGERED_6:
- triggered=6
- Goto,TRIGGERED
- TRIGGERED_5:
- triggered=5
- Goto,TRIGGERED
- TRIGGERED_4:
- triggered=4
- Goto,TRIGGERED
- TRIGGERED_3:
- triggered=3
- Goto,TRIGGERED
- TRIGGERED_2:
- triggered=2
- Goto,TRIGGERED
- TRIGGERED_1:
- triggered=1
- Goto,TRIGGERED
- TRIGGERED:
- sound:=alarms_%triggered%_7
- SoundPlay,%sound%
- ;WinSet,Top,,%applicationname% %triggered%
- WinActivate,%applicationname% %triggered%
- Return
- OK_9:
- ok=9
- Goto,BUTTON
- OK_8:
- ok=8
- Goto,BUTTON
- OK_7:
- ok=7
- Goto,BUTTON
- OK_6:
- ok=6
- Goto,BUTTON
- OK_5:
- ok=5
- Goto,BUTTON
- OK_4:
- ok=4
- Goto,BUTTON
- OK_3:
- ok=3
- Goto,BUTTON
- OK_2:
- ok=2
- Goto,BUTTON
- OK_1:
- ok=1
- Goto,BUTTON
- BUTTON:
- SetTimer,TRIGGERED_%ok%,Off
- Gui,%ok%:Destroy
- active_%ok%=0
- Gosub,TRAYMENU
- Return
- TOGGLE_9:
- TOGGLE_8:
- TOGGLE_7:
- TOGGLE_6:
- TOGGLE_5:
- TOGGLE_4:
- TOGGLE_3:
- TOGGLE_2:
- TOGGLE_1:
- menu:=A_ThisMenuItemPos-2
- If active_%menu%=0
- {
- active_%menu%=1
- triggered_%menu%=0
- Gosub,TRAYMENU
- }
- Else
- {
- Gosub,OK_%menu%
- }
- Return
- ADD:
- Gosub,DEACTIVATEALL
- Loop
- {
- 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,DEACTIVATEALL
- Gosub,READINI
- Run,%applicationname%.ini
- Return
- READINI:
- IfNotExist,%applicationname%.ini
- {
- ini=`;%applicationname%.ini
- ini=%ini%`n`;
- ini=%ini%`n`;Syntax:
- ini=%ini%`n`;
- ini=%ini%`n`;x,y,pixelcolor,relative,message,fullscreencolor,sound
- ini=%ini%`n`;
- ini=%ini%`n`; x Horizontal positon of the pixel to watch
- ini=%ini%`n`; y vertical positon of the pixel to watch
- ini=%ini%`n`; pixelcolor=000000-FFFFFF RGB-color of the pixel to watch
- ini=%ini%`n`; relative=1,2 Find pixel relative to 1=the screen or 2=the active window
- ini=%ini%`n`; message The message to display
- ini=%ini%`n`; fullscreencolor=000000-FFFFFF Color of the fullscreen notification
- ini=%ini%`n`; sound Path to the WAV-file
- ini=%ini%`n`;
- ini=%ini%`n`;Example:
- ini=%ini%`n`;
- ini=%ini%`n`;0,0,FFFFFF,White color detected!,0,0000FF,C:\Windows\Media\Ding.wav
- ini=%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%`n
- ini=%ini%`n200,200,FFFFFF,1,White color detected!,0000FF,C:\Windows\Media\Ding.wav
- ini=%ini%`n400,400,FFFFFF,1,White color detected!,FF0000,C:\Windows\Media\Ding.wav
- FileAppend,%ini%,%applicationname%.ini
- ini=
- }
- alarmscount=0
- Loop,Read,%applicationname%.ini
- {
- IfInString,A_LoopReadLine,`;
- Continue
- IfNotInString,A_LoopReadLine,`,
- Continue
- alarmscount+=1
- StringSplit,alarms_%alarmscount%_,A_LoopReadLine,`,
- }
- Return
- ...
- ...
- ...
- ...