pseakins

problem with autoit3wrapper

12 posts in this topic

After building a fresh XPSP3 system on a new partition and installing the latest AutoIt stuff (not beta) I found that playing an embedded sound per Larry's post, reproduced below, no longer works. After spending the entire afternoon fiddling round with this I've discovered that there appears to be a problem with the AutoIt3Wrapper.exe which was installed with the new versions of autoit-v3.3.0.0-setup.exe and SciTE4AutoIt3.3.0.0.exe

When compiling and then running Larry's example no sound is heard, you just get the "Async" tooltip.

However, after copying in and then compiling using the older AutoIt3Wrapper.exe from the old XP partition the script will then work as expected.

Taking this a step further, I then tried to compile AutoIt3Wrapper.au3 itself and found that it cannot be compiled because macro @ProcessorArch is undefined. There are other undefined macros. I'm wondering how the 3.3.0.0 version was compiled. Have I missed some important, possibly undocumented step, in installing this stuff on my fresh PC?

Phil

Larry's post http://www.autoitscript.com/forum/index.ph...st&p=419042

Download Scite install. Add ResHacker.exe to the Scite\AutoIt3Wrapper folder. Use Scite's "Tool" menu to compile this...

CODE: AutoIt

#AutoIt3Wrapper_Res_File_Add=C:\WINDOWS\Media\tada.wav,SOUND,MYWAVE

Global Const $SND_RESOURCE = 0x00040004

Global Const $SND_ASYNC = 1

DllCall("winmm.dll","int","PlaySound","str","MYWAVE","hwnd",0,"int",$SND_RESOURCE)

DllCall("winmm.dll","int","PlaySound","str","MYWAVE","hwnd",0,"int",BitOr($SND_RESOURCE,$SND_ASYNC))

For $n = 1 to 100

Sleep(15)

ToolTip("Asynch! " & $n)

Next


Phil Seakins

Share this post


Link to post
Share on other sites



I am pretty sure I broke some functionallity when integrating the Resource Update routines in stead of using ResHacker.

It is something I am planning to pick up one day but till then you will have to use #AutoIt3Wrapper_Run_After=Reshacker:

#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_After=""%scitedir%\autoit3wrapper\ResHacker.exe" -add %out%, %out%, "C:\WINDOWS\Media\tada.wav", SOUND, MYWAVE, 0"

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I am pretty sure I broke some functionallity when integrating the Resource Update routines in stead of using ResHacker.

It is something I am planning to pick up one day but till then you will have to use #AutoIt3Wrapper_Run_After=Reshacker:

#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_After=""%scitedir%\autoit3wrapper\ResHacker.exe" -add %out%, %out%, "C:\WINDOWS\Media\tada.wav", SOUND, MYWAVE, 0"
No, you didn't break anything.

You are just not allowing any kind of resources.

Proper directive would be:

#AutoIt3Wrapper_Res_File_Add=C:\WINDOWS\Media\tada.wav,10

It will be stored under RT_RCDATA with name of it's own ordinal value (in this case 1 because it's the only one)


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Hi all,

From my experiences with adding resources using ResHacker and AutoIt3Wrapper, I believe trancexx has called it right.

#AutoIt3Wrapper_Res_File_Add will not store anything but RCDATA type and certainly not an "alias" like "MYWAVE". The resources are numbered sequentially from 1 onwards.

Using ResHacker allows you to store resources as other data types and give "alias" names for the resource.

From Zedna's Resources thread:

EDIT: 2008-03-10
In AutoIt3Wrapper from latest Scite4AutoIt3 (2008-03-08) is changed behaviour in placing resources into wrong sections and also with different ResNames. It's always placed into RCData section and ResNames are assigned as numbers 1,2,3,...
This is reason why I reverted back from simpler

CODE#AutoIt3Wrapper_Res_File_Add=test_1.txt, rcdata, TEST_TXT_1; Filename,Section,ResName
           #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
           #AutoIt3Wrapper_Res_File_Add=C:\WINDOWS\Media\tada.wav, sound, TEST_WAV_1

to
CODE#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=ResHacker.exe -add %out%, %out%, C:\WINDOWS\Media\tada.wav, sound, TEST_WAV_1, 0
             #AutoIt3Wrapper_run_after=upx.exe --compress-resources=0 "%out%"

This may be fixed in some next version of AutoIt3Wrapper/Scite4AutoIt3 ...

Jos, although I do not believe you "broke" anything, perhaps you need to update the SciTE/AutoIt3Wrapper/Directives Help file page where it currently reads:

#AutoIt3Wrapper_Res_File_Add=                 ; Filename[,Section [,ResName]] to be added.

Ready to accept incoming....... ;-)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

No, you didn't break anything.

You are just not allowing any kind of resources.

Proper directive would be:

#AutoIt3Wrapper_Res_File_Add=C:\WINDOWS\Media\tada.wav,10

It will be stored under RT_RCDATA with name of it's own ordinal value (in this case 1 because it's the only one)

Well, I did break that example because I believe the DllCall to winmm playsound expects the WAV file to exist in the SOUND section.

I know that the current resourceupdate UDFs add files only to RCDATA and simply cannot get it to recognize a string name as section to use as described here:

http://msdn.microsoft.com/en-us/library/ms648049(VS.85).aspx

When I specify a correct section number it works fine but as soon as I specify a Sectionname it comes up with a gibberish sectionname.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Jos, although I do not believe you "broke" anything, perhaps you need to update the SciTE/AutoIt3Wrapper/Directives Help file page where it currently reads:

#AutoIt3Wrapper_Res_File_Add=                ; Filename[,Section [,ResName]] to be added.

Ready to accept incoming....... ;-)

M23

I did and know about it, but was still planning to sort it out (some day).

The reason was simple by the way: I wanted to get rid of the reshacker dependency and the internal UDFs in AutoIt3Wrapper support x64 which reshacker doesn't.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Well, I did break that example because I believe the DllCall to winmm playsound expects the WAV file to exist in the SOUND section.

I know that the current resourceupdate UDFs add files only to RCDATA and simply cannot get it to recognize a string name as section to use as described here:

http://msdn.microsoft.com/en-us/library/ms648049(VS.85).aspx

When I specify a correct section number it works fine but as soon as I specify a Sectionname it comes up with a gibberish sectionname.

Jos

No, there is no such thing as SOUND section. PlaySound from winmm.dll searches by name.

I did some progress with that function and updating resources generally. It's all here. If you are interested just find _ResUpdate() and _ResDelete() functions. It's covering almost all kind of resources (listed in that post). Strings, numbers - doesn't matter.

I'll be more than happy to rewrite that part of AutoIt3Wrapper.au3 if you are interested. It would be copy/paste job actually - with debugging in your style of course and _Res_Create_RTVersion() function included.

edit: I must correct myself not to cause some kind of confusion. I meant to say: "No, there is no such thing as SOUND section unless you name it that way." (Or maybe WAVE)

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

No, there is no such thing as SOUND section. PlaySound from winmm.dll searches by name.

I did some progress with that function and updating resources generally. It's all here. If you are interested just find _ResUpdate() and _ResDelete() functions. It's covering almost all kind of resources (listed in that post). Strings, numbers - doesn't matter.

I'll be more than happy to rewrite that part of AutoIt3Wrapper.au3 if you are interested. It would be copy/paste job actually - with debugging in your style of course and _Res_Create_RTVersion() function included.

I haven't looked in much detail yet, but I know that the original script posted here would create a new Section called "SOUND".

Have seen you have been putting a lot of effort in the Resource UDFs but haven't taken the time yet to start looking at it in detail and prefer updating AutoIt3Wrapper myself to make sure I understand what it is doing. :D

Just out of curiosity: What would the DllCall() need to make it play from the RCDATA section?

This doesn't work:

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_File_Add=C:\WINDOWS\Media\tada.wav, 10, 123
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****

Global Const $SND_RESOURCE = 0x00040004
Global Const $SND_ASYNC = 1

DllCall("winmm.dll","int","PlaySound","str","123","hwnd",0,"int",$SND_RESOURCE)
DllCall("winmm.dll","int","PlaySound","str","123","hwnd",0,"int",BitOr($SND_RESOURCE,$SND_ASYNC))
For $n = 1 to 100
Sleep(15)
ToolTip("Asynch! " & $n)
Next

Jos :D


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I haven't looked in much detail yet, but I know that the original script posted here would create a new Section called "SOUND".

Have seen you have been putting a lot of effort in the Resource UDFs but haven't taken the time yet to start looking at it in detail and prefer updating AutoIt3Wrapper myself to make sure I understand what it is doing. :D

Just out of curiosity: What would the DllCall() need to make it play from the RCDATA section?

This doesn't work:

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_File_Add=C:\WINDOWS\Media\tada.wav, 10, 123
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****

Global Const $SND_RESOURCE = 0x00040004
Global Const $SND_ASYNC = 1

DllCall("winmm.dll","int","PlaySound","str","123","hwnd",0,"int",$SND_RESOURCE)
DllCall("winmm.dll","int","PlaySound","str","123","hwnd",0,"int",BitOr($SND_RESOURCE,$SND_ASYNC))
For $n = 1 to 100
Sleep(15)
ToolTip("Asynch! " & $n)
Next

Jos :D

I went thru function PlaySound and it's hardcoded that res types are either WAVE or SOUND.

Appears to be no chance to work.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I went thru function PlaySound and it's hardcoded that res types are either WAVE or SOUND.

Appears to be no chance to work.

Yea, that's is what I understood too. so the question is how to created a new section in the resources in case somebody specifies a non standard section.

The same counts for specifying a non-numeric value for the ResName.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Yea, that's is what I understood too. so the question is how to created a new section in the resources in case somebody specifies a non standard section.

The same counts for specifying a non-numeric value for the ResName.

Jos

I'm doing that this way (really check there):

...
Case Else

            Local $tResource = DllStructCreate("byte[" & FileGetSize($sResFile) & "]")
            Local $hResFile = FileOpen($sResFile, 16)
            DllStructSetData($tResource, 1, FileRead($hResFile))
            FileClose($hResFile)

            If @error Then
                Return SetError(5, 0, "")
            EndIf

            Local $a_hCall = DllCall("kernel32.dll", "hwnd", "BeginUpdateResourceW", "wstr", $sModule, "int", 0)

            If @error Or Not $a_hCall[0] Then
                Return SetError(6, 0, "")
            EndIf

            Switch IsNumber($iResType) + 2 * IsNumber($iResName)
                Case 0
                    Local $a_iCall = DllCall("kernel32.dll", "int", "UpdateResourceW", _
                            "hwnd", $a_hCall[0], _
                            "wstr", StringUpper($iResType), _
                            "wstr", StringUpper($iResName), _
                            "int", $iResLang, _
                            "ptr", DllStructGetPtr($tResource), _
                            "dword", FileGetSize($sResFile))
                Case 1
                    Local $a_iCall = DllCall("kernel32.dll", "int", "UpdateResourceW", _
                            "hwnd", $a_hCall[0], _
                            "int", $iResType, _
                            "wstr", StringUpper($iResName), _
                            "int", $iResLang, _
                            "ptr", DllStructGetPtr($tResource), _
                            "dword", FileGetSize($sResFile))
                Case 2
                    Local $a_iCall = DllCall("kernel32.dll", "int", "UpdateResourceW", _
                            "hwnd", $a_hCall[0], _
                            "wstr", StringUpper($iResType), _
                            "int", $iResName, _
                            "int", $iResLang, _
                            "ptr", DllStructGetPtr($tResource), _
                            "dword", FileGetSize($sResFile))
                Case 3
                    Local $a_iCall = DllCall("kernel32.dll", "int", "UpdateResourceW", _
                            "hwnd", $a_hCall[0], _
                            "int", $iResType, _
                            "int", $iResName, _
                            "int", $iResLang, _
                            "ptr", DllStructGetPtr($tResource), _
                            "dword", FileGetSize($sResFile))
            EndSwitch

            If @error Or Not $a_iCall[0] Then
                DllCall("kernel32.dll", "int", "EndUpdateResourceW", "hwnd", $a_hCall[0], "int", 0)
                Return SetError(7, 0, "")
            EndIf

            $a_iCall = DllCall("kernel32.dll", "int", "EndUpdateResourceW", "hwnd", $a_hCall[0], "int", 0)

            If @error Or Not $a_iCall[0] Then
                Return SetError(8, 0, "")
            EndIf

    EndSwitch

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now