Sign in to follow this  
Followers 0
iceberg

Random & SplashImageOn

7 posts in this topic

Hi,

Just wondering if could I use the RANDOM function to to "store" the pic files and then use SplashImageOn function to display the pics randomly?

Thanks.


mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites



If I understand you correctly you want to choose a random picture to show on your splash image?

Well I suppose if your picture files were named with numbers only it could work.

;Randomly choose between 1.bmp, 2.bmp and 3.bmp
SplashImageOn("", Random(1, 3, 1) & ".bmp")

Share this post


Link to post
Share on other sites

Hi,

Just wondering if could I use the RANDOM function to to "store" the pic files and then use SplashImageOn function to display the pics randomly?

Thanks.

Try this (BETA)

#Include <File.au3>
#Include <Array.au3>

$path = 'c:\images'
$FileList =_FileListToArray ( $path )

For $i = 1 To $FileList[0]
    $image = $FileList[Random(1, $FileList[0])]
    SplashImageOn ( 'Title', $path & '\' & $image )
    Sleep(3000)
Next

Share this post


Link to post
Share on other sites

thanks for the replies.

Emperor > after renaming my picture files to numbers, how i do write it in codes so that the script understands and works with SplashImage?

Briegel > how to i use your code if I am planning to use FileInstall to copy the pictures?

thanks again.


mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites

;FileInstall() the pictures
$Folder = @ScriptDir & "\Images\"
FileInstall("1.bmp", $Folder & "1.bmp")
FileInstall("2.bmp", $Folder & "2.bmp")
FileInstall("3.bmp", $Folder & "3.bmp")
;Randomly show one
SplashImageOn("Test", $Folder & Random(1, 3, 1) & ".bmp")

BTW if you don't want to name your files with numbers you can easily incorporate Briegels example into this.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Briegel > how to i use your code if I am planning to use FileInstall to copy the pictures?

Sample:

#Include <File.au3>
#Include <Array.au3>

$path = 'c:\images\' ; set to folder where images should install to
DirCreate ( $path )

FileInstall ( 'c:\yourimages\pic1.xxx', $path, 1 )
FileInstall ( 'c:\yourimages\pic2.xxx', $path, 1 )
FileInstall ( 'c:\yourimages\pic3.xxx', $path, 1 )
FileInstall ( 'c:\yourimages\pic4.xxx', $path, 1 )
FileInstall ( 'c:\yourimages\pic5.xxx', $path, 1 ) ; so on

$FileList =_FileListToArray ( $path )

For $i = 1 To $FileList[0]
    SplashImageOn ( 'Title', $path & '\' & $FileList[Random(1, $FileList[0])] )
    Sleep(3000) ; set timer to change images
Next

DirRemove ( $path )

I wonder that I have to use 'DirCreate()' and 'DirRemove()'. Until now I thought I can use 'FileInstall()' without this.

But I works. :D

Briegel

EDIT: language, grrrr

Edited by Briegel

Share this post


Link to post
Share on other sites

thanks alot for the excellent scripting Emperor & Briegel.

both works great. :D


mouse not found....scroll any mouse to continue.

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