Sign in to follow this  
Followers 0
Andrew Peacock

Resource files help

5 posts in this topic

Hi all,

I'm trying to bundle a couple of files into an .exe - one .ico file and one .png file

To compile the files, I think I need to do something like:

#AutoIt3Wrapper_Res_Icon_Add=c:\path\to\icon\on\build\machine\file.ico
#AutoIt3Wrapper_Res_Icon_Add=c:\path\to\icon\on\build\machine\file.png

But how do I reference those files in the actual script itself?

Regards,

Andy

Share this post


Link to post
Share on other sites



Have a look in the SciTE4AutoIt3 helpfile that comes with that installer package.

You will find an example in the Helppage on AutoIt3Wrapper.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Have a look in the SciTE4AutoIt3 helpfile that comes with that installer package.

You will find an example in the Helppage on AutoIt3Wrapper.

Jos

Hi Jos,

Been there, done that, but thanks for suggesting it. I found out by trial and error that part of the problem is I'm trying to include PNG. That just crashes the compiler. But if I take that out, and then use TraySetIcon() without an index, that seems to pull the one icon I'm including in this program. So far, so good.

It's the PNG that's got me thrown - how do I add that without breaking the compiler, and then reference it. The sample code that I've got BEFORE trying to use resources is:

#include <_Icons.au3>

; Add the on-gui icon
$filePng = @scriptdir & "\forumsaver.png"
$picIcon = GUICtrlCreatePic('', 300, 50, 64, 64)
_SetImage($picIcon, $filePng)

But I'm now stumped on how to include the PNG.

I tried running the resource hacker au3 script which is popular here. It asked for the script that I wanted to hack, and then it just ran that script. So nothing useful came out of that.

Andy

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Andrew Peacock,

Part of the problem may be because you trying to use #AutoIt3Wrapper_Res_Icon_Add to load a .png! If you were to use #AutoIt3Wrapper_Res_File_Add you might have more luck. :(

One small word of warning - just ignore the optional elements of the directive "Filename[,Section [,ResName]] to be added". Autoit3Wrapper only stores things in the RC_DATA resource area and numbers them consecutively. So your .png will be known as "1" regardless. Jos did a wonderful job of getting the resource load into Autoit3Wrapper but that bit did not work properly - but he knows we are grateful for the rest!

Personally, for that and some other reasons, I tend to use Zedna's wonderful Resources.au3. The UDF can be found here, but do pay close attention to the examples - play around with them until you understand how the UDF works. Once you have it mastered it is very powerful.

UDF syntax runs like this:

1. Get the resource in: #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, file_name, rcdata, MY_PIC, 0

2. Create the pic control: $Pic = GUICtrlCreatePic("", 10, 200, 25, 25)

3. Show resouce: _ResourceSetImageToCtrl($Pic, "MY_PIC")

Cannot get much easier than that!

Try it out and see how you get on. The topic is long, I know, but crammed with good tips on how to get the best from it - well worth the effort of learning how to use it properly. Good luck!

M23

Edit: Speeling as ever >_<

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi Melba,

Sorry, I didn't get back to say thanks.

So... Thanks! I got it working with your guidance,

Regards,

Andy

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