Sign in to follow this  
Followers 0
z0mgItsJohn

Random Colors v1.0

7 posts in this topic

#1 ·  Posted (edited)

Random Colors v1.0 : Its Just A Box Shape GUI W/ 100 Buttons That Display Random Colors And Plays A Song That I Found. Lol :P

Source : Random Colors v1.0 :P

#Include <GUIConstants.Au3>
#Include <Sound.Au3>
#NoTrayIcon
Opt ('GUIOnEventMode','1')

Global $Button_Row['12']['11']

INetGet ('http://members.cox.net/data_base/Random%20Song.mp3', @TempDir & '\Random Song.Mp3')

$Open = _SoundOpen (@TempDir & '\Random Song.Mp3')
_SoundPlay ($Open)

GUICreate ('Random Colors v1.0','200','170','-1','-1','-1','128')
GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit')
_Create_Buttons ()
GUICtrlCreateLabel ('','-1','-1','-1','-1')
GUICtrlSetState ('-1', $GUI_FOCUS)
GUISetState (@SW_SHOW)

While ('1')
Sleep ('100')
_Set_Color ()
WEnd

Func _Create_Buttons ()
For $Array = '0' To '10'
$Button_Row['1'][$Array] = GUICtrlCreateButton ('','20' * $Array,'0','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
For $Array = '0' To '10'
$Button_Row['2'][$Array] = GUICtrlCreateButton ('','20' * $Array,'17','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
For $Array = '0' To '10'
$Button_Row['3'][$Array] = GUICtrlCreateButton ('','20' * $Array,'34','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
For $Array = '0' To '10'
$Button_Row['4'][$Array] = GUICtrlCreateButton ('','20' * $Array,'51','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
For $Array = '0' To '10'
$Button_Row['5'][$Array] = GUICtrlCreateButton ('','20' * $Array,'68','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
For $Array = '0' To '10'
$Button_Row['6'][$Array] = GUICtrlCreateButton ('','20' * $Array,'85','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
For $Array = '0' To '10'
$Button_Row['7'][$Array] = GUICtrlCreateButton ('','20' * $Array,'102','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
For $Array = '0' To '10'
$Button_Row['8'][$Array] = GUICtrlCreateButton ('','20' * $Array,'119','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
For $Array = '0' To '10'
$Button_Row['9'][$Array] = GUICtrlCreateButton ('','20' * $Array,'136','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
For $Array = '0' To '10'
$Button_Row['10'][$Array] = GUICtrlCreateButton ('','20' * $Array,'153','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
For $Array = '0' To '10'
$Button_Row['11'][$Array] = GUICtrlCreateButton ('','20' * $Array,'170','20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
EndFunc

Func _Set_Color ()
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['1'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['2'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['3'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['4'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['5'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['6'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['7'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['8'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['9'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['10'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
For $Array = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row['11'][$Array], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
EndFunc

Func _Exit ()
Exit
EndFunc

* Hope You Like It :) *

Feel Free To Leave Comments Etc.

Edited by John2006

Latest Projects :- New & Improved TCP Chat

Share this post


Link to post
Share on other sites



* No Comments :P * Come On You Know You Want Color In Your Life :)


Latest Projects :- New & Improved TCP Chat

Share this post


Link to post
Share on other sites

I like the music and the color effect :)

A suggestion though:

The code is unnecessary long, you could use just one for loop in both the big functions.

:P


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Cute!!!

#include <GUIConstants.Au3>
#include <Sound.Au3>
#NoTrayIcon

Opt('GUIOnEventMode', '1')

Global $Button_Row['12']['11']

InetGet('http://members.cox.net/data_base/Random%20Song.mp3', @TempDir & '\Random Song.Mp3')
$Open = _SoundOpen(@TempDir & '\Random Song.Mp3')
_SoundPlay($Open)

GUICreate('Random Colors v1.0', '200', '170', '-1', '-1', '-1', '128')
GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit')
_Create_Buttons()
GUISetState()

While 1
    Sleep('100')
    _Set_Color()
WEnd

Func _Create_Buttons()
    Local $top = 0
    For $x = 1 To 11
        For $Array = '0' To '10'
            $Button_Row[$x][$Array] = GUICtrlCreateButton('', '20' * $Array, $top, '20', '17')
            GUICtrlSetState('-1', $GUI_DISABLE)
        Next
        $top += 17
    Next
EndFunc   ;==>_Create_Buttons

Func _Set_Color()
    For $x = 1 To 11
        For $Array = '0' To '10'
            $Random = Random('0x000000', '0xFFFFFF')
            GUICtrlSetBkColor($Button_Row[$x][$Array], $Random)
            $Random = Random('3', '5', '1')
            Sleep($Random)
        Next
    Next
EndFunc   ;==>_Set_Color

Func _Exit()
    Exit
EndFunc   ;==>_Exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

It's good that you chose to use Arrays. Alot of newer users don't do that, thus unnecessarily increasing the length of their script.

I love the music :)

Share this post


Link to post
Share on other sites

I'm Not That Good W/ Arrays And I Could Get It To Make 2 Rows Of Buttons W/ 1 Array xD.. :P

Oh.. And Thanks For The Comments :)


Latest Projects :- New & Improved TCP Chat

Share this post


Link to post
Share on other sites

Updated Kinda O.o Not Anything New But Shorter Script :)

Source : Random Colors v1.1

#Include <GUIConstants.Au3>
#Include <Sound.Au3>
#NoTrayIcon
Opt ('GUIOnEventMode','1')

Global $Button_Row['12']['11']

INetGet ('http://members.cox.net/data_base/Random%20Song.mp3', @TempDir & '\Random Song.Mp3')

$Open = _SoundOpen (@TempDir & '\Random Song.Mp3')
_SoundPlay ($Open)

GUICreate ('Random Colors v1.1','200','170','-1','-1','-1','128')
GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit')
_Create_Buttons ()
GUICtrlCreateLabel ('','-1','-1','-1','-1')
GUICtrlSetState ('-1', $GUI_FOCUS)
GUISetState (@SW_SHOW)

While ('1')
Sleep ('100')
_Set_Color ()
WEnd

Func _Create_Buttons ()
Local $Top = ('0')
For $Array_1 = '1' To '11'
For $Array_2 = '0' To '10'
$Button_Row[$Array_1][$Array_2] = GUICtrlCreateButton ('','20' * $Array_2, $Top, '20','17')
GUICtrlSetState ('-1', $GUI_DISABLE)
Next
$Top = $Top + '17'
Next
EndFunc

Func _Set_Color ()
For $Array_1 = '1' To '11'
For $Array_2 = '0' To '10'
$Random = Random ('0x000000','0xFFFFFF')
GUICtrlSetBkColor ($Button_Row[$Array_1][$Array_2], $Random) 
$Random = Random ('3','5','1')
Sleep ($Random)
Next
Next
EndFunc

Func _Exit ()
Exit
EndFunc

Latest Projects :- New & Improved TCP Chat

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