0000 Posted August 2, 2009 Share Posted August 2, 2009 Hello. Im trying to write little program. Project is in: 'C:\Project\' main.au3 is in: C:\Project\main.au3 test.exe is in : C:\Project\test.exe ResHacker.exe is in : C:\Project\ResHacker.exe #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, test.exe, rcdata, EXE, 0 #include "resources.au3" _ResourceGetAsBytes("EXE") _ResourceSaveToFile("working.exe", "EXE") if @error Then MsgBox(0,0,@error) ; returns only 1 or EXE Crash... EndIf I am trying to compile it with Scite4AutoIt3, where could be a problem? Also in my AutoIt Install Directory doesn't exist this one: AutoIt3Wrapper.exe Link to comment Share on other sites More sharing options...
Developers Jos Posted August 2, 2009 Developers Share Posted August 2, 2009 Did you install the SciTE4AutoIt3 installer? 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. Link to comment Share on other sites More sharing options...
0000 Posted August 2, 2009 Author Share Posted August 2, 2009 It was inside in AutoIt3 package. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 2, 2009 Developers Share Posted August 2, 2009 It was inside in AutoIt3 package.No it is not...The lite version of SciTE is in there but not the full version with all the extra goodies.Jos 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. Link to comment Share on other sites More sharing options...
0000 Posted August 2, 2009 Author Share Posted August 2, 2009 With new Scite package same problems.. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 2, 2009 Developers Share Posted August 2, 2009 With new Scite package same problems..You will have to provide better detailed information than this if you want us to help you.Where is it going wrong?What is shown in the SciTE output pane at compilation time?Did you check with ResourceHacker is the test.exe was added?Jos 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. Link to comment Share on other sites More sharing options...
0000 Posted August 2, 2009 Author Share Posted August 2, 2009 (edited) Now I added everything in one dir: Au2Exe. Source: #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, test.exe, rcdata, EXE, 0 #include "resources.au3" _ResourceGetAsBytes("EXE") _ResourceSaveToFile("working.exe", "EXE") if @error Then MsgBox(0,0,@error) ; returns only 1 or EXE Crash... EndIf Scite4Autoit console output: >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /in "C:\Program Files\AutoIt3\Aut2Exe\split.au3" /autoit3dir "C:\Program Files\AutoIt3" +>14:45:12 Starting AutoIt3Wrapper v.2.0.0.1 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 2 CPU:X64 OS:X86) >Running AU3Check (1.54.9.0) from:C:\Program Files\AutoIt3 +>14:45:12 AU3Check ended.rc:0 >Running:(3.2.8.0):C:\Program Files\AutoIt3\aut2exe\aut2exe.exe /in "C:\Program Files\AutoIt3\Aut2Exe\split.au3" /out "C:\Program Files\AutoIt3\Aut2Exe\split.exe" /comp 2 /nopack /Bin C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\AutoItSC.bin +>14:45:13 Aut2exe.exe ended.rc:0 +>14:45:13 Created program:C:\Program Files\AutoIt3\Aut2Exe\split.exe ->Warning: This is an Unicode compiled script and will not run on Win9x/ME. >Running:ResHacker.exe -add C:\Program Files\AutoIt3\Aut2Exe\split.exe, C:\Program Files\AutoIt3\Aut2Exe\split.exe, test.exe, rcdata, EXE, 0 >ResHacker.exe -add C:\Program Files\AutoIt3\Aut2Exe\split.exe, C:\Program Files\AutoIt3\Aut2Exe\split.exe, test.exe, rcdata, EXE, 0 Ended rc:0 +>14:45:13 AutoIt3Wrapper Finished >Exit code: 0 Time: 2.003 Also I had some problems with WinAPI.au3 file. Edited August 2, 2009 by Guest Link to comment Share on other sites More sharing options...
Mobius Posted August 2, 2009 Share Posted August 2, 2009 (edited) What does the Reshacker log file say? or look at the output exe file with RH, does it actually add your chosen resource? Ed: Thx dude, not a Reshacker issue then. Edited August 2, 2009 by Mobius Link to comment Share on other sites More sharing options...
0000 Posted August 2, 2009 Author Share Posted August 2, 2009 LogFile from ResHacker:[02 Aug 2009, 15:04:42] ResHacker.exe -add C:\Program Files\AutoIt3\Aut2Exe\split.exe, C:\Program Files\AutoIt3\Aut2Exe\split.exe, test.exe, rcdata, EXE, 0 Added: RCDATA,EXE,0 Commands completedHere is photo of ResHacker resources:http://img198.imageshack.us/i/reshack.jpg/here is photo, when I run script with F5 from Scite:http://img36.imageshack.us/i/ifscite.jpg/and here if I manual run .exe:http://img530.imageshack.us/i/ifnormal.jpg/ Link to comment Share on other sites More sharing options...
Developers Jos Posted August 2, 2009 Developers Share Posted August 2, 2009 (edited) The directory contains spaces so guess that could be an issue. If paths are not included with filenames, then the operating systems’ current folder is presumed to contain the named file. It is generally good practise, though not required here, to enclose filenames contain spaces within double quotes. Try: #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Run_After=ResHacker.exe -add "%out%", "%out%", test.exe, rcdata, EXE, 0 #include "resources.au3" _ResourceGetAsBytes("EXE") _ResourceSaveToFile("working.exe", "EXE") if @error Then MsgBox(0,0,@error) ; returns only 1 or EXE Crash... EndIf ... and check the reshacker.log as mentioned to see if it worked correctly. Edited August 2, 2009 by Jos 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. Link to comment Share on other sites More sharing options...
0000 Posted August 2, 2009 Author Share Posted August 2, 2009 @Jos: ResHacker.log [02 Aug 2009, 15:15:35] ResHacker.exe -add "C:\Program Files\AutoIt3\Aut2Exe\split.exe", "C:\Program Files\AutoIt3\Aut2Exe\split.exe", test.exe, rcdata, EXE, 0 Added: RCDATA,EXE,0 Commands completed Running efect same as before >_< Error code: 1 or .exe crash. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 2, 2009 Developers Share Posted August 2, 2009 I haven't played that much with this Include so maybe Zedna will stop by and help out. I would use FileInclude() for this normally. >_< 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. Link to comment Share on other sites More sharing options...
0000 Posted August 2, 2009 Author Share Posted August 2, 2009 (edited) About 8 months ago this worked well for me, but the old source doesnt work too... So I dunno what could be wrong >_< P.S With FileInstall() is smthing wrong... test.exe : 35Kb After using FileInstall() and running script it becomes: 51Kb... P.S.S ! *************************************************************************************************** ! * Input file is UTF8 encoded with BOM, Au3Check does not support UNICODE and will be skipped. * ! *************************************************************************************************** What should it mean? Edited August 2, 2009 by Guest Link to comment Share on other sites More sharing options...
Developers Jos Posted August 2, 2009 Developers Share Posted August 2, 2009 With FileInstall() is smthing wrong...test.exe : 35KbAfter using FileInstall() and running script it becomes: 51Kb...mmm , thats new for me... I haven't seen that happening.P.S.S! ***************************************************************************************************! * Input file is UTF8 encoded with BOM, Au3Check does not support UNICODE and will be skipped. *! ***************************************************************************************************What should it mean?This means what is says: AutoIt3Wrapper will run au3check by default but only for ansi encoded file as au3check doesn;t support UNICODE encoded files.Jos 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. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 2, 2009 Moderators Share Posted August 2, 2009 Hi all,I think I can help here. I mentioned to Zedna some time ago that his _FileGetAsBytes was not working correctly. The problem is that the function as written returns a struct, not the bytes. This is because Zedna was using the AsBytes function within other Resource* functions and needed the struct as a return value.I suggest you open Resources.au3 and paste these 2 functions (_ResourceGetAsBytes and _ResourceSaveToFile) in place of the existing ones - I have marked the places where I modified the code. All should then work as expected - it certainly did for me:expandcollapse popup; _ResourceGetAsBytes() doesn't work for RT_BITMAP type ; because _ResourceGet() returns hBitmap instead of memory pointer in this case Func _ResourceGetAsBytes($ResName, $ResType = 10, $ResLang = 0, $DLL = -1) ; $RT_RCDATA = 10 Local $ResPointer, $ResSize $ResPointer = _ResourceGet($ResName, $ResType, $ResLang, $DLL) If @error Then Return SetError(1, 0, 0) $ResSize = @extended $struct = DllStructCreate("byte[" & $ResSize & "]", $ResPointer) ; Old return value <<<<<<<<<<<<<<<<<<< Return DllStructGetData($struct, 1) ; returns bytes ; New return line <<<<<<<<<<<<<<<<<<< EndFunc Func _ResourceSaveToFile($FileName, $ResName, $ResType = 10, $ResLang = 0, $CreatePath = 0, $DLL = -1) ; $RT_RCDATA = 10 Local $ResStruct, $ResSize, $FileHandle If $CreatePath Then $CreatePath = 8 ; mode 8 = Create directory structure if it doesn't exist in FileOpen() If $ResType = $RT_BITMAP Then ; workaround: for RT_BITMAP _ResourceGetAsBytes() doesn't work so use _ResourceGetAsImage() $hImage = _ResourceGetAsImage($ResName, $ResType) If @error Then Return SetError(10, 0, 0) ; create filepath if doesn't exist $FileHandle = FileOpen($FileName, 2+16+$CreatePath) If @error Then Return SetError(11, 0, 0) FileClose($FileHandle) If @error Then Return SetError(12, 0, 0) _GDIPlus_ImageSaveToFile($hImage, $FileName) _GDIPlus_ImageDispose($hImage) $ResSize = FileGetSize($FileName) Else ; standard way $ResPointer = _ResourceGet($ResName, $ResType, $ResLang, $DLL) ; New code from here <<<<<<<<<<<<<<<<<<<<<<<<<<< If @error Then Return SetError(1, 0, 0) $ResSize = @extended $ResStruct = DllStructCreate("byte[" & $ResSize & "]", $ResPointer) ; To here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< If @error Then Return SetError(1, 0, 0) $ResSize = DllStructGetSize($ResStruct) $FileHandle = FileOpen($FileName, 2+16+$CreatePath) If @error Then Return SetError(2, 0, 0) FileWrite($FileHandle, DllStructGetData($ResStruct, 1)) If @error Then Return SetError(3, 0, 0) FileClose($FileHandle) If @error Then Return SetError(4, 0, 0) EndIf Return $ResSize EndFuncZedna was looking to modify his UDF to something similar, but has not got round to it yet. More details can be found somewhere in the Resources topic in the Examples forum.M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
0000 Posted August 3, 2009 Author Share Posted August 3, 2009 (edited) Thanks to Melba23, this suggestion fixxed resource problem. Of FileInstall() problem: bytes were changing because I had a little virus which itselfs inejcts to all .exe >_< So both methods are working for me, except I dont know if I can use UPX Packer with FileInstall().... Edited August 3, 2009 by Guest Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 3, 2009 Moderators Share Posted August 3, 2009 0000,You most certainly can use upx with FileInstall. The compiled exe is expanded into memory when run, so when you call FileInstall , everything is ready to go.M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Mobius Posted August 3, 2009 Share Posted August 3, 2009 Sorry to contradict you on this Melba23, but... The contents of a FileInstall() function are stored within the A3x section which is the binary Tail of the AutoIt3 Interpreter stub. Upx does not compress this data by default (And cannot for Au3 to work). That is why FileInstall is not affected by upx packing. Quality mod of those Resource functions though dude. >_< Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 4, 2009 Moderators Share Posted August 4, 2009 Mobius, Thanks for the clarification. I knew it would work, but not exactly why. Another little bit of knowledge imparted - that is why we are here, after all! And thanks a second time for the compliments. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
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