Onoitsu2 Posted April 17, 2006 Posted April 17, 2006 (edited) I have modified the screensaver with text that nwfu has made, and made it work with the windows display control panel, so you can use the right click options (Test, Configure, and Install) and then use the settings and preview buttons in the Display Control Panel, Screen Saver tab. I have posted the .au3 file here, to install it, compile using BETA, and rename to a .scr extension, then right click and choose Install. screensaver.au3 Here is the code as well... expandcollapse popup; =================================================== ; Made By: nfwu ; Made to work as a windows screensaver by: Onoitsu2 ; =================================================== #NoTrayIcon #include <GUIConstants.au3> $gSpeed = (50) $gFieldColor = (0) ;~ $gRandColor = (1) $gFontSize = (25) $gLabelWidth = $gFontSize * 40 $gLabelHeight = $gFontSize * 12 $message = RegRead("HKEY_CURRENT_USER\Software\AutoItSCR","Message") $gRandColor = RegRead("HKEY_CURRENT_USER\Software\AutoItSCR","RColor") $direction = RegRead("HKEY_CURRENT_USER\Software\AutoItSCR","Direction") If $message = "" Then $message = "AutoIt is simple, subtle, elegant." If $gRandColor = "" Then $gRandColor = 0 If $direction = "" Then $direction = 0 Func SaverWindow($nWidth, $nHeight, $nLeft, $nTop, $hParent = 0) MouseMove($nWidth + 1, $nHeight + 1, 0) $mPos = MouseGetPos() $hGUI = GUICreate("", $nWidth, $nHeight, $nLeft, $nTop, $WS_POPUPWINDOW, $WS_EX_TOPMOST, $hParent) GUISetBkColor($gFieldColor) Local $labelx = Random(0, $nWidth), $labely = Random(0, $nHeight) Local $label = GUICtrlCreateLabel ( $message, $labelx, $labely, $gLabelWidth, $gLabelHeight) if $gRandColor Then GUICtrlSetColor ( $label, "0x"&hex(Random(0,254,1),2)&hex(Random(0,254,1),2)&hex(Random(0,254,1),2)) if NOT $gRandColor Then GUICtrlSetColor ( $label, 0xFFFFFF) GUICtrlSetFont ($label, $gFontSize ) GUISetState() While 1 $msg = GuiGetMsg() $mcPos = MouseGetPos() If $mPos[0] <> $mcPos[0] or $mPos[1] <> $mcPos[1] or $msg = $GUI_EVENT_CLOSE Then GUIDelete($hGUI) Return EndIf If $direction = 0 Then $labelx = $labelx + 5 If $labelx > $nWidth Then if $gRandColor Then GUICtrlSetColor ( $label, "0x"&hex(Random(0,254,1),2)&hex(Random(0,254,1),2)&hex(Random(0,254,1),2)) if NOT $gRandColor Then GUICtrlSetColor ( $label, 0xFFFFFF) $labelx = $nLeft - ($gLabelWidth / 2) EndIf Elseif $direction = 1 Then $labelx = $labelx - 5 If $labelx < $nLeft - $gLabelWidth Then if $gRandColor Then GUICtrlSetColor ( $label, "0x"&hex(Random(0,254,1),2)&hex(Random(0,254,1),2)&hex(Random(0,254,1),2)) if NOT $gRandColor Then GUICtrlSetColor ( $label, 0xFFFFFF) $labelx = $nWidth + ($gLabelWidth / 2) $labely = Random(0, $nHeight) EndIf EndIf GUICtrlSetPos ( $label, $labelx, $labely ) Sleep(50 - $gSpeed) WEnd EndFunc Func setmessage() $sMessageAnswer = InputBox("Message to Display?","Message you want the screensaver to display?",$message," M","-1","-1","-1","-1") Select Case @Error = 0;OK - The string returned is valid $message = $sMessageAnswer RegWrite("HKEY_CURRENT_USER\Software\AutoItSCR","Message","REG_SZ",$message) Case @Error = 1;The Cancel button was pushed Case @Error = 3;The InputBox failed to open EndSelect $iRColorAnswer = MsgBox(4,"Random Color?","Do you want the message to be a randomly generated color?" & @CRLF & "If NO it will be White") Select Case $iRColorAnswer = 6;Yes RegWrite("HKEY_CURRENT_USER\Software\AutoItSCR","RColor","REG_SZ",1) Case $iRColorAnswer = 7;No RegWrite("HKEY_CURRENT_USER\Software\AutoItSCR","RColor","REG_SZ",0) EndSelect $iDirectionAnswer = MsgBox(4,"Text Direction?","Do You Want The Text To Move TO The Right?" & @CRLF & "NO Makes Text Come In From The Right TO The Left.") Select Case $iDirectionAnswer = 6;Yes RegWrite("HKEY_CURRENT_USER\Software\AutoItSCR","Direction","REG_SZ",0) Case $iDirectionAnswer = 7;No RegWrite("HKEY_CURRENT_USER\Software\AutoItSCR","Direction","REG_SZ",1) EndSelect EndFunc if $cmdline[0] > 0 Then if $cmdline[1] = "/S" Then SaverWindow(@DesktopWidth, @DesktopHeight, 0, 0) Exit ElseIf StringMid($cmdline[1],1,3) = "/c:" Then setmessage() ElseIf $cmdline[1] = "/p" Then EndIf Elseif $cmdline[0] = 0 Then setmessage() EndIf Please post your comments and improvments, and PLEASE test this rigorously. Laterzzz, Onoitsu2 EDIT: Changed Code To Allow Text To Come In From Left OR Right, AND To Allow For Random Colors... As always please post comments. Edited April 17, 2006 by Onoitsu2 Things I have made:[font="Trebuchet Ms"]_CheckTimeBlock UDF(LT)MOH Call Ignore List (MOH = Modem On Hold)[/font]
RazerM Posted April 17, 2006 Posted April 17, 2006 (edited) it works but i'd like to note that before installing, make sure the .scr file has no space in the filename or it doesn't work. Edited April 17, 2006 by RazerM My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Tukata Posted April 17, 2006 Posted April 17, 2006 Very nice. How can I make the text scroll from right to left ?
Zedna Posted April 17, 2006 Posted April 17, 2006 It's a good job but as true screensaver it must react (end) when every mouse/keyboard event occurs. So there is missing handle such things like for example: mouse click, Alt+Tab, ... Look at GUIRegisterMsg() or SystemParametersInfo (SPI_SCREENSAVERRUNNING, ...) Resources UDF ResourcesEx UDF AutoIt Forum Search
theguy0000 Posted April 17, 2006 Posted April 17, 2006 If you choose a white color instead of random, it WILL choose a random color the first time the text scrolls, then go to white like it should. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
Onoitsu2 Posted April 17, 2006 Author Posted April 17, 2006 It's a good job but as true screensaver it must react (end) when every mouse/keyboard event occurs.So there is missing handle such things like for example: mouse click, Alt+Tab, ...Look at GUIRegisterMsg() or SystemParametersInfo (SPI_SCREENSAVERRUNNING, ...)Obviously this is far from being done, but it is a good example of hot to install a script as a screensaver, the only necessary part is the area that looks at the command line switches, as you can make this do anything as a screensaver, from a script that auto defrags, to one that auto downloads things when it is active, whatever you wish to code it would do it and windows and possible the end user would be none the wiser.Heck I can even make this "Screensaver" run another screensaver and then do its tasks in the background, so you elect the favorite screensaver file, then it does whatever it has been programmed to do, so it can be sort of an idle utility. Things I have made:[font="Trebuchet Ms"]_CheckTimeBlock UDF(LT)MOH Call Ignore List (MOH = Modem On Hold)[/font]
Onoitsu2 Posted April 17, 2006 Author Posted April 17, 2006 If you choose a white color instead of random, it WILL choose a random color the first time the text scrolls, then go to white like it should.I for some odd reason have not been able to trap that problem, and also I am having problems with an addition I have just tried, using the _ChooseColor function, I have it now where if you choose NO to random it prompts with a color select box, only problem is the program is not using the color I have set, no clue why, because my checks for if random is on or off work, but it is ALWAYS random, and I have no idea why, I even msgboxed the variables read from the registry to check them, and still nothing.This is going to take me a while to fix, and the first one being random as well...Laterzzz,Onoitsu2 Things I have made:[font="Trebuchet Ms"]_CheckTimeBlock UDF(LT)MOH Call Ignore List (MOH = Modem On Hold)[/font]
Zedna Posted April 17, 2006 Posted April 17, 2006 Another improvment:Add GUISetCursor(16) after GUICreate for hide mouse cursor. Resources UDF ResourcesEx UDF AutoIt Forum Search
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