Jump to content

Resources UDF


Zedna
 Share

Recommended Posts

  • 3 weeks later...
  • 4 weeks later...

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
Link to comment
Share on other sites

  • 4 weeks later...

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
Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
Share on other sites

  • Moderators

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

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

Open spoiler to see 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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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?

Link to comment
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

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