quagmire1973 Posted July 7, 2008 Posted July 7, 2008 I've seen a few posts about embedding EXE and BMP files into AutoIT scripts but I want to embed the icon file I am using for command buttons into the EXE so that I do not need to have the ICO files on the machine. My script, once compiled, will contain everything it needs so if I move it to a different folder where the ICO files aren't located, they still show up in my GUI screen. Any suggestions/help?
walle Posted July 7, 2008 Posted July 7, 2008 Take a look http://www.autoitscript.com/forum/index.ph...%20hex&st=0Quote: Glad you liked it, i convert the picture data to binary code using a hex editor and than i call this lineCODEFileWrite(@TempDir & "\chip.jpg", Binary($pic))to create the picture. Take a look in the beginning of the script at local $pic. I'm declaring the binary code there, it may look a little complicated but it's simillair to FileInstall. Check the help file for more info.as for the first problem i have spended only 10 minutes to convert and create the script since i'm not a Dll guru so errors might occur.Convert picture:$file = FileOpenDialog('Open the image file', @ScriptDir, 'image (*.jpg;*.bmp;*gif;*.png)', 1) $file2 = FileSaveDialog('Save the file', @ScriptDir, 'script (*.au3)') _CheckExt($file2, 'au3') $var = InputBox('Name variable', 'Prompt the name variable used', '$pic') _CheckCapital($var, '$') $hfile = FileOpen($file, 16) $hfile2 = FileOpen($file2, 2) FileWrite($hfile2, $var&'="0x"' & @CRLF) While 1 $data = FileRead($hfile, 30) If @error Then ExitLoop FileWrite($hfile2, $var&'&="' & StringTrimLeft($data,2) & '"' & @CRLF) WEnd MsgBox(0, 'Done!!', 'Done by Fabry!!!') Func _CheckExt(ByRef $s_file, $s_ext) If StringRight($s_file, StringLen($s_ext)) <> $s_ext Then $s_file &= '.' & $s_ext EndFunc ;==>_CheckExt Func _CheckCapital(ByRef $s_file, $s_cap) If StringLeft($s_file, StringLen($s_cap)) <> $s_cap Then $s_file = $s_cap & $s_file EndFunc ;==>_CheckExt
quagmire1973 Posted July 7, 2008 Author Posted July 7, 2008 I don't want to create a picture, I simply want to embed the icon within my compiled exe. Currently, I'm just using $play = GUICtrlCreateButton( "Play", 1, 1, 48, 48, $BS_BITMAP) GUICtrlSetImage($play, "play.bmp", 0) but if "play.bmp" doesn't exist, the icon on the button is empty. I want to be able to reference that image no matter where I am, and I do not want to have extra files that are associated with the application. I can have only the EXE and nothing else.
AdmiralAlkex Posted July 7, 2008 Posted July 7, 2008 Use Zedna's resources.au3 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
TomZ Posted July 7, 2008 Posted July 7, 2008 Doens't FileInstall meet your needs? I see you don't want any other files, but you can remove it afterwards anyways.
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