Jump to content
Sign in to follow this  

AutoIt Saver

Recommended Posts


Hey, I got bored a few minutes ago, and was trying some stuff, practicing collision detection, and came up with this. Basically it is a really simple screensaver, where the AutoIt logo moves around and bounces off each wall...


#include <guiconstants.au3>
if ($CmdLine[0] > 0) Then
    if (StringInStr($CmdLine[1], "/c")) Then
        $speed = InputBox("Speed!", "enter a number 1-10, 1 being the slowest.")
        $back_c = InputBox("Background Color!", "Enter a hexadecimal color to be used as the background", "0x010080")
        $size   = InputBox("Size!", "Enter a number between 1 and 300 1 being the smallest!", "200")
        _Configure($speed, $back_c, $size)

if (RegRead("HKEY_LOCAL_MACHINE\Software\AutoItScreenSaver\", "speed") <> "") Then
    $IMAGE_HSPEED = RegRead("HKEY_LOCAL_MACHINE\Software\AutoItScreenSaver\", "speed")
    $IMAGE_VSPEED = RegRead("HKEY_LOCAL_MACHINE\Software\AutoItScreenSaver\", "speed") - 2
    $BACKGROUND_COLOR = RegRead("HKEY_LOCAL_MACHINE\Software\AutoItScreenSaver\", "background_color")
    $IMAGE_WIDTH      = RegRead("HKEY_LOCAL_MACHINE\Software\AutoItScreenSaver\", "image_size")
    $IMAGE_HEIGHT      = RegRead("HKEY_LOCAL_MACHINE\Software\AutoItScreenSaver\", "image_size") / 2
    _Configure(5, 0x010080, 200)
    $BACKGROUND_COLOR = 0x010080
    $IMAGE_WIDTH = 200
    $IMAGE_HEIGHT = 100

;IMAGE 010080
Global $IMAGE_HSPEED = 5
Global $IMAGE_VSPEED = 2
Global $IMAGE_X     = 25
Global $IMAGE_Y     = 25
Global Const $IMAGE_WIDTH = 200
Global Const $IMAGE_HEIGHT = 100
Global Const $MAX_X       = @DesktopWidth
Global Const $MAX_Y       = @DesktopHeight
GLobal Const $MIN_X       = 0
Global Const $MIN_Y       = 0
GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
Global $IMAGE = GUICtrlCreatePic("logo.jpg", $IMAGE_X, $IMAGE_Y, $IMAGE_WIDTH, $IMAGE_HEIGHT)
while (GUIGetMsg() <> -3)
    ControlMove("", "", $IMAGE, $IMAGE_X, $IMAGE_Y)

Func UpdateSprites()
    if ($IMAGE_X >= ($MAX_X-$IMAGE_WIDTH)) Then $IMAGE_HSPEED *= -1
    if ($IMAGE_X <= ($MIN_X)) Then $IMAGE_HSPEED *= -1
    if ($IMAGE_Y >= ($MAX_Y-$IMAGE_HEIGHT)) Then $IMAGE_VSPEED *= -1
    if ($IMAGE_Y <= ($MIN_Y)) Then $IMAGE_VSPEED *= -1
Func _Configure($speed, $background_color, $image_size)
    RegWrite("HKEY_LOCAL_MACHINE\Software\AutoItScreenSaver\", "speed", "REG_SZ", $speed)
    RegWrite("HKEY_LOCAL_MACHINE\Software\AutoItScreenSaver\", "background_color", "REG_SZ", $background_color)
    RegWrite("HKEY_LOCAL_MACHINE\Software\AutoItScreenSaver\", "image_size", "REG_SZ", $image_size)

if you want to use it as a screensaver, just uncomment what is commented.

put this logo in the same directory as the script:


Share this post

Link to post
Share on other sites

Haha, neat. Good work.

The drawing method produces quite a bit of flicker, though.

Share this post

Link to post
Share on other sites

No flicker for me. Nice work.

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.

Share this post

Link to post
Share on other sites


I don't get any flicker either(just a little tiny bit in the bottom corner of the image), but the way i was gonna do it before GUICtrlSetPos() made alot of flicker, so I used ControlSetPos() and it worked fine.

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.