Jump to content

Recommended Posts

Posted

Congratulations! Fixed some internal issues I had with software written in AutoIt.
However, I find that, at least on Windows 11, notepad scripts like ControlSet and such don't work. Why? because a different class is used for the text editor, which is the "RichEditD2DPT1" class.
If possible, I can help fix problems like these. Help examples could be made in separate folders, one for Windows 10 and another in case something changes in Windows 11, that's my suggestion, although I'm thinking of making a bugTracker that I think can be taken more into account, so yes wish I can help.

Posted

Which example ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 6/11/2022 at 9:46 PM, mLipok said:

Which example ?

Expand  

In agreement. On my Windows 11 PC I have taken one of the "control" examples that I don't remember now (this is because I did it for a long time) and I have changed the edit1 class that doesn't exist in that version of notepad.

#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; Run Notepad
    Run("notepad.exe")

    ; Wait 10 seconds for the Notepad window to appear.
    Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)

    ; Set the edit control in Notepad with some text. The handle returned by WinWait is used for the "title" parameter of ControlSetText.
    ControlSetText($hWnd, "", "RichEditD2DPT1", "This is some text")

    ; Retrieve the text of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetText.
    Local $sText = ControlGetText($hWnd, "", "RichEditD2DPT1")

    ; Display the text of the edit control.
    MsgBox($MB_SYSTEMMODAL, "", "The text in Edit1 is: " & $sText)

    ; Close the Notepad window using the handle returned by WinWait.
    WinClose($hWnd)
EndFunc   ;==>Example

 

Posted

Are you sure you are running the standard Notepad of Win11?

on my system Edit1 is still true for Win11

Posted (edited)

@jpm

This was already partially discussed here:

 

 


EDIT:
I even thought that this problem was already solved somewhere, but I don't see this solution.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 6/15/2022 at 8:19 AM, jpm said:

@mLipok nothing related with the "edit1" in notepad

Expand  

yeah, but as I said:

  On 6/15/2022 at 7:50 AM, mLipok said:

I even thought that this problem was already solved somewhere, but I don't see this solution.

Expand  

So I'm still looking.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 6/15/2022 at 6:04 AM, jpm said:

Are you sure you are running the standard Notepad of Win11?

on my system Edit1 is still true for Win11

Expand  

Yes, although according to what I found out that from Windows 11 notepad is updated through the microsoft store, and I think that many users who use Windows 11 should have this new notepad. That's why I've pasted the modification code demonstrating the new class, which works for me.

Posted

It seems newer versions of notepad.exe can be downloaded from Microsoft Store for windows 10 and windows 11. These newer versions are also available for Windows Insider subscribers.

Something like the following might work to get the correct classname:

Local $sEditClass = StringSplit(WinGetClassList($hWnd), @LF)[1] & "1"

This only assumes there is an editclass and it is the first class in the classlist.

Posted (edited)

Tested with Insider Preview 21H2 Build 25131 (Dev Channel).
This works everywhere:

#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; Run Notepad
    Run("notepad.exe")

    ; Wait 10 seconds for the Notepad window to appear.
    Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)

    ; Get the class for the Edit control
    Local $sText, $sEditControl = _GetNotepadEditClass($hWnd) & "1"
    If Not @error Then
        ; Set the edit control in Notepad with some text. The handle returned by WinWait is used for the "title" parameter of ControlSetText.
        ControlSetText($hWnd, "", $sEditControl, "This is some text")

        ; Retrieve the text of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetText.
        $sText = ControlGetText($hWnd, "", $sEditControl)

        ; Display the text of the edit control.
        MsgBox($MB_SYSTEMMODAL, "", "The text in " & $sEditControl & " is: " & $sText)
    EndIf

    ; Close the Notepad window using the handle returned by WinWait.
    WinClose($hWnd)
EndFunc   ;==>Example

Func _GetNotepadEditClass($hWnd)
    Local $aClassList = StringSplit(WinGetClassList($hWnd), @LF)
    For $n = 1 To $aClassList[0]
        If StringInStr($aClassList[$n], "Edit") Then Return $aClassList[$n]
    Next
    Return SetError(1, 0, "")
EndFunc   ;==>_GetNotepadEditClass

This is the class list from the new Notepad:

Windows.UI.Composition.DesktopWindowContentBridge
Windows.UI.Input.InputSite.WindowClass
Windows.UI.Composition.DesktopWindowContentBridge
Windows.UI.Input.InputSite.WindowClass
Windows.UI.Core.CoreWindow
Windows.UI.Composition.DesktopWindowContentBridge
Windows.UI.Input.InputSite.WindowClass
RichEditD2DPT
msctls_statusbar32
Windows.UI.Composition.DesktopWindowContentBridge
Windows.UI.Input.InputSite.WindowClass
Windows.UI.Composition.DesktopWindowContentBridge
Windows.UI.Input.InputSite.WindowClass
Windows.UI.Composition.DesktopWindowContentBridge
Windows.UI.Input.InputSite.WindowClass

Note: ...maybe add the _GetNotepadEditClass() to "Examples\Helpfile\Extras", as is going to be needed in every Notepad example counting on "Edit1" to be the expected GUI control.

Edited by argumentum
better code

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

Posted

A shorter version, not relying on the word 'Edit', but assuming the editcontrol has keyboard focus (only tested on windows 10 with standard notepad):

#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; Run Notepad
    Run("notepad.exe")

    ; Wait 10 seconds for the Notepad window to appear.
    Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)

    ; Retrieve the control that has keyboard focus in Notepad.
    Local $sEditControl = ControlGetFocus($hWnd)

    ; Display the control that has keyboard focus.
    MsgBox($MB_SYSTEMMODAL, "", "The control that has keyboard focus in Notepad is: " & $sEditControl)

    ; Set the edit control in Notepad with some text. The handle returned by WinWait is used for the "title" parameter of ControlSetText.
    ControlSetText($hWnd, "", $sEditControl, "This is some text")

    ; Retrieve the text of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetText.
    Local $sText = ControlGetText($hWnd, "", $sEditControl)

    ; Display the text of the edit control.
    MsgBox($MB_SYSTEMMODAL, "", "The text in Edit1 is: " & $sText)

    ; Close the Notepad window using the handle returned by WinWait.
    WinClose($hWnd)
EndFunc   ;==>Example

 

 

  • 2 weeks later...
Posted
Posted

Support for IE is ended. But the IE activex component will be available for next few years.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 1 month later...
Posted (edited)

🔷 with

 GDIPlus_BitmapCreateFromFile()  Example 2

The example is giving out wrong coords as not with the former version

Edit :  sorry i see it working  in 3.3.16.1

happy landing & Thanks

Edited by Deye
Posted (edited)

🔷 3.3.16.0  Untitled.png.9c4d7ab88ec87f600f5c5fc43c088ff8.png ðŸ”· 3.3.14.5 Untitled1.png.42d83b107d2488fc3453afaae8313e28.png

Edit :Ok in   3.3.16.1  seems to be Ok

Thanks

Edited by Deye

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...