cshorey Posted July 3, 2007 Posted July 3, 2007 Ok so I guess I can't figure this out. Maybe I am over looking something obvious. I want to embed a logo image in my executable. I converted it from a transparent jpeg to an icon and am using #AutoIt3Wrapper_Res_Icon_Add to add it in at compile time. With reshacker I can see the resource. But what I guess I don't know or can't figure out is how to then use this compiled resource in my script. Here is the sample code I wrote:#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Icon_Add=E:\~ Personal\Development\Scripting\DoD Source Match Calculator\Images\logo.ico #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** ;Include items #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=c:\program files\autoit3\koda_1.6.0.2\forms\source calc.kxf $SourceCalc = GUICreate("DoD:S Match Calculator", 337, 267, 241, 175) $Quit = GUICtrlCreateButton("Quit", 208, 216, 123, 25, 0) If @Compiled = 1 Then GUICtrlCreateIcon(@ScriptFullPath, 50, 208, 8, 124, 76) Else GUICtrlCreateIcon("..\Images\logo.ico", 50, 208, 8, 124, 76) EndIf GUISetState(@SW_SHOW,$SourceCalc) #EndRegion ### END Koda GUI section ### ;Main Application While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Quit Exit EndSwitch WEnd ExitAs you can see I have my logo icon being added with #AutoIt3Wrapper_Res_Icon_Add=E:\~ Personal\Development\Scripting\DoD Source Match Calculator\Images\logo.ico.I think used reshacker to see what the number the resource was given (here is where I am guessing). It is 50 so I used it and when compiling the script it doesn't show up. I have also tried most of the single digit numbers and a few negatives to see if I stumble on my icon which I have not. Could someone clue me in here on how this works.Here is my reshacker screencap:This is what my program should look like:This is what it looks like after compiling:Also I have spent the last week searching the forums for help and haven't found anything to solve my issues. Though I have found every questions I have had answered via searching the forums so far. I am also new to scripting in AutoIt and this is my first real in depth script I have attempted (previously I had been scripting in a different language, but am converting over).Thanks for any and all help.chris ...
Zedna Posted July 3, 2007 Posted July 3, 2007 Look at Scite4Autoit3 Documentation or Ctrl+F1 in Scite - section AutoIt3WrapperBTW: What software did you used for HPEG --> ICO conversion? I know about IrfanView. Resources UDF ResourcesEx UDF AutoIt Forum Search
cshorey Posted July 3, 2007 Author Posted July 3, 2007 Ah I am an idiot... I even read that like 3 times figuring it had to be in there. ;Add extra ICO files to the resources which can be used with TraySetIcon(@ScriptFullPath, 3) etc ; list of filename of the Ico files to be added, First one will have number 3, then 4 ..etc But I updated my code to be the following and after compiling I still don't see it. Did I miss something else? Here is the updated code segment: #Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Icon_Add=E:\~ Personal\Development\Scripting\DoD Source Match Calculator\Images\logo.ico #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** ;Include items #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=c:\program files\autoit3\koda_1.6.0.2\forms\source calc.kxf $SourceCalc = GUICreate("DoD:S Match Calculator", 337, 267, 241, 175) $Quit = GUICtrlCreateButton("Quit", 208, 216, 123, 25, 0) If @Compiled = 1 Then GUICtrlCreateIcon(@ScriptFullPath, 3, 208, 8, 124, 76) Else GUICtrlCreateIcon("..\Images\logo.ico", 3, 208, 8, 124, 76) EndIf GUISetState(@SW_SHOW,$SourceCalc) #EndRegion ### END Koda GUI section ### ;Main Application While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Quit Exit EndSwitch WEnd Exit As for my icon, I created the logo in Photoshop so I didn't convert the GIF to an icon I actually converted the original PSD to an icon. I used GIF Movie Gear to do it. chris ...
SpookMeister Posted July 3, 2007 Posted July 3, 2007 Just a quick thought.. have you tried shortening the path to the files you are referencing? I don't like the look of the path to your ico [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]
cshorey Posted July 3, 2007 Author Posted July 3, 2007 Just a quick thought.. have you tried shortening the path to the files you are referencing? I don't like the look of the path to your icoI got an error when I provided the following path and it wouldn't compile the resource in when I used this "..\Images\logo.ico"Also changing it to this "#AutoIt3Wrapper_Res_Icon_Add=C:\logo.ico" did fix the issue. Also I am fairly sure the path isn't an issue as I can use reshacker to see icon resource as demonstrated above in the reshacker screen shot.I did try it, so thanks for the suggestion. chrisPS - Thanks Zedna for the link to the documentation and the kick in the butt to go read it again. ...
Developers Jos Posted July 3, 2007 Developers Posted July 3, 2007 Have you tried if the ICO file you created works by using it as seperate file ? 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.
cshorey Posted July 3, 2007 Author Posted July 3, 2007 Have you tried if the ICO file you created works by using it as seperate file ? Do you mean using it like this? GUICtrlCreateIcon("..\Images\logo.ico", 3, 208, 8, 124, 76) This works without issue. But you bring up a good point. I should try loading in a different icon file as a test to see if I can get that to load at compile time. thanks for the suggestion. If I didn't get your suggestion correctly feel free correct me so I understand what you are suggesting. chris ...
Zedna Posted July 3, 2007 Posted July 3, 2007 instead of: GUICtrlCreateIcon(@ScriptFullPath, 3, 208, 8, 124, 76)oÝ÷ ÚÚòjëh×6GUICtrlCreateIcon(@ScriptFullPath, -4, 208, 8, 124, 76) HelpFile: GUICtrlCreateIcon Passing a positive number will reference the string equivalent icon name. Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted just with negative numbers. Resources UDF ResourcesEx UDF AutoIt Forum Search
cshorey Posted July 3, 2007 Author Posted July 3, 2007 Zedna you rock! That worked, well kinda. Looks like crap but something showed up. I will look into why it looks like crap Thursday. I will re-read that quote but I guess I am a little confused by the difference in the positive and negative 1-base reference. But I don't need to understand everything as long as it works. Another problem down, a new one to solve.Thanks again for the helpchris ...
duckling78 Posted November 6, 2008 Posted November 6, 2008 Sorry to resurrect a dead thread, but this got me confused for a couple of hours too trying to get TraySetIcon working.I'm pretty sure most people trying to use this function will also encounter some confusion when trying to reference their icons.The negative number thing doesn't really seem to be all that apparent and a lot of people will miss that reference in the "Remarks".Passing a positive number will reference the string equivalent icon name.Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted just with negative numbers.
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