Jump to content
FernanS1

Importing JPG to GUI

Recommended Posts

FernanS1

Hey guys,

Pretty new to AutoIT (a couple days now), but familiar enough to have been perusing the forums trying to find an answer to my issue, to no avail. All I'm trying to do is import a small JPG onto a GUI I made, but for some reason it is not displaying on the GUI, and I'm not sure why. I have checked the GUICtrlCreatePic Documentation repeatedly and I'm not sure what I'm doing wrong, an explanation would be awesome!

Capture.PNG.b981c518c277c1c7bf57adc1f79d4b6d.PNGimage.png.5462434a02ee2af26003b0d5435c00db.png

Thanks so much!

Share this post


Link to post
Share on other sites
JLogan3o13

@FernanS1 welcome to the forum. In the future, please use the code brackets <> to post code. Pictures are for Facebook, and you generally guarantee yourself very little help when you force people to re-type your script.

That said, I cannot reproduce your issue. This code works just fine for me:

#include <IE.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEX.au3>
#include <WindowsConstants.au3>

$Start_X = 0
$Start_Y = 0

Local $userGUI = GUICreate("Service Engineering Information Input", 350, 440)
Local $image = GUICtrlCreatePic(@DesktopDir & "\convention.jpg", 0, 0, 100, 100)
GUICtrlSetPos($image, 50, 50, 200, 100)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

It appears from your screenshot the file is being blocked. If you click the Unblock button, does it work then?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Simpel

Hi.

There are some functions in AutoIt that don't like spaces inside pathes and file names. Possibly this one too? Try to change the name of the jpg to „Logo_Transparent.jpg“.

Regards, Conrad


SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites
JLogan3o13

@Simpel perhaps try your suggestions before posting, rather than leading the OP on a wild goose chase. Spaces are fine as long as you enclose them correctly:

#include <IE.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEX.au3>
#include <WindowsConstants.au3>

$Start_X = 0
$Start_Y = 0

Local $userGUI = GUICreate("Service Engineering Information Input", 350, 440)
Local $image = GUICtrlCreatePic(@DesktopDir & "\Really long name with lots of spaces.jpg", 0, 0, 100, 100)
GUICtrlSetPos($image, 50, 50, 200, 100)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

...works just fine.

1.png.05d30c5821397128b554fb6138b8d2d2.png


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
FernanS1

@JLogan3o13 I realize what I did wrong. I downloaded a .png file and changed the file extension to a .jpg by renaming it. When I took that same file and converted it to a .jpg via an online converter, it had no issues showing up.

Thank you for your help, I really appreciate it! If you have a link for "Forum Etiquette" I would love to look at it, as I see myself having more questions in the future and don't want to irritate anyone!

Thanks,

Shawn

Share this post


Link to post
Share on other sites
JLogan3o13

@FernanS1 probably your best bet is the forum rules page. This page shows the Do's and Don'ts of posting on the forum.

In addition, the general FAQ on the Wiki shows answers to the most oft-asked questions. You may find some direction here for your issue without having to post a question:

https://www.autoitscript.com/wiki/FAQ

Finally, when all else fails, common sense reigns supreme - we (try to) operate on the "think before you type" motto. :) 

Look forward to your future contributions.


√-1 2^3 ∑ π, and it was delicious!

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

×