cdjphoenix Posted September 10, 2012 Posted September 10, 2012 I am currently trying to add an jpg to the main screen on my GUI and have it be available after I compile and move the exe off to another computer. I have tried to add the jpg as a resource, #AutoIt3Wrapper_Res_File_Add=C:\LetterHead.jpg, and then called it with GUICtrlCreatePic("LetterHead.jpg", 0, 0,250, 50). This seems to work on the machine, after compiling the exe I can delete the original jpg and it will still show up. However once i transfer the exe to another machine it no longer shows up. I have tried to play around with FileInstall but for whatever reason I cannot get it to work. I have also tried to use the UDF at but it does not want to load resources.au3 when I put #include <resources.au3>. Ideally I would like to do this without adding a UDF but I am all out of ideas and would appreciate any help you guys can offer.-cdjphoenix-
UEZ Posted September 10, 2012 Posted September 10, 2012 You used it wrongly! Here the example from the resources.au3: #AutoIt3Wrapper_Res_File_Add=image3.jpg, rt_rcdata, TEST_JPG_1 #include "resources.au3" $gui = GUICreate("Data from resources simple example 1",400,150) $pic1 = GUICtrlCreatePic("",0,0,400,150) _ResourceSetImageToCtrl($pic1, "TEST_JPG_1") ; set JPG image to picture control from resource GUISetState(@SW_SHOW) While 1 If GUIGetMsg() = -3 Then Exit WEnd Further you can use FileInstall() to embedd and file to your exe but you have to extract the files first before you can use it. Another possibility is to embedd files as binary strings and use them directly from the memory without saving it to disk first. Examples can be found here: http://www.autoitscript.com/forum/index.php?showtopic=134350&view=findpost&p=936643 Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
cdjphoenix Posted September 11, 2012 Author Posted September 11, 2012 Thanks for the input, I finaly got the resources.au3 loading without crashing my script. I have made a couple changes in to the example script to try to get the image loaded but I have had no luck. Any idea on what I have managed to break here? #include <GUIConstantsEx.au3> #include <resources.au3> #AutoIt3Wrapper_Res_File_Add=C:LetterHead.jpg, rt_rcdata, TEST_JPG_1 $gui = GUICreate("Data from resources simple example 1",420, 300) $pic1 = GUICtrlCreatePic("",0,0,250,50) _ResourceSetImageToCtrl($pic1, "TEST_JPG_1") ; set JPG image to picture control from resource GUISetState(@SW_SHOW) While 1 If GUIGetMsg() = -3 Then Exit WEnd
UEZ Posted September 11, 2012 Posted September 11, 2012 Your modified code works for me. You have to compile the script and execute the exe afterwards to see the result. Of course the path to the image must be correct. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
cdjphoenix Posted September 11, 2012 Author Posted September 11, 2012 I have tried compiling it and have triple checked the path and no go yet. I'll play around with it and let you know if I figure out whats going on.
cdjphoenix Posted September 11, 2012 Author Posted September 11, 2012 Alright, I have it figured out. As it turns out you have to select Build rather than just right clicking and hit compile. I have one more question if you are feeling extra helpful today =). I have my image but it is massive and changing the settings in the script do not change it's size although it can change its location. Is there something I'm missing or should i just change its size in another program? Thanks Again -cdjphoenix-
UEZ Posted September 11, 2012 Posted September 11, 2012 Sorry, but I don't understand what you want to say! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
cdjphoenix Posted September 11, 2012 Author Posted September 11, 2012 Lets just leave it at Thanks then. I have it working and understand how do do it with other files. Thanks -cdjphoenix-
Moderators JLogan3o13 Posted September 11, 2012 Moderators Posted September 11, 2012 For what it is worth, I would use another program to change the size of the pic. Find your own happy medium between size and quality. I'm sure a quick Google search will turn up a myriad of programs that can do this for you. "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!
UEZ Posted September 11, 2012 Posted September 11, 2012 E.g. if you want to resize a pic, you can use GDI+ for it. There are plenty of examples how to resize an image and display it into your GUI. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now