Lakes Posted December 24, 2011 Share Posted December 24, 2011 Zip file for this is hereexpandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <String.au3> Opt("GUIOnEventMode", 1) $Wid = 960 $Hgt = 720 Global $StringX, $StringY Global $flakes = 25, $Min = 5, $Max = 20 Global $particles[$flakes][5] Global $santaX = $wid, $santaY = 100 Global $sc_hBrush, $sc_hFormat, $sc_hFamily, $sc_hFont, $sc_text_color, $text_scroller, $sc_tLayout, $sc_pen, $sc_brush Global $letter_distance, $x, $y, $lenght, $end, $scroller_length, $sc_k Global $shadowBrush, $shadowFormat, $shadowFamily, $shadowFont, $shadowFamily, $shadowLayout Global $tshadow, $shadowtext ,$shadowtLayout, $shadowColor = 0xFFABA9BA Global $sc_text = "*** Merry Christmas and Happy New Year to all Autoit Users! ***" Global $sc_font_size = 48, $Font = "Times New Roman", $Fontoffset = 3 Global $bassdll = DllOpen(@ScriptDir & "\BASSMOD.dll"), $Play, $Pause, $stop Global $Titlestart = " " Global $Title = $Titlestart &" *** Merry Christmas! *** " $hGUI = GUICreate($Title, $Wid, $Hgt, -1, -1); -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE)) $menu = GUICtrlCreateMenu("Music") $Play = GUICtrlCreateMenuItem("Play", $menu) GUICtrlSetState(-1, $GUI_CHECKED) $Pause = GUICtrlCreateMenuItem("Pause", $menu) GUICtrlSetState(-1, $GUI_UNCHECKED) $Exit = GUICtrlCreateMenuItem("Exit", $menu) GUICtrlSetState(-1, $GUI_UNCHECKED) If @OSBuild < 7600 Then WinSetTrans($hGUI,"", 0xFF) ; only use this if solid background GUISetState(@SW_SHOW) GUISetOnEvent(-3, "close") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; =========================================== _GDIPlus_Startup() ;Window BckBuffer $graphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) $bitmap = _GDIPlus_BitmapCreateFromGraphics($Wid, $Hgt, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) ; BackBuffer for static image $bitmap1 = _GDIPlus_BitmapCreateFromGraphics($Wid, $Hgt, $graphics) $backbuffer1 = _GDIPlus_ImageGetGraphicsContext($bitmap1) $Background = _GDIPlus_ImageLoadFromFile("SnowScene.png") #Region Load Images $santa = _GDIPlus_ImageLoadFromFile("Santa.png") $santaW = _GDIPlus_ImageGetWidth($santa) $santaH = _GDIPlus_ImageGetHeight($santa) $Flake1 = _GDIPlus_ImageLoadFromFile("Flake1.png") $Flake1W = _GDIPlus_ImageGetWidth($Flake1)/4 $Flake1H = _GDIPlus_ImageGetHeight($Flake1)/4 $F1eX = $Flake1W/2 $F1eY = $Flake1H/2 $Flake2 = _GDIPlus_ImageLoadFromFile("Flake2.png") $Flake2W = _GDIPlus_ImageGetWidth($Flake2)/4 $Flake2H = _GDIPlus_ImageGetHeight($Flake2)/4 $F2eX = $Flake2W/2 $F2eY = $Flake2H/2 $Flake3 = _GDIPlus_ImageLoadFromFile("Flake3.png") $Flake3W = _GDIPlus_ImageGetWidth($Flake3)/4 $Flake3H = _GDIPlus_ImageGetHeight($Flake3)/4 $F3eX = $Flake3W/2 $F3eY = $Flake3H/2 #endregion #Region Setup Scroll Font $sc_text_color = 0xFFffffff $sc_htextBrush = _GDIPlus_BrushCreateSolid($sc_text_color) $sc_hFormat = _GDIPlus_StringFormatCreate() $sc_hFamily = _GDIPlus_FontFamilyCreate($Font) $sc_hFont = _GDIPlus_FontCreate($sc_hFamily, $sc_font_size, 2) $sc_pen = _GDIPlus_PenCreate(0) $sc_brush = _GDIPlus_BrushCreateSolid(0) $tLayout = _GDIPlus_RectFCreate(0, 0) ;shadow ;$T_Fontoffset = 5 $ShadowBrush = _GDIPlus_BrushCreateSolid($shadowColor) $ShadowFormat = _GDIPlus_StringFormatCreate() $ShadowFamily = _GDIPlus_FontFamilyCreate($Font) $ShadowFont = _GDIPlus_FontCreate($shadowFamily, $sc_font_size, 2) $ShadowLayout = _GDIPlus_RectFCreate(0, 0) ;Text Ini $sc_letter_distance = $sc_font_size $sc_length = $sc_font_size * 1.666 * 0.36 $sc_k = $wid $end = 0 $scroller_length = StringLen($sc_text) * $sc_length $sc_FontY = $Hgt - $Hgt/4 + 40 #endregion For $i = 0 To UBound($particles) - 1 $particles[$i][0] = Random(0, $wid, 1) ;X pos $particles[$i][1] = Random(0, $hgt, 1) ;Y pos $particles[$i][2] = 0 $particles[$i][3] = Random($min, $max) $particles[$i][4] = Random($min, $max, 1) ;size Next Play_Audio() Do _GDIPlus_GraphicsClear($backbuffer, 0x00FFFFFF) _GDIPlus_GraphicsDrawImageRect($backbuffer1, $Background, 0, 0, $Wid, $Hgt) ;Static Image _Draw() ScrollText() _GDIPlus_GraphicsDrawImageRect($backbuffer1, $bitmap, 0, 0, $Wid, $Hgt) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap1, 0, 0, $Wid, $Hgt) Sleep(20) Until 0 Func _Draw() _GDIPlus_GraphicsDrawImageRect($backbuffer1, $santa, $santaX, $santaY, $santaW, $santaH) For $i = 0 To UBound($particles) - 1 If $particles[$i][1] > $hgt Then $particles[$i][0] = Random(-50, $wid+50, 1) ; X pos $particles[$i][1] = 0 ; y Pos $particles[$i][2] = 0 $particles[$i][3] = Random($min, $max) ;min, max, [int] $particles[$i][4] = Random($min, $max, 1) ; size EndIf $particles[$i][0] += $particles[$i][2] $particles[$i][1] += $particles[$i][3] ; X y width Height _GDIPlus_GraphicsDrawImageRect($backbuffer1, $Flake1, $particles[$i][0], $particles[$i][1], $Flake1W +$particles[$i][4], $Flake1H + $particles[$i][4]) _GDIPlus_GraphicsDrawImageRect($backbuffer1, $Flake2, $particles[$i][0] + 50 , $particles[$i][1] + 50, $Flake1W +$particles[$i][4], $Flake1H + $particles[$i][4]) _GDIPlus_GraphicsDrawImageRect($backbuffer1, $Flake3, $particles[$i][0] - 25 , $particles[$i][1] - 25, $Flake1W +$particles[$i][4], $Flake1H + $particles[$i][4]) Next $santaX -= 8 If -$SantaW >= $santaX Then $santaX = $Wid EndIf EndFunc ; ========= Handle WM_COMMAND messages ======================= Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Switch $iwParam Case $Play Play() Case $Pause Pause() Case $Exit Close() EndSwitch EndFunc ;==>WM_COMMAND ;============================================================= ; ================ SCROLL TEXT ==================== Func ScrollText() $sc_FontX = $sc_k + $sc_letter_distance DllStructSetData($tLayout, "x", $sc_FontX) DllStructSetData($tLayout, "y", $sc_FontY) _GDIPlus_GraphicsDrawStringEx($BackBuffer, $sc_text, $sc_hFont, $tLayout, $sc_hFormat, $sc_htextBrush) ;Shadow DllStructSetData($ShadowLayout, "X", $sc_FontX + $FontOffset) DllStructSetData($ShadowLayout, "Y", $sc_FontY + $FontOffset) _GDIPlus_GraphicsDrawStringEx($Backbuffer1, $sc_text, $shadowFont, $shadowLayout, $shadowFormat, $shadowBrush) ;Text DllStructSetData($tLayout, "X", $sc_FontX) DllStructSetData($tLayout, "Y", $sc_FontY) _GDIPlus_GraphicsDrawStringEx($Backbuffer1, $sc_text, $sc_hFont, $tLayout, $sc_hFormat, $sc_htextBrush) $sc_k -= 5 If -$scroller_length >= $sc_k Then $sc_k = $Wid EndFunc Func Play_Audio() $Init = DllCall($bassdll, "int", "BASSMOD_Init", "int", -1, "int", 44100, "int", 0) $string= DllStructCreate("char[255]") DllStructSetData($string, 1, @ScriptDir & "\christmas_silence.xm") $load = DllCall($bassdll, "int", "BASSMOD_MusicLoad", _ "int", 0, _ "ptr", DllStructGetPtr($string), _ "int", 0, _ "int", 0, _ "int", 4 + 1024) $VolLevel = 100 $Volume = DllCall($bassdll, "int", "BASSMOD_SetVolume", "int", $VolLevel) DllCall($bassdll, "int", "BASSMOD_MusicPlay") EndFunc Func Play() ;consolewrite("You selected Play" &@CRLF) GUICtrlSetState($Play, $GUI_CHECKED) DllCall($bassdll, "int", "BASSMOD_MusicPlay") GUICtrlSetState($Pause, $GUI_UNCHECKED) GUICtrlSetState($Stop, $GUI_UNCHECKED) EndFunc Func Pause() ;consolewrite("You selected Pause" &@CRLF) GUICtrlSetState($Pause, $GUI_CHECKED) DllCall($bassdll, "int", "BASSMOD_MusicPause") GUICtrlSetState($Play, $GUI_UNCHECKED) GUICtrlSetState($Stop, $GUI_UNCHECKED) EndFunc Func close() _GDIPlus_FontDispose($SC_hFont) _GDIPlus_FontFamilyDispose($SC_hFamily) _GDIPlus_StringFormatDispose($SC_hFormat) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_BrushDispose($sc_hBrush) _GDIPlus_FontFamilyDispose($shadowFamily) _GDIPlus_StringFormatDispose($shadowFormat) _GDIPlus_BrushDispose($shadowBrush) _WinAPI_DeleteObject($bitmap) _WinAPI_DeleteObject($bitmap1) _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_GraphicsDispose($backbuffer1) _GDIPlus_Shutdown() Exit EndFunc ;==>close ;Happy Holidays! Andreik and Xandy 2 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
lorenkinzel Posted December 24, 2011 Share Posted December 24, 2011 Pretty nice, Lakes. If only this were up a few days ago........ Link to comment Share on other sites More sharing options...
asionwu Posted December 24, 2011 Share Posted December 24, 2011 haha! Merry Christmas! Link to comment Share on other sites More sharing options...
GreenCan Posted December 24, 2011 Share Posted December 24, 2011 Well done! Merry Christmas Lakes Merry Christmas all GreenCan Contributions CheckUpdate - SelfUpdating script ------- Self updating script Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple MsgBox with CountDown ------------------- MsgBox with visual countdown Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV) USB Drive Tools ------------------------------ Tool to help you with your USB drive management Input Period udf ------------------------------ GUI for a period input Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette Excel Chart UDF ----------------------------- Collaboration project with water GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm TaskListAllDetailed --------------------------- List All Scheduled Tasks Computer Info --------------------------------- A collection of information for helpdesk Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only) Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane Oracle SQL Report Generator ------------- Oracle Report generator using SQL SQLite Report Generator ------------------- SQLite Report generator using SQL SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access Animated animals ----------------------------- Fun: Moving animated objects Perforated image in GUI --------------------- Fun: Perforate your image with image objects UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool Visual Image effect (GUI) -------------------- Visually apply effects on an image    Link to comment Share on other sites More sharing options...
ValeryVal Posted December 26, 2011 Share Posted December 26, 2011 Thank you, Lakes. For full screen one can just make one replacement of this line $hGUI = GUICreate($Title, $Wid, $Hgt, -1, -1); -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE)) New lines could be the following: $Wid = @DesktopWidth $Hgt = @DesktopHeight $hGUI = GUICreate($Title, $Wid, $Hgt, -1, -1) ;How to set the real size of window? WinMove($Title, "", 0, 0, $Wid, $Hgt) It's very nice thing! The point of world view Link to comment Share on other sites More sharing options...
Lakes Posted December 26, 2011 Author Share Posted December 26, 2011 Glad you like it. Increasing the window size uses a bit more processor time and the animation is less smooth, so there`s a trade off involved for people with large widescreen monitors. 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
1957classic Posted December 27, 2011 Share Posted December 27, 2011 Thank you for sharing it, Lakes, I really enjoyed it. Link to comment Share on other sites More sharing options...
normal1coder Posted December 28, 2011 Share Posted December 28, 2011 I want to change your picture tocan you help me? because it make buggy Link to comment Share on other sites More sharing options...
Lakes Posted December 29, 2011 Author Share Posted December 29, 2011 I want to change your picture tocan you help me? because it make buggyYou want to use that size picture or is there a larger version? 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Mosquitos Posted December 23, 2012 Share Posted December 23, 2012 Can you use this script with mp3-files? Sapiente vince, rex, noli vincere ferro! Link to comment Share on other sites More sharing options...
BrewManNH Posted December 23, 2012 Share Posted December 23, 2012 Can you use this script with mp3-files?You'd have to modify the code to do that, it's set up to play a mod file that is in the zip file. To play an MP3 you'd need to use BASS.dll instead of BASSMOD.dll, that's just for a start, but shouldn't be too hard to accomplish. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
Xandy Posted December 23, 2012 Share Posted December 23, 2012 Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Malkey Posted December 25, 2012 Share Posted December 25, 2012 The SoundPlay function also works. In the example, I scan "http://download.freeky-music.org.ua/misc/24%20Famous%20Christmas%20Songs%20-%201988/frank_sinatra_-_let_it_snow_let_it_snow_let_it_snow.mp3" and is not infected. Also, press "Esc" to end song. #include <Misc.au3> If FileExists(@TempDir & "\Frank Sinatra - Let It Snow.mp3") = 0 Then _ InetGet("http://download.freeky-music.org.ua/misc/24%20Famous%20Christmas%20Songs%20-%201988/frank_sinatra_-_let_it_snow_let_it_snow_let_it_snow.mp3", _ @TempDir & "\Frank Sinatra - Let It Snow.mp3") SoundPlay(@TempDir & "\Frank Sinatra - Let It Snow.mp3", 0) Do Sleep(10) Until _IsPressed("1B") Link to comment Share on other sites More sharing options...
Mosquitos Posted December 25, 2012 Share Posted December 25, 2012 You'd have to modify the code to do that, it's set up to play a mod file that is in the zip file. To play an MP3 you'd need to use BASS.dll instead of BASSMOD.dll, that's just for a start, but shouldn't be too hard to accomplish. The SoundPlay function also works. In the example, I scan "http://download.freeky-music.org.ua/misc/24%20Famous%20Christmas%20Songs%20-%201988/frank_sinatra_-_let_it_snow_let_it_snow_let_it_snow.mp3" and is not infected. Also, press "Esc" to end song. #include <Misc.au3> If FileExists(@TempDir & "\Frank Sinatra - Let It Snow.mp3") = 0 Then _ InetGet("http://download.freeky-music.org.ua/misc/24%20Famous%20Christmas%20Songs%20-%201988/frank_sinatra_-_let_it_snow_let_it_snow_let_it_snow.mp3", _ @TempDir & "\Frank Sinatra - Let It Snow.mp3") SoundPlay(@TempDir & "\Frank Sinatra - Let It Snow.mp3", 0) Do Sleep(10) Until _IsPressed("1B") Thanks Sapiente vince, rex, noli vincere ferro! Link to comment Share on other sites More sharing options...
Andreik Posted December 25, 2012 Share Posted December 25, 2012 That's pretty nice, thanks for share. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Rux Posted December 25, 2012 Share Posted December 25, 2012 Pretty cool. However, your coding style makes me cringe. Whats with all those unnecessary spaces? 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