Jump to content
Sign in to follow this  
echrom

JPEG RELOAD

Recommended Posts

echrom

Hello I was wondering if any one would be kind to help me

I am helping my friends raise money for DOE and they have

made a photo-booth we use 2 screens ( beeing split from 1 computer)

So I had an idea to make a autoit program

to show a .JPEG file, and to have the picture change In the autoit program

by changing the picture from the folder

(for example autoit reads folder/picture.jpeg so I want be able to delete the picture.jpeg

and paste a new picture and rename It to picture.jpeg and then auto It reload the picture automatically every few seconds or when the picture changes)

MY PROBLEM IS

I need autoit to reload the picture every few seconds can some one help please

my script Is

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#AutoIt3Wrapper_run_debug_mode=Y

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Ivor Biggun\My Documents\Form1.kxf

$Form1 = GUICreate("Form1", 903, 644, 115, 59)

$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Ivor Biggun\My Documents\My Pictures\filsm\llun.jpg", 16, 8, 865, 625, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GuiCtrlSetGraphic ($pic1, $GUI_GR_REFRESH)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Share this post


Link to post
Share on other sites
enaiman

Try this:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#AutoIt3Wrapper_run_debug_mode=Y

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Ivor Biggun\My Documents\Form1.kxf
$Form1 = GUICreate("Form1", 903, 644, 115, 59)
GUISetOnEvent($GUI_EVENT_CLOSE, "XClose")
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Ivor Biggun\My Documents\My Pictures\filsm\llun.jpg", 16, 8, 865, 625, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GuiCtrlSetGraphic ($pic1, $GUI_GR_REFRESH)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###
While 1
    Sleep (1000)                            ;sleep 1 second
    GuiCtrlSetGraphic ($pic1, $GUI_GR_REFRESH);refresh the pic
WEnd

Func XClose()
    Exit
EndFunc

(changed to OnEventMode)


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
echrom

Try this:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#AutoIt3Wrapper_run_debug_mode=Y

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Ivor Biggun\My Documents\Form1.kxf
$Form1 = GUICreate("Form1", 903, 644, 115, 59)
GUISetOnEvent($GUI_EVENT_CLOSE, "XClose")
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Ivor Biggun\My Documents\My Pictures\filsm\llun.jpg", 16, 8, 865, 625, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GuiCtrlSetGraphic ($pic1, $GUI_GR_REFRESH)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###
While 1
    Sleep (1000)                        ;sleep 1 second
    GuiCtrlSetGraphic ($pic1, $GUI_GR_REFRESH);refresh the pic
WEnd

Func XClose()
    Exit
EndFunc

(changed to OnEventMode)

hey thank you for the replie and code i will try it when i go to school ( because i built it there )

Share this post


Link to post
Share on other sites
echrom

hey thanks for the code but it doesnt reload the pic at all any one else know how to do this i didnt think any 1 would find it hard

Share this post


Link to post
Share on other sites
rasim

echrom

Example:

#include <File.au3>

Dim $path = "c:\Pics"
Global $aPics = _FileListToArray($path, "*.gif", 1)
If @error Then Exit

Dim $count = 1

$hGUI = GUICreate("Relaod Image Example", 300, 200)

$pic = GUICtrlCreatePic($path & "\" & $aPics[1], 10, 10, 280, 180)

GUISetState()

AdlibEnable("_ReloadImg", 1000)

Do
Until GUIGetMsg() = -3

Func _ReloadImg()
    $count += 1
    If $count > $aPics[0] Then $count = 1
    GUICtrlSetImage($pic, $path & "\" & $aPics[$count])
EndFunc

Share this post


Link to post
Share on other sites
enaiman

hey thanks for the code but it doesnt reload the pic at all any one else know how to do this i didnt think any 1 would find it hard

It should reload the pic. In your first post you specified a file name; I assumed that you will be permanent changing the picture in that folder keeping the same name for it, the code was desined to do that.

If you have many more files there and you need to change the pic (different files) then you have to specify it muttley


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
echrom

It should reload the pic. In your first post you specified a file name; I assumed that you will be permanent changing the picture in that folder keeping the same name for it, the code was desined to do that.

If you have many more files there and you need to change the pic (different files) then you have to specify it :P

hey thanks but for some reason im having problems every time i change the picture in the directory (the same as specifed "with same name") it dosent change

if you close the program then reopen it it changed but the pointof the program is to leave it where it is and it will reload picture

SORRY FOR BEEING A NOOB im basicle a beginner at this

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  

×