Jump to content

Importing JPG to GUI


Recommended Posts

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!

Link to comment
Share on other sites

  • Moderators

@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?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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 = Win_10   Build = 19044   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.

Link to comment
Share on other sites

  • Moderators

@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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@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

Link to comment
Share on other sites

  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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