Maffe811 Posted July 5, 2011 Share Posted July 5, 2011 I was bored so I made this police light thing... It could probably be made with arrays for a much simpler way to add additional lightpatterns, but I dont wanna fiddle with that right now. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> ;Declaring variables Global $Gui, $Rect, $Pattern = 1 ;Declaring colors Global $DarkRed = 0xAA0000 Global $DarkBlue = 0x0000AA Global $White = 0xFFFFFF ;Main gui $Gui = GUICreate("", 500, 200, -1, -1, $WS_POPUP) $Rect = GUICtrlCreateGraphic(0, 0, 500, 200) ;Menu gui $MenuGui = GUICreate("", 100, 135, 100, 100, $WS_POPUP, "", $Gui) $Button1 = GUICtrlCreateButton("Pattern1", 10, 10, 80, 35) $Button2 = GUICtrlCreateButton("Pattern2", 10, 50, 80, 35) $Button3 = GUICtrlCreateButton("Pattern3", 10, 90, 80, 35) GUISetState(@SW_SHOW, $Gui) GUISetState(@SW_SHOW, $MenuGui) ;Color function Func _Color($Sleep, $Color) ;Any color GUICtrlSetGraphic($Rect, $GUI_GR_COLOR, $Color, $Color) GUICtrlSetGraphic($Rect, $GUI_GR_RECT, 0, 0, 500, 200) GUICtrlSetGraphic($Rect, $GUI_GR_REFRESH) Sleep($Sleep) EndFunc ;==>_Color Func _Pattern1() ;Blue _Color(100, $White) _Color(100, $DarkBlue) _Color(100, $White) _Color(100, $DarkBlue) ;Red _Color(100, $White) _Color(100, $DarkRed) _Color(100, $White) _Color(100, $DarkRed) EndFunc ;==>_Pattern1 Func _Pattern2() ;Red _Color(200, $DarkRed) _Color(20, $White) _Color(20, $DarkBlue) _Color(20, $White) _Color(20, $DarkRed) _Color(20, $White) ;Blue _Color(200, $DarkBlue) _Color(20, $White) _Color(20, $DarkRed) _Color(20, $White) _Color(20, $DarkRed) _Color(20, $White) EndFunc ;==>_Pattern2 Func _Pattern3() ;Red _Color(250, $DarkRed) _Color(100, $White) _Color(50, $DarkRed) _Color(100, $White) _Color(250, $DarkBlue) _Color(100, $White) _Color(50, $DarkBlue) _Color(100, $White) EndFunc ;==>_Pattern3 Func _GuiMsg() $Msg = GUIGetMsg() If $Msg = $GUI_EVENT_CLOSE Then Exit If $Msg = $Button1 Then $Pattern = 1 GUICtrlSetState($Button1, $GUI_DISABLE) GUICtrlSetState($Button2, $GUI_ENABLE) GUICtrlSetState($Button3, $GUI_ENABLE) EndIf If $Msg = $Button2 Then $Pattern = 2 GUICtrlSetState($Button1, $GUI_ENABLE) GUICtrlSetState($Button2, $GUI_DISABLE) GUICtrlSetState($Button3, $GUI_ENABLE) EndIf If $Msg = $Button3 Then $Pattern = 3 GUICtrlSetState($Button1, $GUI_ENABLE) GUICtrlSetState($Button2, $GUI_ENABLE) GUICtrlSetState($Button3, $GUI_DISABLE) EndIf EndFunc ;==>_GuiMsg ;Check for Gui events AdlibRegister("_GuiMsg", 40) While 1 If $Pattern = 1 Then _Pattern1() ElseIf $Pattern = 2 Then _Pattern2() ElseIf $Pattern = 3 Then _Pattern3() EndIf WEnd [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Link to comment Share on other sites More sharing options...
czardas Posted July 5, 2011 Share Posted July 5, 2011 Aargh, it makes me feel woozy. You should consider that some strobe frequencies can have unwanted side effects on a small group of people. http://www.birket.com/technical-library/144 You might want to read about it, if you haven't done so already. Make sure you avoid the dangerous fequencies. operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 Maybe as chalenge you can rip the nasty refresh effect. and also of course aboid the high frequencies. Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GDIPlus.au3> HotKeySet("{ESC}", "_exit") ;Declaring variables Global $Gui, $Rect, $sleep = 600, $Width = 500, $height = 200, $color ;Declaring colors Global $DarkRed = 0xffff5555 Global $DarkBlue = 0xff5555ff $color = $DarkRed ;Main gui $Gui = GUICreate("", $Width, $height, -1, -1, $WS_POPUP) GUISetState(@SW_SHOW, $Gui) _GDIPlus_Startup() $hBrush = _GDIPlus_BrushCreateSolid($color) $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Gui) _GDIPlus_GraphicsFillRect($hGraphics, 0, 0, $Width, $height, $hBrush) ;Mainloop While 1 _GDIPlus_BrushSetSolidColor($hBrush, $color) _GDIPlus_GraphicsFillRect($hGraphics, 0, 0, $Width, $height, $hBrush) _SetColor() Sleep($sleep) WEnd Func _SetColor() If $color = $DarkRed Then $color = $DarkBlue Else $color = $DarkRed EndIf EndFunc ;==>_SetColor Func _exit() _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit EndFunc ;==>_exit Link to comment Share on other sites More sharing options...
MvGulik Posted July 5, 2011 Share Posted July 5, 2011 ... Solved .... "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 another version.expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GDIPlus.au3> HotKeySet("{ESC}", "_exit") ;Declaring variables Global $Gui, $Rect, $sleep = 50, $Width = 500, $height = 200, $color, $a = 255, $b = 0, $GoToRed = true, $GoToBlue = False ;Declaring colors Global $DarkRed = 0xffff5555 Global $DarkBlue = 0xff5555ff $color = 0xff555555 ;Main gui $Gui = GUICreate("", $Width, $height, -1, -1, $WS_POPUP) GUISetState(@SW_SHOW, $Gui) _GDIPlus_Startup() $hBrush = _GDIPlus_BrushCreateSolid($color) $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Gui) _GDIPlus_GraphicsFillRect($hGraphics, 0, 0, $Width, $height, $hBrush) ;Mainloop While 1 _GDIPlus_GraphicsFillRect($hGraphics, 0, 0, $Width, $height, $hBrush) _SetColor() Sleep($sleep) WEnd Func _SetColor() If $a = 255 Or $b = 255 Then $GoToRed = Not $GoToRed $GoToBlue = Not $GoToBlue EndIf Select Case $GoToRed If $a + 5 >= 255 Then $GoToRed = Not $GoToRed $GoToBlue = Not $GoToBlue else $a += 5 $b -= 5 EndIf Case $GoToBlue If $b + 5 >= 255 Then $GoToRed = Not $GoToRed $GoToBlue = Not $GoToBlue Else $a -= 5 $b += 5 EndIf EndSelect _GDIPlus_BrushSetSolidColor($hBrush, "0xFF" & stringright(Hex($a),2) & "00" & StringRight(Hex($b),2)) ConsoleWrite("0xFF" & stringright(Hex($a),2) & "55" & StringRight(Hex($b),2) & @crlf) ConsoleWrite("red = " & stringright(Hex($a),2) & " and decimal = " & $a & @crlf) ConsoleWrite("Blue = " & stringright(Hex($b),2) & " and decimal = " & $b & @crlf) ConsoleWrite("&GoToRed = "&$GoToRed & @crlf) ConsoleWrite("$GoToBlue = "&$GoToBlue & @crlf) EndFunc ;==>_SetColor Func _exit() _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit EndFunc ;==>_exit Link to comment Share on other sites More sharing options...
Maffe811 Posted July 5, 2011 Author Share Posted July 5, 2011 Crap i forgot to add that... I was thinking about it the whole time coding This is basicly an autoit version of an App i had on my Android phone. I was so bored i tried to recreate it. The app has 3 patterns, so i was trying to keep it that way. [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Link to comment Share on other sites More sharing options...
lorenkinzel Posted July 18, 2011 Share Posted July 18, 2011 I had fun by replacing (where occurs) 500, 200 with @DesktopWidth*.95, @DesktopHeight*.95. Yes, a cheap trick. That will get you some strobe action! 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