Sign in to follow this  
Followers 0
slightly_abnormal

How Do You Display A Random Picture?

7 posts in this topic

okay.. so i want to randomly display one image everytime the script starts.. but the filename should not matter.. just that the images should exist and display one randomly.. I tryed multiple ways, of doing this i dont know arrays all that great either soo :)

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 546, 405, 192, 125, BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_TABSTOP))
$Pic1 = Random(1,GUICtrlCreatePic("*.bmp", 29, 20, 486, 358),1)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites



not tested

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 546, 405, 192, 125, BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_TABSTOP))
$Pic1 = GUICtrlCreatePic((Random(1,5,1) & ".bmp"), 29, 20, 486, 358)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
   ;;;;;;;
    EndSelect
WEnd
Exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

it worked.. thanks val :)

[EDIT]

it can only do numbers... ??

Edited by slightly_abnormal

Share this post


Link to post
Share on other sites

it worked.. thanks val :)

Welcome

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

eh.. how do i get it to display images with letters, and numbers in there name??

#include <GUIConstants.au3>
; == GUI generated with Koda ==
for $i= Asc(0) to Asc(255)
Next
$Form1 = GUICreate("AForm1", 546, 405, 192, 125, BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_TABSTOP))
$Pic1 = GUICtrlCreatePic((Random(Chr($i),Chr($i),1) & ".bmp"), 29, 20, 486, 358)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
 ;;;;;;;
    EndSelect
WEnd
Exit

????

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 546, 405, 192, 125, BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_TABSTOP))
$Pic1 = GUICtrlCreatePic((Random(chr(0),chr(255),1) & ".bmp"), 29, 20, 486, 358)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
  ;;;;;;;
    EndSelect
WEnd
Exit
Edited by slightly_abnormal

Share this post


Link to post
Share on other sites

Hi,

what about reading the filenames into an array and then random from 0 to Ubound(array)

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

what about reading the filenames into an array and then random from 0 to Ubound(array)

So long,

Mega

lol.. as you can see i'm not very good arrays.. can you show me how? :)

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