Jump to content

Recommended Posts

Posted

Well done @MattyD, thank you 👍 . Oberviously you had to generate (write) many code.

What bothers me a little bit are the many dependencies that you have to include in the projects, "just" to use WinRT MediaPlayer object or XAML controls.
I know there are not much alternatives, but this is the point why I would not use it 😔 .

Spoiler

winrt-mediaplayer.png

Don't get me wrong, I appreciate the work and the solution for the use case, but I don't really like it.

Best regards
Sven

==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted (edited)

yeah fair enough, totally get where you're coming from.

Just to explain though - this uses libraries from the WinRT project which literally has thousands of objects wrapped.
The folder structure is a way for me to drop objects in and out of a project without definitions getting in the way of each other. So we could probably boil all this down to a single header - but it will only be useful for this implementation.   So the setup is more for me I guess!

There are Interface tags in all the interface libraries. So for a more traditional approach with ObjCreateInterface()  I'd probably extract all those and dump them into its own include file.  You'd would also lose the benefits of things like calltips, and a few other perks but you gain a bit more simplicity with the file structure.

Edited by MattyD
Posted

Thanks for the explanation - understood. Sound reasonably.

57 minutes ago, MattyD said:

There are Interface tags in all the interface libraries. So for a more traditional approach with ObjCreateInterface()  I'd probably extract all those and dump them into its own include file.  You'd would also lose the benefits of things like calltips, and a few other perks but you gain a bit more simplicity with the file structure.

You're right.

On a second thought, I personally have no use case for it at all, but it's still useful, no question 👍 .

Off-topic:

Spoiler

In the nearly past we (as community) tried to enhance AutoIt GUIs by several things (WebViews, WinRT, embedding web code and others). It's nice to have possibilites and showcases of how such things can be achieved, but for me AutoIt isn't the right approach for such problems/challenges. But this is of course just me. For private projects it's nice and I do often tryouts for such scenarios, but in my profession I (hopefully) choose the right tooling/framework for the goal/problem/challange.

Personally I really would love to see AutoIt enhancing by cross platform functionality and some other features or beeing open source, but this will not happen. So more and more people will leave AutoIt behind in the future.

Anyway, just few thoughts.

Again: Thanks for the showcase and the effort @MattyD 👌 .

Best regards
Sven

==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted

Hi all, just a quick one

I've updated the zip in post #1 - its the same thing, but I've included a tool so you can easily update that application manifest.

Posted (edited)

Hi @MattyD

I replaced the original autoit3.exe file with the modified version generated by your script (..?! you know things that I obviously don't know) and in this way MediaPlayer.au3 works.
Then I tried to compile MediaPlayer.au3 but the generated executable does not work (the autoit3.exe file after compilation is still the modified one). Is there any trick to be able to compile MediaPlayer.au3 into a working executable and then restore the original autoit3.exe file in the AutoIt folder?
Bye and thanks

Edited by Gianni

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

 Yeah, there's a couple of options really,

You could just modify that "update manifest.au3" so it replaces the resource in your compiled script (rather than @autoitexe).

But my original approach was to modify AutoItWrapper.au3.  On line 2670 I inserted this.

FileWriteLine($hTempFile2, '            <maxversiontested Id="10.0.18362.1" />')

Then in your script, you need the following directive to trigger that bit of code:

#Autoit3Wrapper_Res_Compatibility=Win10

I don't think the actual build number is critical - I'd imagine things should be OK so long as the build is after win10 1903. Win10 22H2 is 10.0.19045.0 if you wanted to specify something more current!

Posted

I applied the patch to the compiled executable file instead of AutoIt3.exe and that worked. Thanks

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted (edited)
On 5/1/2025 at 7:54 AM, MattyD said:

But my original approach was to modify AutoItWrapper.au3.  On line 2670 I inserted this.

In my version of it does not fall under that line.

... ...
                    If StringInStr($INP_Res_Compatibility, "Win10") Then
                    
                        ; https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests#maxversiontested
                        FileWriteLine($hTempFile2, '            <!-- Windows 10, version 1903 -->') 
                        FileWriteLine($hTempFile2, '            <maxversiontested Id="10.0.18362.1" />')
                        
                        FileWriteLine($hTempFile2, '            <!--The ID below indicates application support for Windows Vista -->')
... ...

This will be easier to find as beta versions come out.
Thank you for the food code :) 

Edited by argumentum
better

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

...a bunch of nonsense but kept for hysterical historical purposes :( 

Spoiler

I was looking at the color picker you posted and compiled it with the above but it should be runed as script to read the console.
Did I rename the @AutoItExe and get over with it ?, no..., that's too easy :D
I patched AutoItWrapper.au3 because that is fun :lol:

Spoiler
... ...
    $ProcessBar_Title = "(" & $VERSION & ") Processing : " & StringTrimLeft($ScriptFile_In, StringInStr($ScriptFile_In, "\", 0, -1))
    ; set AutoIt3.Exe to the AutoIt3dir specified on the commandline when supplied
    If $AutoIt3_PGM <> "" Then
        ; use the autoit3.exe defined by the #autoit3wrapper_autoit3 directive
        Global $sDrive = "", $sDir = "", $sFileName = "", $sExtension = ""
        _PathSplit($AutoIt3_PGM, $sDrive, $sDir, $sFileName, $sExtension)
        $CurrentAutoIt_InstallDir = $sDrive & StringTrimRight($sDir, 1)
    ElseIf $CurrentAutoIt_InstallDir <> "" And FileExists($CurrentAutoIt_InstallDir & "\autoit3" & ($Option = "ModRun" ? "-Mod" : "") & ".exe") Then
        If @OSArch <> "x86" And $INP_UseX64 = "y" And FileExists($CurrentAutoIt_InstallDir & "\autoit3_x64" & ($Option = "ModRun" ? "-Mod" : "") & ".exe") Then
            $AutoIt3_PGM = $CurrentAutoIt_InstallDir & "\autoit3_x64" & ($Option = "ModRun" ? "-Mod" : "") & ".exe"
        Else
            $AutoIt3_PGM = $CurrentAutoIt_InstallDir & "\autoit3" & ($Option = "ModRun" ? "-Mod" : "") & ".exe"
        EndIf
    Else
        If @OSArch <> "x86" And $INP_UseX64 = "y" And FileExists($CurrentAutoIt_InstallDir & "\autoit3_x64" & ($Option = "ModRun" ? "-Mod" : "") & ".exe") Then
            $AutoIt3_PGM = $CurrentAutoIt_InstallDir & "\autoit3_x64" & ($Option = "ModRun" ? "-Mod" : "") & ".exe"
        Else
            $AutoIt3_PGM = $CurrentAutoIt_InstallDir & "\autoit3" & ($Option = "ModRun" ? "-Mod" : "") & ".exe"
        EndIf
    EndIf
... ...
#Region ;Run the Script
If $Option = "Run" Or $Option = "RunAdmin" Or $Option = "ModRun" Then ; 2025.05.02
    ProgressOff()
... ...
    Opt("GUICoordMode", 1) ; 2025.05.02
    Local $h_Form = GUICreate("AutoIt3Wrapper GUI to Compile AutotIt3 Script (ver " & $VERSION & ")", 700, 525, (@DesktopWidth - 650) / 2, (@DesktopHeight - 500) / 2)
    Local $h_File = GUICtrlCreateMenu("&File")
    Local $h_Exit = GUICtrlCreateMenuItem("&Exit", $h_File)
... ...
    Local $H_RUN = GUICtrlCreateButton("&Run", 90, 445, 70, 30) ; 2025.05.02
    Local $H_RUN_OptionsContext = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
    Local $H_RUN_ContextRunNormal = GUICtrlCreateMenuItem("Run &Normal", $H_RUN_OptionsContext)
    Local $H_RUN_ContextRunMod = GUICtrlCreateMenuItem("Run &Mod", $H_RUN_OptionsContext)
    Local $H_COMPILE = GUICtrlCreateButton("&Compile", 170, 445, 70, 30)
... ...
        ; Change Target program clicked
        Switch $rc
            Case $H_RUN ; 2025.05.02
                ShowMenu($h_Form, $g_rc, $H_RUN_OptionsContext)

            Case $tab
... ...
    Switch $g_rc
        Case $H_AU3CHECK
            $g_Option = "Au3Check"

        Case $H_RUN_ContextRunNormal
            $g_Option = "Run"

        Case $H_RUN_ContextRunMod
            $g_Option = "ModRun"

        Case $H_COMPILE
            $g_Option = "Compile"
... ...
#EndRegion ### FMIPC ###

; 2025.05.02
; Show a menu in a given GUI window which belongs to a given GUI ctrl
Func ShowMenu($hWnd, $idCtrl, $idContext)  ;
    Local $aPos, $x, $y
    Local $hMenu = GUICtrlGetHandle($idContext)
    $aPos = ControlGetPos($hWnd, "", $idCtrl)
    $x = $aPos[0]
    $y = $aPos[1] + $aPos[3]
    ClientToScreen($hWnd, $x, $y)
    TrackPopupMenu($hWnd, $hMenu, $x, $y)
EndFunc   ;==>ShowMenu

; Convert the client (GUI) coordinates to screen (desktop) coordinates
Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
    Local $tPoint = DllStructCreate("int;int")
    DllStructSetData($tPoint, 1, $x)
    DllStructSetData($tPoint, 2, $y)
    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "struct*", $tPoint)
    $x = DllStructGetData($tPoint, 1)
    $y = DllStructGetData($tPoint, 2)
    ; release Struct not really needed as it is a local
    $tPoint = 0
EndFunc   ;==>ClientToScreen

; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd)
Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
EndFunc   ;==>TrackPopupMenu

..and those are the edits to run the "-mod" added executables without making the change permanent. 
Ctrl - F7 as if to compile and click run. You'll now find a "Run normal" and "Run mod"
To me is easier to do it this way 🤪

 ... so, yes. Use the solution below :)

Edited by argumentum
oops

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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
  • Recently Browsing   0 members

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