Jump to content

New SciTE4AutoIt3 available with SciTE v1.79


Jos
 Share

Recommended Posts

@Jos

What I mean, is that if you add the #AutoIt3Wrapper_Res_ProductVersion, then run through the GUI, the GUI reorganizes the directives when they are rewritten. ProductVersion will get left out in the cold (outside the reorganized directive block) when this happens if that line is not added. The GUI won't recognize it as a valid directive (doesn't matter if it has a place in the GUI to modify it) and will 'move' it below that region.

Link to comment
Share on other sites

  • Replies 244
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Oh, and for some odd reason, I had to recompile AutoIt3Wrapper from source on my Win7 X64 machine to get it to work (I was getting an array our of bounds error from the beta directory's compiled EXE), even though I compiled it as 32-bit. Not sure why. But I can confirm at least the version and manifest stuff works on X64, both compiling 32-bit and 64-bit EXEs.

Link to comment
Share on other sites

I can see no difference in ResHacker between the bitmap resources loaded by AIWrapper and ResHacker - both in the same section, both names in the same case, both languages the same - only differnce is the content. ;)

Happy to try anything else to help solve this.

M23

I can reproduce this error. If you try to save the BITMAP resource with ResHacker, you get a 0 byte file, so there's the problem. I don't know why it can display it in the preview without issue though. While I don't have a fix yet, it works fine if you add the bitmap to RT_RCDATA. Still not sure why though... Edited by wraithdu
Link to comment
Share on other sites

  • Moderators

wraithdu,

Congratulation on finding a fix! I too get the image to display correctly if I use AutoItWrapper to load the bitmap as a RC_DATA resource. But it does not feel right somehow..... ;)

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

  • Developers

@Jos

What I mean, is that if you add the #AutoIt3Wrapper_Res_ProductVersion, then run through the GUI, the GUI reorganizes the directives when they are rewritten. ProductVersion will get left out in the cold (outside the reorganized directive block) when this happens if that line is not added. The GUI won't recognize it as a valid directive (doesn't matter if it has a place in the GUI to modify it) and will 'move' it below that region.

Ok, understand now, but feel it belongs out of the region that states that its Generated by :

;**** Directives created by AutoIt3Wrapper_GUI ****

Uploaded a new Beta v 2.0.1.5 that fixes GUI issues with the additional Resource files not being displayed.

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

Here is little reproducing script for RT_BITMAP problem.  image1.bmp is in my Resource UDF in resource_data.zip (link is in my signature) but can be used any bitmap.

Note it works fine when you use ResHacker.exe -add

#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, image1.bmp, bitmap, TESTBMP1, 0 ; works

and the same script doesn't work when you use #AutoIt3Wrapper_Res_File_Add

#AutoIt3Wrapper_Res_File_Add=image1.bmp, RT_BITMAP, TESTBMP1, 0 ; doesn't work

Source of problem is _WinAPI_LoadImage() which doesn't load bitmap in this case.

#AutoIt3Wrapper_useupx=n
;~ #AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, image1.bmp, bitmap, TESTBMP1, 0 ; works
#AutoIt3Wrapper_Res_File_Add=image1.bmp, RT_BITMAP, TESTBMP1, 0 ; doesn't work

#include <WinAPI.au3>
;~ #include "resources.au3"

Global Const $RT_BITMAP = 2
Global Const $RT_RCDATA = 10

Local Const $STM_SETIMAGE = 0x0172
Local Const $IMAGE_BITMAP = 0

$gui = GUICreate("Data from resources example",820,400)
$pic1 = GUICtrlCreatePic("",0,0,400,300)
GUISetState(@SW_SHOW)

;~ _ResourceSetImageToCtrl($pic1, "TESTBMP1", $RT_BITMAP)

$hInstance = _WinAPI_GetModuleHandle("")

;~ Func _WinAPI_LoadImage($hInstance, $sImage, $iType, $iXDesired, $iYDesired, $iLoad)
$hBitmap = _WinAPI_LoadImage($hInstance, "TESTBMP1", $IMAGE_BITMAP, 0, 0, 0) ; doesn't work
;~ $hBitmap = DllCall("User32.dll", "hwnd", "LoadImage", "hwnd", $hInstance, "str", "TESTBMP1", "int", $IMAGE_BITMAP, "int", 0, "int", 0, "int", 0) ; doesn't work
;~ $hBitmap = $hBitmap[0]

_GetLastErrorMessage ("Error bitmap loading:")

$hWnd = GUICtrlGetHandle($pic1)
_SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)

While 1
    If GUIGetMsg() = -3 Then Exit
WEnd

Func _GetLastErrorMessage ($DisplayMsgBox = "")
    Local $ret, $s
    Local $p = DllStructCreate("char[4096]")
    Local Const $FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000

    If @error Then Return ""

    $ret = DllCall("Kernel32.dll", "int", "GetLastError")

    $ret = DllCall("kernel32.dll", "int", "FormatMessage", _
            "int", $FORMAT_MESSAGE_FROM_SYSTEM, _
            "ptr", 0, _
            "int", $ret[0], _
            "int", 0, _
            "ptr", DllStructGetPtr($p), _
            "int", 4096, _
            "ptr", 0)
    $s = DllStructGetData($p, 1)
    $p = 0
    If $DisplayMsgBox <> "" Then MsgBox(0, "_GetLastErrorMessage", $DisplayMsgBox & @CRLF & $s)
    Return $s
EndFunc   ;==>_GetLastErrorMessage
Edited by Zedna
Link to comment
Share on other sites

Fix for RT_BITMAP. Just have to strip the bitmap header. Add this at the top of the _Res_Update() function:

Switch $RType
    Case 2 ; *** RT_BITMAP
        $tSize = FileGetSize($InpResFile) - 14
        $tBuffer = DllStructCreate("char Text[" & $tSize & "]") ; Create the buffer.
        $pBuffer = DllStructGetPtr($tBuffer)
        _WinAPI_SetFilePointer($hFile, 14)
        _WinAPI_ReadFile($hFile, $pBuffer, $tSize, $bread, 0)
        If $hFile Then _WinAPI_CloseHandle($hFile)
        If $bread > 0 Then
            $result = DllCall("kernel32.dll", "int", "UpdateResourceW", "ptr", $rh, $RType_Type, $RType, $RName_Type, $RName, "ushort", $RLanguage, "ptr", $pBuffer, 'dword', $tSize)
            If $result[0] <> 1 Then ConsoleWrite('UpdateResources other: $result[0] = ' & $result[0] & " - LastError:" & _WinAPI_GetLastError() & ":" & _WinAPI_GetLastErrorMessage())
        EndIf

Finally got it by looking at the size of the ResHacker added resource versus the size of AI3Wrapper's and it dawned on me...

Edited by wraithdu
Link to comment
Share on other sites

  • Developers

Fix for RT_BITMAP. Just have to strip the bitmap header. Add this at the top of the _Res_Update() function:

Switch $RType
    Case 2 ; *** RT_BITMAP
        $tSize = FileGetSize($InpResFile) - 14
        $tBuffer = DllStructCreate("char Text[" & $tSize & "]") ; Create the buffer.
        $pBuffer = DllStructGetPtr($tBuffer)
        _WinAPI_SetFilePointer($hFile, 14)
        _WinAPI_ReadFile($hFile, $pBuffer, $tSize, $bread, 0)
        If $hFile Then _WinAPI_CloseHandle($hFile)
        If $bread > 0 Then
            $result = DllCall("kernel32.dll", "int", "UpdateResourceW", "ptr", $rh, $RType_Type, $RType, $RName_Type, $RName, "ushort", $RLanguage, "ptr", $pBuffer, 'dword', $tSize)
            If $result[0] <> 1 Then ConsoleWrite('UpdateResources other: $result[0] = ' & $result[0] & " - LastError:" & _WinAPI_GetLastError() & ":" & _WinAPI_GetLastErrorMessage())
        EndIf

Finally got it by looking at the size of the ResHacker added resource versus the size of AI3Wrapper's and it dawned on me...

Another small change, line 1032. Add the StringStripWS() function for the last parameter:

_Res_Update($rh, StringStripWS($IconFileInfo[1], 3), 3, StringStripWS($IconFileInfo[2], 3), StringStripWS($IconFileInfo[3], 3))

Made the updates and uploaded them.... testing now.

Edit;

Dammit, missed my movie time! Have to wait for the next one...

;)

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

  • Moderators

Hi all,

v.2.0.1.6 works for me - resources saved as bitmaps with AIWrapper display correctly.

Thanks wraithdu - glad you have already seen the film, I would hate to think you had missed it for the first time!

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

  • Developers

Working fine for me too.

Saw 2D first, now wanna see 3D ;)

Need to go there myself as well. Would really like to see the 3d version.

Thanks for all the work/testing etc... we really made a load of progress making AutoItWrapper stand on it's own feet and being able to produce a "complete" EXE.

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

  • Developers

I see the error Jos has as well. The problem is with the 256x256 icon in the filetype-blank.ico file. It is not being added correctly, I confirmed this with IcoFx on the compiled EXE. It is added to the group header and individual icons, but the data is missing / corrupt. Jos designed the icon addition code... maybe he has an idea what to fix?

I am debugging the ICO stuff now and noticed that the Width and Height are set to 0 for the 256x256 icons causing the error.

Will investigate why 0 is returned but could imagine that 0 means 256 since it's a one Byte field which can only have a value between 0-255.

More to follow.

Edit:

Its indeed the case that 0 means 256: http://en.wikipedia.org/wiki/ICO_%28file_format%29

I do not see an issue when opening the script with IcoFx.

CFF_Explorer is also showing the 256x256 Ico correctly so I am leaning towards a bug in Reshacker.

Edited 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

Ah, my mistake in what I said before. I was looking at the wrong icon in IcoFx, doh. The 256x256 icon is indeed correctly added to the output EXE. I agree with Jos that it seems to be a bug in ResHacker when trying to view that icon, and is probably related to what he found regarding the icon size reporting 0x0 when it is 256x256.

EDIT:

Oh, and Avatar 3D is freaking amazing. The characters look SO real. I love this movie...

Edited by wraithdu
Link to comment
Share on other sites

I did some tests with AutoIt3Wrapper v.2.0.1.6 and UPX options, so here is summary

There are 3 ways of adding/compressing resources by Autoit3Wrapper/UPX:

1)

#AutoIt3Wrapper_Res_File_Add=

2)

#AutoIt3Wrapper_useupx=n

#AutoIt3Wrapper_Res_File_Add=

3)

#AutoIt3Wrapper_useupx=n

#AutoIt3Wrapper_Res_File_Add=

#AutoIt3Wrapper_run_after=upx.exe --best --compress-resources=0 "%out%"

ad 1)

UPX is automatically called and also resources are compressed. All these compressed resources works fine in my tests (FindResouece,LoadImage API)

but these compressed resources can't be viewed by reshacker (it shows their names but instead of its preview shows error message about compression)

ad 2)

No UPX compression is done (neither EXE nor resources)

ad 3)

EXE is compressed by UPX but all resources stay uncompressed. reshacker can preview all resources without errors.

Edited by Zedna
Link to comment
Share on other sites

  • Developers

Not sure why you would want to use option 3 in general other than to be able to check the output program with reshacker or CFF_Explorer? When using CFF_Explorer you can easily Decompress the UPXed script exe since this is an buildin option, just for review.

We could, when needed, add a #directive to be able to override the UPX parameters used by AutoIT3wrapper.

Jos ;)

Edited 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

  • Moderators

Jos,

Can we add resources in a .res file using Wrapper directives? I have been trying with a .res file containing icons and cannot seem to hit on a syntax which works.

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

  • Developers

Jos,

Can we add resources in a .res file using Wrapper directives? I have been trying with a .res file containing icons and cannot seem to hit on a syntax which works.

M23

Without having looked at it in details I think that:

A res file is a file containing already the proper structures as they need to be included in the Program resource header.

This is something the current UDFs do as well so would think it is not supported with the current setup.

Any reason for wanting to use a RES file as this requires you to keep a RC file and "compile" that with rc.exe?

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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...