Statusleistentext auslesen

Stelle Fragen zur Programmierung mit Autohotkey

Moderator: jNizM

Nussbeisser
Posts: 113
Joined: 17 Jul 2019, 08:49

Statusleistentext auslesen

27 Feb 2021, 19:07

Hallo,
versuche Text von einer Statusleiste eines externen Programm zu lesen. Mit ControlGetText und StatusBarGetText hatte ich kein erfolg.
Nun, will ich mit SB_GETTEXT testen ob ich damit erfolg habe.
Ich benutze AHK 64 Unicode auf dein 64 Bit Rechner, das Programm ist 32 Bit

Wenn ich den Code ausführe,

Code: Select all

SendMessage, 0x402,0,0,, % "ahk_id " HStatusBar ;SB_GETTEXTW := 0x40D ;SB_GETTEXTA := 0x402
bekomme ich:
92688488

damit kann ich nichts anfangen.
Wie müsste mein Code aussehen, damit ich feststellen kann, ob icht mit SB_GETTEXT, den Text des Statusbars bekommen kann?

Gruß und Danke
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Statusleistentext auslesen

28 Feb 2021, 04:37

... my code is OK if I want to read the status bar of MY program, but it cannot work for an external program
Vll ist das ja auch dein Problem?? https://social.msdn.microsoft.com/Forums/fr-FR/1cc63d89-4c25-4887-bdd5-b028f5698586/cannot-use-sbgettext-results-in-a-crash-need-help-?forum=exceldev

Die Zahl scheint wohl der retournierte ErrorLevel zu sein (?)

JFTR: Hier noch ne Liste mit reichlich WM_ Futter: https://www.programmersought.com/article/87852732426/
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Statusleistentext auslesen

28 Feb 2021, 06:07

Moin,

zunächst würde ich versuchen, die Textlänge per SB_GETTEXTLENGTH abzufragen. Wenn das ein plausibles Ergebnis liefert, hast Du eine Chance. Den Speicherbereich für die Rückgabe des Textes musst Du allerdings (siehe BoBo's erster Link) im Adressraum des externen Programms reservieren und die Adresse für WM_GETTEXT im lParam übergeben.
Nussbeisser
Posts: 113
Joined: 17 Jul 2019, 08:49

Re: Statusleistentext auslesen

28 Feb 2021, 09:07

@BoBo
Die Zahl scheint wohl der retournierte ErrorLevel zu sein (?)
Ja, genau

@just me

Code: Select all

SendMessage, 0x403,0,0,, % "ahk_id " HStatusBar ; SB_GETTEXTLENGTH 0x403 ansi, 0x40C unicode
SB_GETTEXTLENGTH liefert
bei unicode = 0
bei ansi = 268435456

Ist das plausibel?
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Statusleistentext auslesen

28 Feb 2021, 09:47

Wenn mich die AHK-Hilfe nicht täuscht wäre '0' doch das erwünschte Ergebnis, oder?!

Rethorische Frage: macht es Sinn, und hat jemand Lust einen RegEx zu bauen, welcher über eine Sammlung wie :arrow: diese laufend, einen Output als Send-PostMessage-AHK-Fertigbefehl liefert (mit der Beschreibung als Kommentar)??

Auszug aus der verlinkten Liste ...

Code: Select all

// Listview control notification messages  
     (-100-0) / * _ LVN_ITEMCHANGING * /, "notice Listview control's parent window: there is a project being changed"  
     (-100-1) / * _ LVN_ITEMCHANGED * /, "notice Listview control's parent window: have a project has been changed"  
     (-100-2) / * _ LVN_INSERTITEM * /, "notice Listview control's parent window: there is a new item is inserted into the"  
     (-100-3) / * _ LVN_DELETEITEM * /, "notice Listview control's parent window: There are items to be deleted"  
     (-100-4) / * _ LVN_DELETEALLITEMS * /, "notice Listview control's parent window: All items to be deleted"  
     (-100-5) / * _ LVN_BEGINLABELEDITA * /, "notice Listview control's parent window: editing text labels starting point for a project"  
     (-100-75) / * _ LVN_BEGINLABELEDITW * /, "notice Listview control's parent window: editing text labels starting point for a project"  
     (-100-6) / * _ LVN_ENDLABELEDITA * /, "notice Listview control's parent window: a text label to edit a project of the end"  
     (-100-76) / * _ LVN_ENDLABELEDITW * /, "notice Listview control's parent window: a text label to edit a project of the end"  
     (-100-8) / * _ LVN_COLUMNCLICK * /, "notice Listview control's parent window: a column is clicked"  
     (-100-9) / * _ LVN_BEGINDRAG * /, "notice Listview control's parent window: the left mouse button to drag and drop operation began"  
     (-100-11) / * _ LVN_BEGINRDRAG * /, "notice Listview control's parent window: Right-mouse drag and drop operation began"  
     (-100-13) / * _ LVN_ODCACHEHINT * /, "the notification message sent by the dashed control list when the contents of the visible area is changed",  
     (-100-52) / * _ LVN_ODFINDITEMA * /, "notification message is sent by the virtual list control when its owner need to find a specific callback project"  
     (-100-79) / * _ LVN_ODFINDITEMW * /, "notification message is sent by the virtual list control when its owner need to find a specific callback project"  
     (-100-14) / * _ LVN_ITEMACTIVATE * /, "notification message is sent by the virtual control list when the user activates an item"  
     (-100-15) / * _ LVN_ODSTATECHANGED * /, "the notification message sent by the dashed control list arranged in the state of an item or has been changed",  
     (-100-21) / * _ LVN_HOTTRACK * /, "send a notification message from the virtual list control passing an item in the user's mouse"  
     (-100-50) / * _ LVN_GETDISPINFOA * /, "sent by the virtual list control, request the parent window display items or provide the information needed for a project sequencing"  
     (-100-77) / * _ LVN_GETDISPINFOW * /, "sent by the virtual list control, request the parent window display items or provide the information needed for a project sequencing"  
     (-100-51) / * _ LVN_SETDISPINFOA * /, "notice Listview control's parent window: it was an item of information update"  
     (-100-78) / * _ LVN_SETDISPINFOW * /, "notice Listview control's parent window: it was an item of information update"  
     (-100-56) / * _ LVN_MARQUEEBEGIN * /, "notice Listview control's parent window: Select a frame start"  
  (-100-57) / * _ LVN_GETINFOTIPA * /, "the notification message, the Listview control has LVS_EX_INFOTIP extended style of large icons in the text it to request additional information (displayed in the tooltip control) is sent when"  
     (-100-58) / * _ LVN_GETINFOTIPW * /, "the notification message, the Listview control has LVS_EX_INFOTIP extended style of large icons in the text it to request additional information (displayed in the tooltip control) is sent when"
Für mich Angstschweisstreibend. Für just-me & friends wahrscheinlich eine debugging/reverse engineering Lektüre während im Hintergrund "The Masked Singer" o.ä. läuft: https://www.programmersought.com/article/25365052307 :P
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Statusleistentext auslesen

01 Mar 2021, 06:35

Moin,
Return value

Returns a 32-bit value that consists of two 16-bit values. The low word specifies the length, in characters, of the text. The high word specifies the type of operation used to draw the text. The type can be one of the following values:
...
Der Rückgabewert der ANSI-Nachricht ist 268435456 -> 0x1000 0000. Das ergibt für das 'high word' den Wert 0x1000 und das ist SBT_OWNERDRAW. Das 'low word' für die Textlänge ist schlicht 0. Das ist für mich ein plausibler Wert.

SBT_OWNERDRAW heißt, der Text wird vom Eigentümer des Elternfensters gezeichnet. Der von SB_GETTEXT zurückgegebene Wert 92688488 wäre in diesem Fall eine Art ID für den auszugebenen Text.
Nussbeisser
Posts: 113
Joined: 17 Jul 2019, 08:49

Re: Statusleistentext auslesen

02 Mar 2021, 18:34

Kannst du bitte ein beispiel zeigen, komme irgendwie nicht weiter

Code: Select all

SbBuffer := 0x1000
VarSetCapacity(SbText, SbBuffer)
SendMessage, 0x000D, SbBuffer, &SbText, StatusBar20WndClass1, A
MsgBox, %  ErrorLevel "-" SbText
Habe mit OCR versucht, von 10 versuchen wurden gerade mal 3 richtig erkannt, daher wäre super, wenn es mit WM_GeTText funtktionieren würde.
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Statusleistentext auslesen

03 Mar 2021, 12:11

Hi, auf die Schnelle: Ich glaube nicht, dass man den Text auslesen kann.
Nussbeisser
Posts: 113
Joined: 17 Jul 2019, 08:49

Re: Statusleistentext auslesen

03 Mar 2021, 12:34

Schade,
heute kam die Software "Power Automate Desktop" von Microsoft raus. Es bietet ähnliche funktionen wie AHK, ohne Programmierkenntnisse nur durch Drag & Drop.
Leider habe ich damit auch kein Erfolg gehabt, Die Statusbar von notepad konnte es ohne Probleme lesen aber bei meine Software leider nicht.
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Statusleistentext auslesen

04 Mar 2021, 06:33

Moin,

wenn meine Vermutung zu SBT_OWNERDRAW zutrifft, verwaltet die StatusBar den Text nicht selbst. Deshalb kann sie den auch nicht zurückgeben.

Return to “Ich brauche Hilfe”

Who is online

Users browsing this forum: No registered users and 12 guests