spudw2k Posted August 8, 2008 Share Posted August 8, 2008 (edited) Here a junker script I threw together to flash colors on the screen to fix dead or stuck pixels. edit: Optimized with Arrays expandcollapse popupGlobal $varColors[3] Global $varBlendRates[3] Global $varBlendDirections[3] Global $varColor $varBlendMode = 0 $gui = GUICreate("PixelFixer",120,140,-1,-1,262144) $mnu = GUICtrlCreateMenu("&File") $mode = GUICtrlCreateMenu("&Mode",$mnu) $blendmode = GUICtrlCreateMenuItem("&Blend",$mode,0,1) GUICtrlSetState(-1,1) $randmode = GUICtrlCreateMenuItem("R&andom",$mode,1,1) $speed = GUICtrlCreateMenu("&Rate",$mnu) $fast = GUICtrlCreateMenuItem("&Fast",$speed,0,1) GUICtrlSetState(-1,1) $slow = GUICtrlCreateMenuItem("&Slow",$speed,1,1) GUISetState() $timer = TimerInit() HotKeySet("{esc}","ExitAll") While 1 $msg = GUIGetMsg() If $msg = $randmode Then $varBlendMode = 0 If $msg = -3 Then ExitAll() PaintWin() WEnd Exit Func PaintWin() If GuiCtrlRead($slow) = 65 Then $varSpeed = 500 Else $varSpeed = 50 EndIf If GuiCtrlRead($randmode) = 65 Then PaintRand() $varColor = "0x" For $i = 0 to 2 $varColor &= $varColors[$i] Next Else PaintBlend() $varColor = "0x" For $i = 0 to 2 $varColor &= Hex($varColors[$i],2) Next EndIf GUISetBkColor($varColor) sleep($varSpeed) EndFunc Func PaintRand() For $i = 0 to 2 $varColors[$i] = Hex(Random(0,255,1),2) Next EndFunc Func PaintBlend() If TimerDiff($timer) > 5000 Then $timer = TimerInit() BlendRates() EndIf If $varBlendMode = 0 Then PaintRand() BlendRates() $varBlendMode = 1 EndIf For $i = 0 to 2 BlendColors($varColors[$i],$varBlendRates[$i],$varBlendDirections[$i]) Next EndFunc Func BlendRates() For $i = 0 to 2 $varBlendDirections[$i] = Random(0,1,1) $varBlendRates[$i] = Random(10,20,1) Next EndFunc Func BlendColors(byref $varThisColor,$varBlendRate,byref $varBlendDir) If $varBlendDir = 1 Then $varThisColor += $varBlendRate Else $varThisColor -= $varBlendRate EndIf If $varThisColor > 255 Then $varThisColor -= $varBlendRate $varBlendDir = 0 EndIf If $varThisColor < 0 Then $varThisColor += $varBlendRate $varBlendDir = 1 EndIf EndFunc Func ExitAll() Exit EndFunc Edited August 8, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
billthecreator Posted August 8, 2008 Share Posted August 8, 2008 thats sweet... [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
spudw2k Posted August 8, 2008 Author Share Posted August 8, 2008 (edited) Made another change to change blend rates every 5 seconds so it's not the same blend pattern. I'm surprised how little CPU is used for the bakground color change of the GUI. Edited August 8, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
spudw2k Posted September 29, 2008 Author Share Posted September 29, 2008 (edited) Just a fun clock I made based on the code above. expandcollapse popup#NoTrayIcon Global $varColors[3] Global $varBlendRates[3] Global $varBlendDirections[3] Global $varColor Global $timer Global $hover = -1 Global $alpha = 220 Global $active = 1 $varSpeed = 60 $blendtimer = TimerInit() $updatetimer = TimerInit() $timer = TimerInit() $dll = DllOpen("user32.dll") HotKeySet("{esc}","_Exit") $gui = GUICreate("ColorfulClock",200,70,0,0,0x80880000,-1,WinGetHandle("Program Manager")) $time = GUICtrlCreateLabel(@HOUR & ":" & @MIN & ":" & @SEC,0,0,200,70,513) GUISetOnEvent(-1,"_DragWin") GUICtrlSetFont(-1,34) PaintRand() BlendRates() WinSetTrans("ColorfulClock","",$alpha) WinSetOnTop("ColorfulClock","",1) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case -3 ExitLoop EndSwitch If $hover and $active and _IsPressed(1,$dll) Then _DragWin() PaintWin() If TimerDiff($timer) >= 3500 Then _CheckHover() EndIf If $hover = False Then _FadeClock(-5) ElseIf $hover = True Then _FadeClock(30) EndIf WEnd Func _Exit() Exit EndFunc Func _IsPressed($sHexKey, $vDLL = 'user32.dll') Local $a_R = DllCall($vDLL, "int", "GetAsyncKeyState", "int", '0x' & $sHexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc Func _DragWin() _CheckHover() If Not $hover Then Return 0 $mousepos1 = MouseGetPos() While _IsPressed(1,$dll) $y = 0 $x = 0 $mousepos2 = MouseGetPos() $x = $mousepos2[0]-$mousepos1[0] $y = $mousepos2[1]-$mousepos1[1] $mousepos1 = MouseGetPos() If $x <> 0 or $y <> 0 Then $winpos = WinGetPos("ColorfulClock") $winx = $winpos[0] + $x If $winx < 0 then $winx = 0 If $winx > @DesktopWidth - $winpos[2] then $winx = @DesktopWidth - $winpos[2] $winy = $winpos[1] + $y If $winy < 0 then $winy = 0 If $winy > @DesktopHeight - $winpos[3] then $winy = @DesktopHeight - $winpos[3] WinMove("ColorfulClock","",$winx,$winy) EndIf PaintWin() Wend EndFunc Func PaintBlend() If TimerDiff($blendtimer) > 10000 Then $blendtimer = TimerInit() BlendRates() EndIf For $i = 0 to 2 BlendColors($varColors[$i],$varBlendRates[$i],$varBlendDirections[$i]) Next EndFunc Func PaintRand() SRandom(Random(1,200)) For $i = 0 to 2 $varColors[$i] = Hex(Random(0,255,1),2) Next EndFunc Func BlendRates() For $i = 0 to 2 $varBlendDirections[$i] = Random(0,1,1) $varBlendRates[$i] = Random(3,10,1) Next EndFunc Func BlendColors(byref $varThisColor,$varBlendRate,byref $varBlendDir) If $varBlendDir = 1 Then $varThisColor += $varBlendRate Else $varThisColor -= $varBlendRate EndIf If $varThisColor > 255 Then $varThisColor -= $varBlendRate $varBlendDir = 0 EndIf If $varThisColor < 0 Then $varThisColor += $varBlendRate $varBlendDir = 1 EndIf EndFunc Func PaintWin() If TimerDiff($updatetimer) > 999 Then $updatetimer = TimerInit() GUICtrlSetData($time,@Hour & ":" & @Min & ":" & @SEC) EndIf PaintBlend() $varColor = "" For $i = 0 to 2 $varColor &= Hex($varColors[$i],2) Next $val = Hex(Execute(Dec("FFFFFF") & "-" & Dec($varColor) )) GUICtrlSetColor($time,"0x" & $val) GUISetBkColor("0x" & $varColor) sleep($varSpeed) EndFunc Func _CheckHover() $winpos = WinGetPos("ColorfulClock") $mousepos = MouseGetPos() If ($mousepos[0] >= $winpos[0] And $mousepos[0] <= $winpos[0] + $winpos[2]) And ($mousepos[1] >= $winpos[1] And $mousepos[1] <= $winpos[1] + $winpos[3]) Then $timer = TimerInit() $hover = True $active = True Else $hover = False $active = False EndIf EndFunc Func _FadeClock($direction) $alpha += $direction If $alpha >= 201 Then $alpha = 200 EndIf If $alpha <= 49 Then $alpha = 50 EndIf WinSetTrans("ColorfulClock","",$alpha) EndFunc Edited September 29, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF 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