Jump to content

random background picture


Recommended Posts

ok well you may know that i made a 'random background color changer'...

(if you didn't... check my sig)

well i decided to make a 'random background picture changer'

It didnt go as planned...

i get an error... can anybody fix this.. or tell me how... or why its not working...

here is code:

#include <GUIConstants.au3>

$RBGpic = Random( "C:\Documents and Settings\Windows\Desktop\Picture one.bmp", 0, 0, 604, 155, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)), "C:\Documents and Settings\Windows\Desktop\Picture three.bmp", 0, 0, 604, 155, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)), 0)

#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("random background color", 604, 111, 193, 115)
$test = GUICtrlCreateLabel("This is a test to show you how to make a random background picture...", 40, 32, 546, 24)
$Pic1 = GUICtrlCreatePic($RBGpic)
GUICtrlSetFont(-1, 12, 800, 6, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
WEnd

thanks in advance...

Edited by ashley
Link to comment
Share on other sites

Have you read the help file for the correct use of Random()? That is so complete wrong, it's incredible. :whistle:

i changed it...

i dont get the error... but it still dont work...

here the code

#include <GUIConstants.au3>

$RBGpic = Random( "C:\Documents and Settings\Windows\Desktop\Picture one.bmp", "C:\Documents and Settings\Windows\Desktop\Picture three.bmp")

#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("random background color", 604, 111, 193, 115)
$test = GUICtrlCreateLabel("This is a test to show you how to make a random background picture...", 40, 32, 546, 24)
$Pic1 = GUICtrlCreatePic($RBGpic, 0, 0, 604, 155, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetFont(-1, 12, 800, 6, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
WEnd
Link to comment
Share on other sites

$RBGpic = Random(1, 9, 1)
If $RBGpic = 1 Then 
    ;use "C:\Documents and Settings\Windows\Desktop\Picture one.bmp"
ElseIf $RBGpic = 2 Then
    ;use "C:\Documents and Settings\Windows\Desktop\Picture three.bmp"
EndIf

Edited by mrbond007
Link to comment
Share on other sites

ok now i have tryed a few things...

here they are: (they still dont work)

#include <GUIConstants.au3>


$RBGpic = Random( "C:\Documents and Settings\Windows\Desktop\Picture one.bmp", "C:\Documents and Settings\Windows\Desktop\Picture three.bmp")
$RBGpic = Random(1, 9, 1)
If $RBGpic = 1 Then 
    ;use "C:\Documents and Settings\Windows\Desktop\Picture one.bmp"
ElseIf $RBGpic = 2 Then
    ;use "C:\Documents and Settings\Windows\Desktop\Picture three.bmp"
EndIf

#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("random background color", 604, 111, 193, 115)
$test = GUICtrlCreateLabel("This is a test to show you how to make a random background picture...", 40, 32, 546, 24)
$Pic1 = GUICtrlCreatePic($RBGpic, 0, 0, 604, 155, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetFont(-1, 12, 800, 6, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
WEndoÝ÷ Ù«­¢+Ø¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì((((ÀÌØíI   Á¥ôI¹½´ Ä°ä°Ä¤)%ÀÌØíI   Á¥ôÄQ¡¸(ÅÕ½ÐíèÀäÈí½Õµ¹Ñ̹MÑÑ¥¹ÌÀäÈí]¥¹½ÝÌÀäÈíͭѽÀÀäÈíA¥ÑÕɽ¹¹µÀÅÕ½Ðì)±Í%ÀÌØíI    Á¥ôÈQ¡¸(ÅÕ½ÐíèÀäÈí½Õµ¹Ñ̹MÑÑ¥¹ÌÀäÈí]¥¹½ÝÌÀäÈíͭѽÀÀäÈíA¥ÑÕÉѡɹµÀÅÕ½Ðì)¹%((I¥½¸MQIP-½U$ÍÑ¥½¸½É´ô(ÀÌØíU$ôU%
ÉÑ ÅÕ½Ðíɹ½´­É½Õ¹½±½ÈÅÕ½Ðì°ØÀаÄÄÄ°ÄäÌ°ÄÄÔ¤(ÀÌØíÑÍÐôU%
Ñɱ
ÉÑ1° ÅÕ½ÐíQ¡¥Ì¥ÌÑÍÐѼ͡½Üå½Ô¡½ÜѼµ­É¹½´­É½Õ¹Á¥ÑÕɸ¸¸ÅÕ½Ðì°ÐÀ°ÌÈ°ÔÐØ°ÈФ(ÀÌØíA¥ÄôU%
Ñɱ
ÉÑA¥ ÀÌØíI   Á¥°À°À°ØÀаÄÔÔ°  ¥Ñ=H ÀÌØíMM}9=Q%d°ÀÌØí]M}I=U@°ÀÌØí]M}
1%AM%   1%9L¤¤)U%
ÑɱMѽ¹Ð ´Ä°ÄÈ°àÀÀ°Ø°ÅÕ½Ðí5LM¹ÌMÉ¥ÅÕ½Ðì¤)U%MÑMÑÑ¡M]}M!=¤(¹I¥½¸9-½U$ÍÑ¥½¸()]¡¥±Ä($ÀÌØí¹5ÍôU%Ñ5Í ¤(%MÝ¥Ñ ÀÌØí¹5Í($%
ÍÀÌØíU%}Y9Q}
1=M($$%á¥Ð((%¹MÝ¥Ñ )]¹

any more ideas

Link to comment
Share on other sites

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("random background color", 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, 9, 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))
EndIf
GUISetState()
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
WEnd

Edited by mrbond007
Link to comment
Share on other sites

ok now i have tryed a few things...

any more ideas

You are pulling a random integer from 1 to 9, but only handle cases for 1 and 2. I'll be that works about... 2 times out of 9! :whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...