Jump to content

Random & SplashImageOn


Recommended Posts

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
Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

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
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...