Sign in to follow this  
Followers 0
ashley

random background picture

14 posts in this topic

well i extended the 'random background color changer' (with some help) to make this:

a 'random background picture changer'

well here it is:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.2.0
 Author:         ashley

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("random background picture", 604, 111, 193, 115)
$test = GUICtrlCreateLabel("This is a test to show you how to make a random background picture...", 40, 32, 546, 24)
$RBGpic = Random(1, 3, 1)
If $RBGpic = 1 Then 
     GUICtrlCreatePic("C:\Documents and Settings\Windows\Desktop\Picture one.bmp" , 0, 0, 604, 155, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
ElseIf $RBGpic = 2 Then 
    GUICtrlCreatePic("C:\Documents and Settings\Windows\Desktop\Picture two.bmp" , 0, 0, 604, 155, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
ElseIf $RBGpic = 3 Then 
    GUICtrlCreatePic("C:\Documents and Settings\Windows\Desktop\Picture three.bmp" , 0, 0, 604, 155, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
EndIf
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

tell me what you think...

and the test pics are attached...

Share this post


Link to post
Share on other sites



Simple and very easy.

You should combine both topics, they are accentually the same.

no because one is a picture changer and one is a color changer.. so it easy to have the in diffrent topics...

Share this post


Link to post
Share on other sites

You should make a random control color changer. That would be even better. Hope to see it soon!

i dont get it.. what do you mean

Share this post


Link to post
Share on other sites

A Control is like a button, listview, label, ect... you use Koda so I guess you never heard of them.

yep.. amke a one button excample... and ill get it

Share this post


Link to post
Share on other sites

i meen one random color bit for it...

You can random from the range and hex it to 8.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

do you men something like this

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.2.0
 Author:         ashley

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------



#include <GUIConstants.au3>
$Randomcolor = Random( 0xFFFFFF, 0x2B1B1B1, 0)
$randomfontsize = Random ( 8, 24)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 610, 105, 193, 115)
$Label1 = GUICtrlCreateLabel("this is too show you a random label color a font size", 0, 0, 610, 105)
GUICtrlSetColor(-1, $Randomcolor)
GUICtrlSetFont(-1, $randomfontsize , 400, 0, "Arial")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Edit = part of code missing...

Edited by ashley

Share this post


Link to post
Share on other sites

Most of the time i found your script useless since it's some random func that you combined. For the GUIBackground picture changer you should use @ScriptDir

and here?

#include <GUIConstants.au3>
Global $Form1
$Randomcolor = Random( 0xFFFFFF, 0x2B1B1B1, 1)
$randomfontsize = Random ( 8, 24)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 610, 105, 193, 115)
$Label1 = GUICtrlCreateLabel("this is too show you a random label color a font size", 0, 0, 610, 105)
GUICtrlSetColor(-1, $Randomcolor)
GUICtrlSetFont(-1, $randomfontsize , 400, 0, "Arial")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    _Random()
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Func _Random()
    Local $Random=Random(0xFFFFFF, 0x2B1B1B1, 1)
    Hex($Random,8)
    GUISetBkColor($Random,$Form1)
EndFunc

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  
Followers 0