Moderators SmOke_N Posted August 26, 2007 Moderators Posted August 26, 2007 Doh!! This is brilliant Zedna! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Developers Jos Posted August 27, 2007 Developers Posted August 27, 2007 On what CPU clock? OK. no problem. Make only adding source files as resources thenand if in the future will be need for RES files adding then it could be added.I tested it on a WinXP SP2 with a Pentium duo core 1.9Ghz processor.I have no issues adding thing but they have to serve a purpose for the larger community. I really like the way you have figured this out and thinkits something people will use but I do want to avoid an overkill on Directives and confuse the hell out of people when telling them to use Rc.exe to create their own RES file.The folks like you that understand the whole proces can use the Run_After directives to perform those steps in the few occasion were it is useful.One more note: In Delphi there are resources added only as RES precompiled ones $R directive as: {$R filename.res} and I think in another languages this will be the same - so this will be also for more "compatibility" with other languagesThe fact is that this are AutoIt3Wrapper Directives and not AutoIt3, so it doesn't make sense to call it something else. Apart from that, the support in SciTE and AutoIt3 Lexers simply isn't there... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Zedna Posted August 27, 2007 Author Posted August 27, 2007 I have no issues adding thing but they have to serve a purpose for the larger community. I really like the way you have figured this out and thinkits something people will use but I do want to avoid an overkill on Directives and confuse the hell out of people when telling them to use Rc.exe to create their own RES file.The folks like you that understand the whole proces can use the Run_After directives to perform those steps in the few occasion were it is useful. I think about AutoIt as general purpose programming language therefore I suggested more general solution/directives for adding also precompiled RES files but you think about AutoIt as scripting language (for beginner scripters) only.That's different point of view OK.I agree.To add RES files can be used Run_After as you said and for AutoIt mainstream users will be your new #AutoIt3Wrapper directives good/sufficient. Resources UDF ResourcesEx UDF AutoIt Forum Search
Zedna Posted August 29, 2007 Author Posted August 29, 2007 (edited) I updated first post in this topic with all latest examples and UDF versions. From now I will keep updated first post with the most recent changes. TODO list: - support for resource types also as strings (now only numbers: $RT_BITMAP, $RT_RCDATA, ...) - add support for JPG,GIF,PNG to _ResourceSetImageToCtrl() (now only BMP) - make example for using _ResourceGetAsBytes() Edited August 29, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Zedna Posted September 4, 2007 Author Posted September 4, 2007 Updated first post: 2007-09-04 - added description at top of this topic - added _ResourceSaveToFile() - source is also example for using _ResourceGetAsBytes() - more error checking in UDF and error codes are now differrent to distinguish possible problem - default ResType = 10 ($RT_RCDATA) in all functions - updated ZIP archives (previous downloads: 8+7) Resources UDF ResourcesEx UDF AutoIt Forum Search
Zedna Posted September 5, 2007 Author Posted September 5, 2007 Updated first post: 2007-09-05 - in #AutoIt3Wrapper_run_after=ResHacker.exe -add ... directive can be resource type in text form --> rcdata instead of 10, bitmap instead of 2 and so on (note: but for html must be used 23 still) - updated only resource_test.au3 in resource_au3.zip Resources UDF ResourcesEx UDF AutoIt Forum Search
smashly Posted September 10, 2007 Posted September 10, 2007 Thank you zedna, I tried your udf on a project I was working on for someone else and it works great. The only thing I supplemented was I used compression as -9 as opposed to using the no compression of resources. Since I was only using bmp as resources all works great. 0 compress on resources was around 200KB smaller on a 1.5MB exe, -9 on resource was around 1.3MB smaller on the same 1.5mb exe Thought there might be some sort of trade off or failure, but I really couldn't notice it if there was performance trade off , and definately no failure.... All good. Once again thank you for your efforts. Cheers.
Zedna Posted September 10, 2007 Author Posted September 10, 2007 Thank you zedna,I tried your udf on a project I was working on for someone else and it works great.The only thing I supplemented was I used compression as -9 as opposed to using the no compression of resources.Since I was only using bmp as resources all works great. 0 compress on resources was around 200KB smaller on a 1.5MB exe,-9 on resource was around 1.3MB smaller on the same 1.5mb exeThought there might be some sort of trade off or failure, but I really couldn't notice it if there was performance trade off , and definately no failure.... All good.Once again thank you for your efforts.Cheers.Thanks for positive feedback I'm glad it works fine for you and others.I will update my examples to use new AutoIt3Wrapper "res_file_add" directive in next few days so stay tuned ...About compression, thanks for your informations, this was already disccused in this topic and I'm not so experienced with this if there are some possible problems, so I can't help much in this area. Also in future when will be added JPG/GIF/PNG support with Auto3Lib and its GDI+ will be resources compression minor problem. Resources UDF ResourcesEx UDF AutoIt Forum Search
Zedna Posted September 11, 2007 Author Posted September 11, 2007 (edited) Updated first post: 2007-09-11 - in examples used new AutoIt3Wrapper directive #AutoIt3Wrapper_Res_File_Add from latest Scite4AutoIt3 (instead of #AutoIt3Wrapper_run_after=ResHacker.exe -add ...) - updated resource_test.au3 and resource_test_ie.au3 in resource_au3.zip instead of previous: #AutoIt3Wrapper_useupx=n #AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, test_1.txt, rcdata, TEST_TXT_1, 0 #AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, image1.bmp, bitmap, TEST_BMP_1, 0 #AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, image2.bmp, bitmap, TEST_BMP_2, 0 #AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, binary1.dat, rcdata, TEST_BIN_1, 0 #AutoIt3Wrapper_run_after=upx.exe --compress-resources=0 "%out%" is now used: #AutoIt3Wrapper_Res_File_Add=test_1.txt, rcdata, TEST_TXT_1 #AutoIt3Wrapper_Res_File_Add=image1.bmp, bitmap, TEST_BMP_1 #AutoIt3Wrapper_Res_File_Add=image2.bmp, bitmap, TEST_BMP_2 #AutoIt3Wrapper_Res_File_Add=binary1.dat, rcdata, TEST_BIN_1 Edited September 11, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
RazerM Posted September 12, 2007 Posted September 12, 2007 This is very good, it's so easy to use now My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
smashly Posted September 14, 2007 Posted September 14, 2007 (edited) Thank You once again Zedna, nice work with the update Suggestion:Another optional parameter added to the _ResourceSaveToFile($FileName, $ResName, $ResType = 10, $ResLang = 0, $CreatePath = 0) function ..If $CreatePath = 1 and save path doesn't exist , then create it..I'm enjoying this udf as is though ..Cheers. Edited September 14, 2007 by smashly
Zedna Posted September 14, 2007 Author Posted September 14, 2007 (edited) Thank You once again Zedna, nice work with the update Suggestion:Another optional parameter added to the _ResourceSaveToFile($FileName, $ResName, $ResType = 10, $ResLang = 0, $CreatePath = 0) function ..If $CreatePath = 1 and save path doesn't exist , then create it..I'm enjoying this udf as is though ..Cheers.Sorry I don't think one DirCreate() with some "extract dir from full path" logic will be nice in resource UDF.I will think about this idea more and maybe I will add it. Thanks for feedback and ideas.EDIT: I will add it, it's very simple with mode=8 in AutoIt's FileOpen() function Edited September 14, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Zedna Posted September 14, 2007 Author Posted September 14, 2007 Thank You once again Zedna, nice work with the update Suggestion:Another optional parameter added to the _ResourceSaveToFile($FileName, $ResName, $ResType = 10, $ResLang = 0, $CreatePath = 0) function ..If $CreatePath = 1 and save path doesn't exist , then create it..I'm enjoying this udf as is though ..Cheers. Updated first post 2007-09-14 - added optional parameter $CreatePath in _ResourceSaveToFile() - updated resource_test.au3 and resource.au3 in resource_au3.zip Resources UDF ResourcesEx UDF AutoIt Forum Search
shea851 Posted September 14, 2007 Posted September 14, 2007 (edited) Edit - sorry wrong forum. Edited September 14, 2007 by shea851
Zedna Posted September 19, 2007 Author Posted September 19, 2007 (edited) When will that be?This is done already. See first post and read all informations carefully (also notes, history and TODO list).Also, Zedna, I wish to add a jpg image(still not supported), an mp3 file, a HTML file and a .exe file.I'm sorry but I don't really know how to work with the script you contributed.Please help on how to implement it.(Yes, I do know this is not a General Support Forum). We can continues this HERE if you want to.Thank you. No problem to post/discuss this here.But first look here I have no time to play with this now.So you can get rough concept from my post and finish it yourself if you need quick solution.Or maybe somebody else can make it quick.Some notes:- add any data to compiled EXE is not problem but use some of them directly from resources could be problem for basic types I did my UDF but for mp3 for example I don't know simple solution: maybe use in your COM player address begining with res:// as in my second example I did for HTML resource. This must be tested.- using HTML from resource is done already in my second example- EXE/DLL files can't be executed directly from memory/resource as far as I know, so you must save them to disk firstFeel free to post your questions.I will help you if I can. Edited September 19, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
TK_Incorperate Posted September 26, 2007 Posted September 26, 2007 (edited) I get this error. Title: "Invalid Compiler directive" Error: "Keyword:#AutoIt3Wrapper_Res_File_Add Value:Set1.bmp, bitmap, TEST_BMP_1" Edit: Also, when I click OK from that error, I get this one. "C:\Program Files\AutoIt3\Include\resources.au3(14,30) : ERROR: syntax error Global Const $RT_VERSION = 16Global ~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\Include\resources.au3(17,31) : ERROR: syntax error Global Const $RT_MANIFEST = 24Func ~~~~~~~~~~~~~~~~~~~~~^ C:\TKProgs\D2 Funcs\test others\Trans.au3 - 2 error(s), 0 warning(s)" Edited September 26, 2007 by TK_Incorperate
smashly Posted September 27, 2007 Posted September 27, 2007 Thank you Zedna for the path option in your _ResourceSaveToFile function, works like a charm I get this error.Title: "Invalid Compiler directive"Error: "Keyword:#AutoIt3Wrapper_Res_File_AddValue:Set1.bmp, bitmap, TEST_BMP_1"Edit: Also, when I click OK from that error, I get this one."C:\Program Files\AutoIt3\Include\resources.au3(14,30) : ERROR: syntax errorGlobal Const $RT_VERSION = 16Global~~~~~~~~~~~~~~~~~~~~^C:\Program Files\AutoIt3\Include\resources.au3(17,31) : ERROR: syntax errorGlobal Const $RT_MANIFEST = 24Func~~~~~~~~~~~~~~~~~~~~~^C:\TKProgs\D2 Funcs\test others\Trans.au3 - 2 error(s), 0 warning(s)"Are you using Scite 9-Sep-07 to compileTo me your errors look like a case of word wrap...Cheers
Zedna Posted September 27, 2007 Author Posted September 27, 2007 I get this error.Title: "Invalid Compiler directive"Error: "Keyword:#AutoIt3Wrapper_Res_File_AddValue:Set1.bmp, bitmap, TEST_BMP_1"As smashly said.Read carefully my first post:Notes:* to compile all script examples you must have installed latest Scite4AutoIt3 (2007-09-09) also with reshacker.exe in AutoIt3Wrapper directory@smashly: Thanks for your idea for improving my UDF :-) Resources UDF ResourcesEx UDF AutoIt Forum Search
arcker Posted October 4, 2007 Posted October 4, 2007 how do you do to use RT_GROUP_ICON ? i attemp to read this from another Exe but i always get the error 3. i really don't understand those GROUP_ICON. The ID is retrieve from the registry defaulticon for *.ppt. expandcollapse popup$IconPath = "C:\WINDOWS\Installer\{0000040C-78E1-11D2-B60F-006097C998E7}\pptico.exe" $IconID = 4 _API_LoadLibrary($IconPath) _ResourceGet(1,$RT_GROUP_ICON,0,$IconPath) ConsoleWrite(@error) Func _ResourceGet($ResName, $ResType = 10, $ResLang = 0,$Res_Exe = 0) ; $RT_RCDATA = 10 Local Const $IMAGE_BITMAP = 0 Local $hInstance, $hBitmap, $InfoBlock, $GlobalMemoryBlock, $MemoryPointer, $ResSize $hInstance = DllCall("kernel32.dll", "int", "GetModuleHandleA", "int", $Res_Exe) $hInstance = $hInstance[0] If $ResType = $RT_BITMAP Then $hBitmap = DllCall("user32.dll", "hwnd", "LoadImage", "hwnd", $hInstance, "str", $ResName, _ "int", $IMAGE_BITMAP, "int", 0, "int", 0, "int", 0) If @error Then Return SetError(1, 0, 0) $hBitmap = $hBitmap[0] Return $hBitmap ; returns handle to Bitmap EndIf If $ResLang <> 0 Then $InfoBlock = DllCall("kernel32.dll", "int", "FindResourceExA", "int", $hInstance, "str", $ResName, "long", $ResType, "short", $ResLang) Else $InfoBlock = DllCall("kernel32.dll", "int", "FindResourceA", "int", $hInstance, "str", $ResName, "long", $ResType) EndIf If @error Then Return SetError(2, 0, 0) $InfoBlock = $InfoBlock[0] If $InfoBlock = 0 Then Return SetError(3, 0, 0) $ResSize = DllCall("kernel32.dll", "dword", "SizeofResource", "int", $hInstance, "int", $InfoBlock) If @error Then Return SetError(4, 0, 0) $ResSize = $ResSize[0] If $ResSize = 0 Then Return SetError(5, 0, 0) $GlobalMemoryBlock = DllCall("kernel32.dll", "int", "LoadResource", "int", $hInstance, "int", $InfoBlock) If @error Then Return SetError(6, 0, 0) $GlobalMemoryBlock = $GlobalMemoryBlock[0] If $GlobalMemoryBlock = 0 Then Return SetError(7, 0, 0) $MemoryPointer = DllCall("kernel32.dll", "int", "LockResource", "int", $GlobalMemoryBlock) If @error Then Return SetError(8, 0, 0) $MemoryPointer = $MemoryPointer[0] If $MemoryPointer = 0 Then Return SetError(9, 0, 0) SetExtended($ResSize) Return $MemoryPointer EndFunc -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Zedna Posted October 4, 2007 Author Posted October 4, 2007 (edited) how do you do to use RT_GROUP_ICON ?i attemp to read this from another Exe but i always get the error 3.i really don't understand those GROUP_ICON. The ID is retrieve from the registry defaulticon for *.ppt.I have so bad ill that I can't stay at computer too long I must lay in my bed and cure myself.I will look at it later ...Your code looks good at first look.Post pptico.exe so I can try something. Edited October 4, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
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