Jump to content

Dynamic Picture


laphlaw
 Share

Recommended Posts

What would be the best way to dynamically update a picture within the GUI? Basically, I'll be taking a screenshot of a remote computer, and having it update every 5-10 seconds. So the picture will be pulled from the remote computer, and ideally automatically refreshed. how??

Link to comment
Share on other sites

What would be the best way to dynamically update a picture within the GUI? Basically, I'll be taking a screenshot of a remote computer, and having it update every 5-10 seconds. So the picture will be pulled from the remote computer, and ideally automatically refreshed. how??

Someone did this a while back, you'll find it in scripts and scraps, sorry don't remember which user it was.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Here's the code snippet I came up with, but I seem to have trouble the second I use a Default keyword in my udf. Any help with that would be greatly appreciated.

Otherwise, it correctly searches for files based upon the filetype you specify (*.*, *.pdf, *.jpg, *.gif, etc).

Func RandomFile($FileType = '*', $Directory = @WorkingDir)
    FileChangeDir(@WorkingDir)
    $Handle = FileFindFirstFile(@WorkingDir & '\' & $FileType)
    If $Handle = -1 Then Return 0
    Local $FileCount = 0, $aFiles[1], $cache
    While True
        $cache = FileFindNextFile($Handle)
        If @error then ExitLoop
        If StringInStr(FileGetAttrib($cache), 'd') then ContinueLoop
        Redim $aFiles[UBound($aFiles)+1]
        $aFiles[UBound($aFiles)-1] = @WorkingDir & '\' & $cache
        $FileCount += 1
    WEnd
    FileClose($Handle)
    Return $aFiles[Random(1, $FileCount, 1)]
EndFunc

While True
    MsgBox(0, "", RandomFile())
   ;MsgBox(0, "Test2", RandomFile(Default))
WEnd
Edited by MSLx Fanboy

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

I'm not sure if I made myself clear, but this isn't really what I'm asking for. Basically, I want a GUI that has a GUICtrlCreatePic. I will be pulling that image from a remote machine. The image on that machine will change every 5 seconds or so. So I need to dynamically update that picture in my GUI about the same time.

I was looking for a function such as GUICtrlCreatePicDelete (or something to that effect), but couldn't find it. When I do like an Adlibenable, and have it do a GUICtrlCreatePic every five seconds, there's a lot of flashing going on, and it doesn't delete the previous image... when it's flashing, you can see the previous image behind it.

Is there a better way to do this?

Link to comment
Share on other sites

I'm not sure if I made myself clear, but this isn't really what I'm asking for. Basically, I want a GUI that has a GUICtrlCreatePic. I will be pulling that image from a remote machine. The image on that machine will change every 5 seconds or so. So I need to dynamically update that picture in my GUI about the same time.

I was looking for a function such as GUICtrlCreatePicDelete (or something to that effect), but couldn't find it. When I do like an Adlibenable, and have it do a GUICtrlCreatePic every five seconds, there's a lot of flashing going on, and it doesn't delete the previous image... when it's flashing, you can see the previous image behind it.

Is there a better way to do this?

Use the following to call the function that loads your picture at $refresh interval:

AdlibEnable("_SomeFunction", $refresh)

And this will stop the refresh:

AdlibDisable()

Link to comment
Share on other sites

Use the following to call the function that loads your picture at $refresh interval:

AdlibEnable("_SomeFunction", $refresh)

And this will stop the refresh:

AdlibDisable()

that's exactly what my example does :)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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