StMaSi

Richedit Control Options

14 posts in this topic

#1 ·  Posted

Two questions...

When presenting a form containing a richedit control, is there any way to make the displayed text, within said richedit control, non-selectable?

In addition, is there any way to hide the vertical line cursor, within said richedit control?

Thanx.

Share this post


Link to post
Share on other sites



#2 ·  Posted

StMaSi,

WinSetState($hRichEdit, "", @SW_DISABLE) should do both for you.

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

#3 ·  Posted

Well, that does, in fact, disable the control, but the background now turns from white to grey and the text is greyed out as well. Is there a way to have the control disabled in this manner, but to restore the background and text color to what they were prior to disabling the control?

Share this post


Link to post
Share on other sites

#4 ·  Posted

StMaSi,

How about a mask like this:

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>

Global $hGUI, $hGUI_Mask

Example()

Func Example()
    Local $hRichEdit, $iMsg
    $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "This is more text")

    $cButton = GUICtrlCreateButton("Test", 10, 300, 80, 30)

    GUISetState(@SW_SHOW)

    $aGUI_Pos = WinGetPos($hGUI)
    $hGUI_Mask = GUICreate("Mask", 300, 220, 0, 0, BitOR($WS_POPUP, $WS_BORDER), 0, $hGUI)
    GUISetBkColor(0xCCCCFF) ; Just so you can see the GUI in the example
    WinMove($hGUI_Mask, "", $aGUI_Pos[0] + 10, $aGUI_Pos[1] + 35)
    GUISetState(@SW_SHOWNOACTIVATE, $hGUI_Mask)
    WinSetTrans($hGUI_Mask, "", 100)

    ; Look for the main GUI moving
    GUIRegisterMsg($WM_MOVE, "_WM_MOVE")

    While True
        $iMsg = GUIGetMsg()
        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes
                ; GUIDelete()   ; is OK too
                Exit
            Case $iMsg = $cButton
                ConsoleWrite("Hit" & @CRLF)
        EndSelect

        If _WinAPI_GetFocus() = $hRichEdit Then
            _WinAPI_SetFocus($hGUI_Mask)
        EndIf

    WEnd

EndFunc   ;==>Example

Func _WM_MOVE($hWnd, $iMsg, $wParam, $lParam)
    ; If the main GUI moves
    If $hWnd = $hGUI Then
        ; Move the child to follow
        Local $aGUI_Pos = WinGetPos($hWnd)
        WinMove($hGUI_Mask, "", $aGUI_Pos[0] + 10, $aGUI_Pos[1] + 35)
    EndIf
EndFunc   ;==>_WM_MOVE

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

#5 ·  Posted

Unfortunately, that hides my entire form.

Share this post


Link to post
Share on other sites

#6 ·  Posted

StMaSi,

No it does not, it only masks the RichEdit control - if it does more than that then you have messed up the sizing code. Please post what you are using and I will take a look.

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

#7 ·  Posted

Okay. Here's my code...

#include <Date.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <GuiMenu.au3>
#include <GuiRichEdit.au3>
#include <MenuConstants.au3>
#include <Timers.au3>
#include <WindowsConstants.au3>

AutoItSetOption("TrayIconHide", 1)
AutoItSetOption("WinDetectHiddenText", 1)
AutoItSetOption("WinSearchChildren", 1)
AutoItSetOption("WinTitleMatchMode", -2)

Local $COUNTDOWN1 = IniRead(@ScriptDir & "\welcome.ini", "Parameters", "DelayTime", 10)
Local $TIMER1 = $COUNTDOWN1
Local $WINDOWS_ONTOP = 1

HotKeySet("!{F4}", "_HawkingHole")

GUISetIcon(@ScriptDir & "\welcome.ico", -1)
$RICHTEXTFILE1 = FileRead(@ScriptDir & "\welcome.rtf")
$FORM1 = GUICreate("Welcome", 600, 400, -1, -1, $WS_EX_TOPMOST, $WM_SYSCOMMAND + $WS_EX_WINDOWEDGE)
$PICTURE1 = GUICtrlCreatePic(@ScriptDir & "\welcome.bkg.jpg", 0, 0, 594, 371)
GUICtrlSetState(-1, $GUI_DISABLE)
$PICTURE2 = GUICtrlCreatePic(@ScriptDir & "\welcome.bnr.jpg", 2, 2, 157, 331)
GUICtrlSetState(-1, $GUI_DISABLE)
$PROGRESS1 = GUICtrlCreateProgress(230, 348, 170, 10)
$LABEL1 = GUICtrlCreateLabel("* Welcome", 10, 345, 190, 25)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$BUTTON1 = GUICtrlCreateButton("Upgrade", 433, 340, 75, 25)
$BUTTON2 = GUICtrlCreateButton("Defer", 513, 340, 75, 25)
$RICHEDITCONTROL1 = _GUICtrlRichEdit_Create($FORM1, $RICHTEXTFILE1, 175, 1, 415, 185, BitOR($ES_LEFT, $ES_MULTILINE, $ES_WANTRETURN, $ES_READONLY), 0)
_GUICtrlRichEdit_SetText($RICHEDITCONTROL1, $RICHTEXTFILE1)
_GUICtrlEdit_SetSel($RICHEDITCONTROL1, 600, 600)
WinSetState($RICHEDITCONTROL1, "", @SW_DISABLE)
GUIRegisterMsg($WM_SYSCOMMAND, "On_WM_SYSCOMMAND")
DisableButton($FORM1, $SC_CLOSE)
DisableButton($FORM1, $SC_MAXIMIZE)
DisableButton($FORM1, $SC_MINIMIZE)
DisableButton($FORM1, $SC_MOVE)
DisableButton($FORM1, $SC_RESTORE)
DisableButton($FORM1, $SC_SIZE)
_Timer_SetTimer($FORM1, 1000, '_Countdown')
GUISetState(@SW_SHOW)
OnTop()

While 1
    $IMSG = GUIGetMsg()
    Switch $IMSG
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BUTTON1
            $UDATE = _NowCalcDate()
            $UTIME = _NowTime(5)
            $USTRING = @ComputerName & ", " & $UDATE & ", " & $UTIME
            $UFILENAME = "results.txt"
            $UFILEPATH = FileOpen(@ScriptDir & '\_log\' & $UFILENAME, 9)
            FileWrite($UFILEPATH, $USTRING & ", Upgraded" & @CRLF)
            FileClose($UFILEPATH)
            ;GUISetState(@SW_HIDE)
            Run(@ScriptDir & "\02.upgrade.exe")
            ;Exit
        Case $BUTTON2
            $DDATE = _NowCalcDate()
            $DTIME = _NowTime(5)
            $DSTRING = @ComputerName & ", " & $DDATE & ", " & $DTIME
            $DFILENAME = "results.txt"
            $DFILEPATH = FileOpen(@ScriptDir & '\_log\' & $DFILENAME, 9)
            FileWrite($DFILEPATH, $DSTRING & ", Deferred" & @CRLF)
            FileClose($DFILEPATH)
            ;GUISetState(@SW_HIDE)
            Run(@ScriptDir & "\03.defer.exe")
            ;Exit
    EndSwitch
WEnd

Func _HawkingHole()
    ; Disable ALT+F4 key combination
EndFunc   ;==>_HawkingHole

Func On_WM_SYSCOMMAND($FORM1, $MESSAGE1, $WPARAM, $LPARAM)
    If BitAND($WPARAM, 0xFFF0) = $SC_MOVE Then Return False
    Return $GUI_RUNDEFMSG
EndFunc   ;==>On_WM_SYSCOMMAND

Func DisableButton($FORM1, $IBUTTON)
    $HSYSMENU = _GUICtrlMenu_GetSystemMenu($FORM1, 0)
    _GUICtrlMenu_RemoveMenu($HSYSMENU, $IBUTTON, False)
    _GUICtrlMenu_DrawMenuBar($FORM1)
EndFunc   ;==>DisableButton

Func _Countdown($FORM1, $IMSG, $IIDTIMER, $DWTIME)
    $COUNTDOWN1 -= 1
    $PERCENT_VALUE = Floor(($COUNTDOWN1 / $TIMER1) * 100)
    $PERCENT_VALUE = 100 - $PERCENT_VALUE
    If $COUNTDOWN1 > 0 Then
        GUICtrlSetData($PROGRESS1, $PERCENT_VALUE)
    ElseIf $COUNTDOWN1 = 0 Then
        GUICtrlSetData($PROGRESS1, $PERCENT_VALUE)
        _Timer_KillTimer($FORM1, $IIDTIMER)
        ControlClick($FORM1, '', $BUTTON1)
    EndIf
EndFunc   ;==>_Countdown

Func _SecsToTime($ITICKS)
    Local $IHOURS, $IMINUTES, $ISECONDS
    _TicksToTime($ITICKS * 1000, $IHOURS, $IMINUTES, $ISECONDS)
    Return StringFormat("%2i:%02i", $IMINUTES, $ISECONDS)
EndFunc   ;==>_SecsToTime

Func OnTop()
    Global $DISPLAY = WinGetHandle($FORM1)
    WinSetOnTop($DISPLAY, "", $WINDOWS_ONTOP)
EndFunc   ;==>OnTop

When I add the...

WinSetState($RICHEDITCONTROL1, "", @SW_DISABLE)

The richedit control is greyed out. However, when I attempted to incorporate your mask code, the entire form would not display. Like you said, I must be attempting to incorporate your code improperly (it's not currently within this code). Can you assist with the incorporation?

Thanx.

Share this post


Link to post
Share on other sites

#8 ·  Posted

Here's something a little simpler. I used this when I was working on a console application and wanted to use a rich edit

Creating a label over the area where the richedit control is and setting the label's backcolor to $GUI_BKCOLOR_TRANSPARENT

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>

Global $hGUI

Example()

Func Example()
    Local $hRichEdit, $iMsg
    $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1)
    $lblMask = GUICtrlCreateLabel("", 10, 10, 300, 220)
    GUICtrlSetBkColor($lblMask, $GUI_BKCOLOR_TRANSPARENT)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "This is more text")
    ; Prevent the richedit from being entered using the 'Tab' key
    _WinAPI_SetWindowLong($hRichEdit, $GWL_STYLE, BitAND(_WinAPI_GetWindowLong($hRichEdit, $GWL_STYLE), BitNOT($WS_TABSTOP)))

    $cButton = GUICtrlCreateButton("Test", 10, 300, 80, 30)
    ; Set the button to focus so the richedit control doesn't have focus (having focus would let someone type in it)
    GUICtrlSetState($cButton, $GUI_FOCUS)

    GUISetState(@SW_SHOW)

    While True
        $iMsg = GUIGetMsg()
        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes
                ; GUIDelete()   ; is OK too
                Exit
            Case $iMsg = $cButton
                ConsoleWrite("Hit" & @CRLF)
        EndSelect
    WEnd

EndFunc   ;==>Example

 

Share this post


Link to post
Share on other sites

#9 ·  Posted

InunoTaishou,

Great idea and much simpler than mine. I think I became fixated on using a child GUI because I had been working on one earlier on the day.

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

#10 ·  Posted

When utilizing the following two bits of code from InunoTaishou, the richedit control remains active (not greyed out) and the cursor is not flashing because the focus is on the label:

...
_WinAPI_SetWindowLong($RICHEDITCONTROL1, $GWL_STYLE, BitAND(_WinAPI_GetWindowLong($RICHEDITCONTROL1, $GWL_STYLE), BitNOT($WS_TABSTOP)))
...
GUICtrlSetState($LABEL1, $GUI_FOCUS)
...

However, the richedit control is still selectable...a user can click into it, which exposes the cursor and/or double-click into it and highlight text within. Short of utilizing individual labels for the information that would be contained within one richedit control, is there no other way to "lock down" (for lack of a better term) the richedit control, but avoid disabling it (the graying out)?

Thanx again for all your help, peeps.

Share this post


Link to post
Share on other sites

#11 ·  Posted

StMaSi,

Quote

However, the richedit control is still selectable...a user can click into it, which exposes the cursor and/or double-click into it and highlight text within

Really? I have just been trying to do just that and I cannot get at the RichEdit at all. How did you manage it?

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

#12 ·  Posted

Perhaps my mouse-clicking is more powerful than yours?

 

B)

Share this post


Link to post
Share on other sites

#13 ·  Posted

Create the RichEdit in a child window and disable the child window:

Create the RichEdit in a child window and disable the child window:

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
  $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1)

  $hChild = GUICreate( "", 300, 220, 10, 10, $WS_CHILD, -1, $hGui )
  GUISetState( @SW_DISABLE )
  GUISetState()

  $hRichEdit = _GUICtrlRichEdit_Create($hChild, "This is a test.", 0, 0, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
  _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "This is more text")

  GUISwitch( $hGui )
  GUISetState()

  While GUIGetMsg() <> $GUI_EVENT_CLOSE
  WEnd
EndFunc

 

Share this post


Link to post
Share on other sites

#14 ·  Posted

I'm going to guess and say that the label you created over the richedit control is not actually over the richedit control. So you're just clicking on the richedit.

Do this and see where your label is actually at

GUICtrlSetBkColor($LABEL1, 0xFF0000)

 

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

  • Similar Content

    • loganizzi
      By loganizzi
      If you look at the help file for the above command, you'll see that it states that it only works for certain zoom values (100 and 200 to 6400).   I assume that this is due to an issue in an MSDN library that the command relies on.
      After doing some investigating, I noticed that the GUIRichEdit.au3 library file contains the following code:
      ; #FUNCTION# ==================================================================================================================== ; Authors........: Chris Haslam (c.haslam) ; Modified ......: ; =============================================================================================================================== Func _GUICtrlRichEdit_SetZoom($hWnd, $iPercent) If Not _WinAPI_IsClassName($hWnd, $__g_sRTFClassName) Then Return SetError(101, 0, False) If Not __GCR_IsNumeric($iPercent, ">0") Then Return SetError(1021, 0, False) Local $iNumerator, $iDenominator Select Case Not ($iPercent = 100 Or ($iPercent >= 200 And $iPercent < 6400)) Return SetError(1022, 0, False) Case $iPercent >= 100 $iNumerator = 10000 $iDenominator = 10000 / ($iPercent / 100) Case Else $iNumerator = 10000 * ($iPercent / 100) $iDenominator = 10000 EndSelect Return _SendMessage($hWnd, $EM_SETZOOM, $iNumerator, $iDenominator) <> 0 EndFunc ;==>_GUICtrlRichEdit_SetZoom Which ensures that values are only within the bounds specified in the help file.    I found that if I comment out the portion of the code that limits the values, the function works fine for most (if not all) values.   I changed the code in the library file to this by simply commenting out the restricting lines of code:
      ; #FUNCTION# ==================================================================================================================== ; Authors........: Chris Haslam (c.haslam) ; Modified ......: ; =============================================================================================================================== Func _GUICtrlRichEdit_SetZoom($hWnd, $iPercent) If Not _WinAPI_IsClassName($hWnd, $__g_sRTFClassName) Then Return SetError(101, 0, False) If Not __GCR_IsNumeric($iPercent, ">0") Then Return SetError(1021, 0, False) Local $iNumerator, $iDenominator Select ; Case Not ($iPercent = 100 Or ($iPercent >= 200 And $iPercent < 6400)) ; Return SetError(1022, 0, False) Case $iPercent >= 100 $iNumerator = 10000 $iDenominator = 10000 / ($iPercent / 100) Case Else $iNumerator = 10000 * ($iPercent / 100) $iDenominator = 10000 EndSelect Return _SendMessage($hWnd, $EM_SETZOOM, $iNumerator, $iDenominator) <> 0 EndFunc ;==>_GUICtrlRichEdit_SetZoom  
      I assume whatever windows bug existed at the time this was created, no longer exists so there is no need to restrict the values.   
      Just wanted to point this out if anyone else is using this part of the library and required this functionality like I did.
       
    • AndreyS
      By AndreyS
      Tell me, please, how to set / change the cursor over RichEdit (created with _GUICtrlRichEdit_Create)?
    • houser747
      By houser747
      I have previously used _IEFormElementGetObjByName and _IEFormElementSetValue to enter text into a search box on a form and then submit the form.
      I am now trying to enter text into a search box which is not part of a form. 
      Here is the HTML from the website that i'm trying to enter the data on and then submit the search.
      <div class="row">
          <div class="form-group col-xs-12">
              <span id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_lblSearchText" for="input-search">Registreringsbeteckning</span>
              <div class="input-group col-xs-12">
                  <span id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_preSearchText" class="input-group-addon">SE -</span>
                  <input name="ctl00$FullWidthWithSubmenuContent$FullWidthContent$MainContent$AircraftRegistry$txtSearchText" type="text" value="DTH" id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_txtSearchText" class="form-control" />
              </div>
          </div>
      </div>
      <div class="row">
          <div class="form-group col-xs-12">
              <label class="sr-only" for="">Sök</label>
              <input type="submit" name="ctl00$FullWidthWithSubmenuContent$FullWidthContent$MainContent$AircraftRegistry$btnSearch" value="Sök" id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_btnSearch" class="btn btn-primary ladda-button" data-style="expand-right" />
          </div>
      </div>
      Many thanks in advance
      cheers
      Roger
    • robcull
      By robcull
      Hello all! I have had some issues reading text from different types of windows, occasionally, specifically with controlgettext. 
      **Before I begin, I know there are better ways to do what I attempt in the example below. That's not the point of this post. The point is my issues with controlgettext. 
      I am about to cite an example with an application you may be familiar with called SpeedFan (v4.52). My problem is not specific to speedfan, it is simply the most recent and easily reproducible example I can think of. 
      So, the goal of the script below is to get a string of text containing the current fan RPMs from the highlighted control in the screenshot below (see "speedfan_control_details.png").

      Now, here's a simple script for grabbing the window handle and reading the text from that control: 
      $wintitle = "SpeedFan 4.52" $controlID = "197934" ;will be reformatted as "[ID:######]" $hwnd = wingethandle($wintitle) if @error<>0 then msgbox(0, "WinGetHandle", "FAILURE. @error="&@error) Exit EndIf $text = ControlGetText($hwnd, "", "[ID:"&$controlID&"]") if @error=1 then msgbox(0, "ControlGetText", "FAILURE. @error="&@error) ;failure returns "" and @error=1 Exit EndIf msgbox (0, "ControlGetText", "SUCCESS. @error="&@error &@CRLF& "$text="&$text) ;success returns string and @error=0 You'll see that the ControlGetText operation runs without error, however it does not capture any text from the control. If you explore the other controls in this one window, you'll find mixed results across the board. Neither the temps nor voltages can be read, while the log field and some other elements can be read. Even when you read the text from the whole window, those elements are not included in the visible nor hidden texts. 
       
      I have run into this issue many times in the past- inconsistencies in the ability of autoit to interact with certain controls. What is it which makes this text different than any other readable texts? Is there an alternate method of reading the text in the window/control which could work? Any and all info to help me solve this mystery and satisfy my curiosity would be greatly appreciated. 
      Thanks  -Rob C
      PS: Running Autoit v3.3.14.2 on Win7 Ultimate x64