Sign in to follow this  
Followers 0
StAbb

Using an online image in your GUI.

5 posts in this topic

I apologize if this question has already been answered, I think I might have seen it before, but I cant find it now. But I was wondering if there was any way I could use an image from online in my GUI. I mean I know I could use the Temp Internet Files, but is there any other way that is simpler? I was also wondering the most efficient way of grabbing an image offline. I mean if there is a way to just use the URL of the image in the GUI then whats the best way to grab the URL of a sepcific image, should I use _IEImgGetCollection or _IEGetObjById or should I just parse the URL from the HTML of the page? And if I cant use the direct URL, and I go the Temp Internet file route, what is the best solution for getting the file name of the image when saved, I am assuming I should just parse that from the URL of the image?

Sorry for all the questions, I'm just trying to grasp the full concept behind this specific action. Any help would be greatly appreciated. Thanks guys!

-Steve

Share this post


Link to post
Share on other sites



Look to the help file for "InetGet"


Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

maybe like this?

when using a picture control you will need to DL the file somehow..

#include <GUIConstants.au3>
#include <IE.au3>

$oIE = _IECreateEmbedded()

$gui = GUICreate("GUI", 853, 725, 193, 115)
$btn_Refresh_picture = GUICtrlCreateButton("refresh file", 576, 24, 75, 25, 0)
$btn_Refresh_picture_IE = GUICtrlCreateButton("refresh ie", 576, 64, 75, 25, 0)


; as a picture control
$image_pic = GUICtrlCreatePic("", 16, 424, 305, 265)
; as a IE "window"
GUICtrlCreateObj($oIE, 10, 10, 280, 180)

GUISetState(@SW_SHOW)





While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg

        Case $btn_Refresh_picture


            $url = "http://www.autoitscript.com/autoit3/files/graphics/autoit9_wall_thumb.jpg"
            InetGet($url, @ScriptDir & "\temp.jpg")


            GUICtrlSetImage($image_pic, @ScriptDir & "\temp.jpg")

        Case $btn_Refresh_picture_IE
            _IENavigate($oIE, "http://www.autoitscript.com/autoit3/files/graphics/autoit9_wall_thumb.jpg")

        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by nobbe

Share this post


Link to post
Share on other sites

Thanks for the reply guys, but yea I ended up realizing that I could just do the INetGet temporary file method. Thanks JMeyer and Nobbe.

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