Zedna

Resources UDF

643 posts in this topic

It would be sufficient if you read only whole first post (#1) in this topic :-)

I understood from your first post that I can add text files to the EXE but it wasn't clear to me whether I could let the EXE interact with the text file in the same way that a script might interact with an external text file. I wrote the other post after I wrote this one. Thanks for your answer in that other thread.

Share this post


Link to post
Share on other sites



Embedding AVI into the resource.

This is probably already common knowledge, and doesn't really having anything to do with Zednas resource script as such but it was along the same lines and I used this method along with Zednas Resource UDF to add the background images etc.. it so thought I'd share it for those that don't know.

The Issue:

I was hoping to have animation embedded into my gui, although Gifs are great, it appears they cannot be above another image, for example a background image. Hoping to embed several animations into the executable, using Zednas resources UDF I found I had to break the background image into separate sections and rebuild the Gif with a part of the background image for it to work correctly. Although this method worked it was a pain to control the Gif Image for example Hiding and Showing the control. AVI's don't appear to have these issues, although AVIs are larger than Gifs, so the file will be slightly larger, but for my animations it was like 10kb bigger. So using the same context as adding image resources and then calling the avi(s) from the excutable worked like a charm.

For example

#AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%,%out%,%scriptdir%\Resources\AVI_Ani1.avi,avi,101,0
#AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%,%out%,%scriptdir%\Resources\AVI_Ani2.avi,avi,102,0

...
GUICtrlCreateAvi(@ScriptFullPath,101,20,20,15,15,$ACS_AUTOPLAY+$ACS_TIMER)
GUICtrlCreateAvi(@ScriptFullPath,102,40,20,15,15,$ACS_AUTOPLAY+$ACS_TIMER)
...

Hope that helps someone.

Cheers

Share this post


Link to post
Share on other sites

Not working for me...


Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.

Share this post


Link to post
Share on other sites

Info on my problem is here.


Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.

Share this post


Link to post
Share on other sites

#387 ·  Posted (edited)

Well, nearly a year since I last replied...

@Yashied, That was the only thing I was going to post about today but find it's already fixed - thanks for that!

@Melba23, Thanks again for the improvements...

@WebRaider, use Eval() to build variable names on-the-fly and have them evaluated/substituted at once e.g:

Local $myvar = "Hello World!"
ConsoleWrite(Eval("my" & "var") & @CRLF) ; Outputs "Hello World!" to STDOUT

So _ResourceSetImageToCtrl($Block[$bCountX][$bCountY],Eval(Picture[$rd])) should work.... never tried it but I def. will have to one day.

@leuce, it can easily do what you want although nothing stops other users from exploring your EXE with ResHacker to take the file! If that's a concern you could write custom (de)obfuscation or (d)ecryption code, and/or pack the Gold release with something better than UPX.

@Zedna, my miniature idol embued with your glorious brilliance in mad skripting skillz sends his regards.

Edited by DanielC

Share this post


Link to post
Share on other sites

#388 ·  Posted (edited)

does anyone have any examples of how to add a .exe file as a resource??

There is a solution for executing EXE directly from memory (or resources) but it's not simple.

Look at "Run binary (executing from memory)" example from trancexx

http://www.autoitscript.com/forum/index....owtopic=99412&st=0&p=713513&#entry713513

Just to be complete, there is also solution for calling DLL functions from memrory (or resources)

Embed DLLs in script and call functions from memory - Pure AutoIt script (Now worked under Vista) from Ward

#560708

***

Later I will add these links also to my first post.

EDIT: fixed broken links

Edited by Zedna

Share this post


Link to post
Share on other sites

All,

I'm having a problem with a script I'm currently writing and so I was hoping someone here could help.

I have GIF resource, which must be a GIF due to transparency (no, I'm not messing with PNG):

#AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, res\tweetBird.gif, rcdata, TWEET_GIF_1, 0

I'm also using a slightly modified version of Melba23's Toast UDF. I changed line 406:

If $iIcon_Reduction Then GUICtrlCreateIcon($sDLL, $iIcon_Style, 10, 10 + $iTitle_Height)

to:

If $iIcon_Reduction Then GUICtrlCreatePic($iIcon_Style, 10, 10 + $iTitle_Height)

So that I could use the GIF resource.

For my script I also made a little function to prep and create the toast window:

Func _Toast($ioMsg)
    Local $aColor[3] = [0x97D9F5, 0xe9eff5, False]
    _Toast_Set(0, $aColor, 0x000000, 0xe9eff5, 0x000000, 11, "Arial")
    $aRet = _Toast_Show(_ResourceGet("TWEET_GIF_1"), $strAppName, $ioMsg, 5)
    _Toast_Hide()
EndFunc

My problem is setting the icon in the _Toast_Show() function. I've tried all different combinations trying to get the data from the resource into the control but alas no luck.

So, could anyone please show me how to get the image file into the picture control without using _ResourceSetImageToCtrl() as that would require more editing of the Toast UDF.

Thanks,

James

Share this post


Link to post
Share on other sites

James,

Pop over to the Toast topic and I have a solution for you with only a very slight modification to the Toast UDF itself - which does not break any other Toast functionality.

It does use _ResourceSetImageToCtrl from Zedna's Resources UDF, but I am not reinventing that particular wheel today!

Hope to see you there! :D

M23


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

#392 ·  Posted (edited)

Melba,

Thank you very much for taking the time to add this! I was hoping there would have been a simpler way, but as it's fixed, thanks!

Edit: Where is the solution? Or is it not posted quite yet? If I know I must use the SetImageToCtrl() function, I could probably go about this myself.

James

Edited by JamesBrooks

Share this post


Link to post
Share on other sites

#393 ·  Posted (edited)

Been trying to use this UDF for awhile, but i can't seem to get it to work. But i don't think there's any problem with my code. cause not even the examples runs. Probably missed something.

To run the examples. Iv'e downloaded and extracted the resource files, the data files. And compiled using SciTE4AutoIt3. Any one that know what i've could missed?

EDIT: Spelling

Edited by PhilipG

Share this post


Link to post
Share on other sites

#394 ·  Posted (edited)

Been trying to use this UDF for awhile, but i can't seem to get it to work. But i don't think there's any problem with my code. cause not even the examples runs. Probably missed something.

To run the examples. Iv'e downloaded and extracted the resource files, the data files. And compiled using SciTE4AutoIt3. Any one that know what i've could missed?

Reread whole first post, especially

Notes:

* to compile all script examples you must have installed Scite4AutoIt3 also with reshacker.exe/upx.exe in "Windows search path" or script directory -> you must compile script by F7 from full Scite

...

Also what Autoit/Scite4Autoit3 version do you have?

What OS? I didn't test my UDF on Vista or Win7

Firstly try minimal example resource_test_min1.au3

Edited by Zedna

Share this post


Link to post
Share on other sites

Reread whole first post, especially

Notes:

* to compile all script examples you must have installed Scite4AutoIt3 also with reshacker.exe/upx.exe in "Windows search path" or script directory -> you must compile script by F7 from full Scite

...

Also what Autoit/Scite4Autoit3 version do you have?

What OS? I didn't test my UDF on Vista or Win7

Firstly try minimal example resource_test_min1.au3

I tried that small one. But i think i'm missing Reshacker, where do i find it?

Share this post


Link to post
Share on other sites

i found reshacker and placed it in the script dir. Still not working though...

I'm using win xp. autoit v3.3.0.0

Share this post


Link to post
Share on other sites

#398 ·  Posted (edited)

i found reshacker and placed it in the script dir. Still not working though...

I'm using win xp. autoit v3.3.0.0

Try to put reshacker to directory which is included in "Windows search path"

or into Autoit3Wrapper directory:

"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\"

Edited by Zedna

Share this post


Link to post
Share on other sites

Tried that, still no success...

Share this post


Link to post
Share on other sites

#400 ·  Posted (edited)

Tried that, still no success...

Then what exactly is your problem?

Try to look at your compiled EXE by reshacker if resources are there or not.

Also try to use absolute path to reshacker in #AutoIt3Wrapper_run_after=ResHacker.exe -add ...

Edited by Zedna

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