Jump to content
marcoauto

GDI outline text scaled in gui

Recommended Posts

marcoauto

ciao,

I need to scale an outlined GDI text in a GUI. The problem is that I can't do this. The outline is often out of the GUI

I started from this script:

https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_PathTransform.htm

that fit a string to windows and I changed

 $aBounds = _GDIPlus_PathGetWorldBounds($hPath) ;Get bounding rectangle of the path

$aBounds = _GDIPlus_PathGetWorldBounds($hPath) ;Get bounding rectangle of the path

with 

$aBounds = _GDIPlus_PathGetWorldBounds($hPath,$hMatrix,$hPen) ;Get bounding rectangle of the path with pen size

but doesn't work

so, I tried to change other thins, but nothing... Sometimes works, but if I change the string often result change

This is my script:

#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <array.au3>

Example()

Func Example()
    Local $iW, $iH, $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hFamily, $tLayout, $hMatrix, $aBounds

    ; Create GUI
    $iW = 650
    $iH = 300
    $hGUI = GUICreate("GDI+", $iW, $iH)
    GUISetState(@SW_SHOW)

    ; Draw a string using path
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;Sets the graphics object rendering quality (antialiasing)
;~  _GDIPlus_GraphicsClear($hGraphic, 0xFF000000)

    $MergedImageBackgroundColor = 0x00000000
    _GDIPlus_GraphicsClear($hGraphic, $MergedImageBackgroundColor)

    $hBrush = _GDIPlus_BrushCreateSolid(0xFFDD2200)
    $stroke_size = 15
    $hPen = _GDIPlus_PenCreate(0xFFFFBB00, $stroke_size)    ;stroke size in pixel
        $hPen2 = _GDIPlus_PenCreate(0xFFFFff00, 2)  ;stroke size in pixel
    _GDIPlus_PenSetLineJoin($hPen,$GDIP_PENSETLINEJOIN_ROUND)

    $hPath = _GDIPlus_PathCreate() ;Create new path object
;~  $fSize = 20
    $hFamily = _GDIPlus_FontFamilyCreate("Myriad Pro") ;Create font family object
    $tLayout = _GDIPlus_RectFCreate() ;Create string bounding rectangle X=0, Y=0

    Local $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_PathAddString($hPath, "autoitForeverLollipop", $tLayout, $hFamily);, 0, $fSize, $hFormat) ;Add the outline of the string to the path
;~     _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $fSize, $hFormat)

    ; Tranform Path to fit to window
    $aBounds = _GDIPlus_PathGetWorldBounds($hPath) ;Get bounding rectangle of the path
    $aPoints = _GDIPlus_PathGetPoints($hPath)
    ConsoleWrite($aBounds[0] & @CRLF)
    ConsoleWrite($aBounds[1] & @CRLF)
    ConsoleWrite($aBounds[2] & @CRLF)
    ConsoleWrite($aBounds[3] & @CRLF)
    ConsoleWrite($aPoints[$aPoints[0][0]][0] & " - " & $aPoints[1][0] & " + 2*" & $stroke_size & " = " & $aPoints[$aPoints[0][0]][0]-$aPoints[1][0]+2*$stroke_size & @CRLF)
;~ $aBounds[0] = $aBounds[0]

    $aBoundsNp = _GDIPlus_PathGetWorldBounds($hPath,0,$hPen) ;Get bounding rectangle of the path with pen
    ConsoleWrite($aBoundsNp[0] & @CRLF)
    ConsoleWrite($aBoundsNp[1] & @CRLF)
    ConsoleWrite($aBoundsNp[2] & @CRLF)
    ConsoleWrite($aBoundsNp[3] & @CRLF)
    ConsoleWrite($iW & " / 2 = "  & $iW / 2 & @CRLF)
    ConsoleWrite("$ih / 2 = "  & $iH / 2 & @CRLF)
;~  ConsoleWrite($iW & " $aBounds[2] = "  & $iW / $aBounds[2] & @CRLF)
    ConsoleWrite($iW & " $aBoundsNp[2] = "  & $iW / $aBoundsNp[2] & @CRLF)
    ConsoleWrite($iH & " $aBoundsNp[3] = "  & $iH / $aBoundsNp[3] & @CRLF)
;~ _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
;~  _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
    $hMatrix = _GDIPlus_MatrixCreate()
    $iW = $iW - $stroke_size ;+ $stroke_size
    $iH = $iH - $stroke_size
    ConsoleWrite(" -$aBounds[0]+1*$stroke_size/72 = " &  -$aBounds[0]+1*$stroke_size/72 & @CRLF)
    ConsoleWrite(" -1.8+1*$stroke_size/72 = " &  -1.8+1*$stroke_size/72 & @CRLF)
    _GDIPlus_MatrixTranslate($hMatrix, -$aBounds[0]+2*$stroke_size/72, -$aBounds[1]+1*$stroke_size/72) ;Translate Matrix to the offset of the bounding rectangle
;~  _GDIPlus_MatrixTranslate($hMatrix, -1.59166666666667+0*($stroke_size/72), -$aBounds[1]+1*$stroke_size/72) ;Translate Matrix to the offset of the bounding rectangle
;~  _GDIPlus_MatrixScale($hMatrix, $iW / $aBounds[2], $iH / $aBounds[3], True) ;Scale Matrix
    _GDIPlus_MatrixScale($hMatrix, $iW / $aBounds[2], $iH / $aBounds[3], True) ;Scale Matrix
    _GDIPlus_PathTransform($hPath, $hMatrix) ;Translate and Scale Path

    $aBoundsNp = _GDIPlus_PathGetWorldBounds($hPath,0,$hPen) ;Get bounding rectangle of the path with pen
    ConsoleWrite($aBoundsNp[0] & @CRLF)
    ConsoleWrite($aBoundsNp[1] & @CRLF)
    ConsoleWrite($aBoundsNp[2] & @CRLF)
    ConsoleWrite($aBoundsNp[3] & @CRLF)

;~  _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example

if you change the line 

_GDIPlus_PathAddString($hPath, "autoitForeverLollipop", $tLayout, $hFamily);, 0, $fSize, $hFormat) ;Add the outline of the string to the path

with a smaller string

_GDIPlus_PathAddString($hPath, "autoitFitted", $tLayout, $hFamily);, 0, $fSize, $hFormat) ;Add the outline of the string to the path

the result is ok

Can someone can help me?

Thankyou

Share this post


Link to post
Share on other sites
UEZ

After I installed the font "Myriad Pro" your script worked unchanged properly. The result is ok.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
marcoauto

Can you please change 

_GDIPlus_PathAddString($hPath, "autoitFitted", $tLayout, $hFamily);, 0, $fSize, $hFormat) ;Add the outline of the string to the path

with

_GDIPlus_PathAddString($hPath, "123", $tLayout, $hFamily);, 0, $fSize, $hFormat) ;Add the outline of the string to the path

and tell me if the result is ok? Because for me is not ok. I've attached an image where you can see that the only correct result is where the string is "Autofitted". The other three string are wrong: "autoit" is cut to the right and a bit on the bottom, same thing for "123" and "autoitForeverLollipop" is cut on the left.

I think I'm wrong somewhere... 

After hours of tests I tried to divide by 72 the $strokeSize of the pen. I've tried 72 because the screen is 72dpi but I don't know if is a good idea.

these problems there are with all fonts that I've tried (Arial, too)

thanks and sorry for my bad english

marco

fitToWindows.jpg

Share this post


Link to post
Share on other sites
UEZ

Does this work for you?

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $iW, $iH, $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hFamily, $tLayout, $hMatrix, $aBounds

    ; Create GUI
    $iW = 800
    $iH = 400
    $hGUI = GUICreate("GDI+", $iW, $iH)
    GUISetState(@SW_SHOW)

    ; Draw a string using path
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;Sets the graphics object rendering quality (antialiasing)
    _GDIPlus_GraphicsClear($hGraphic, 0xFF000000)

    $hBrush = _GDIPlus_BrushCreateSolid(0xFFDD2200)
    $iPenWidth = 8
    $hPen = _GDIPlus_PenCreate(0xFFFFBB00, $iPenWidth)

    $hPath = _GDIPlus_PathCreate() ;Create new path object

    $hFamily = _GDIPlus_FontFamilyCreate("Arial") ;Create font family object
    $tLayout = _GDIPlus_RectFCreate() ;Create string bounding rectangle X=0, Y=0
    _GDIPlus_PathAddString($hPath, "123", $tLayout, $hFamily) ;Add the outline of the string to the path

    ; Tranform Path to fit to window
    $aBounds = _GDIPlus_PathGetWorldBounds($hPath) ;Get bounding rectangle of the path

    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, -$aBounds[0], -$aBounds[1]) ;Translate Matrix to the offset of the bounding rectangle
    _GDIPlus_MatrixScale($hMatrix, ($iW - Ceiling(($iPenWidth + 1) / 2)) / $aBounds[2], ($iH - Ceiling(($iPenWidth + 1)/ 2)) / $aBounds[3], True) ;Scale Matrix
    _GDIPlus_PathTransform($hPath, $hMatrix) ;Translate and Scale Path

    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example

 


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
marcoauto

ciao Uez,

thanks for the reply, but unfortunately, the bug is still there.

If you write "Autoit" you will see the error

But I have found the solution. This works!!!!

Thankyou for the help!

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $iW, $iH, $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hFamily, $tLayout, $hMatrix, $aBounds

    ; Create GUI
    $iW = 800
    $iH = 400
    $hGUI = GUICreate("GDI+", $iW, $iH)
    GUISetState(@SW_SHOW)

    ; Draw a string using path
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;Sets the graphics object rendering quality (antialiasing)
    _GDIPlus_GraphicsClear($hGraphic, 0xFF000000)

    $hBrush = _GDIPlus_BrushCreateSolid(0xFFDD2200)
    $iPenWidth = 16
    $hPen = _GDIPlus_PenCreate(0xFFFFBB00, $iPenWidth)
    _GDIPlus_PenSetLineJoin($hPen,$GDIP_PENSETLINEJOIN_ROUND)

    $hPath = _GDIPlus_PathCreate() ;Create new path object

    $hFamily = _GDIPlus_FontFamilyCreate("Arial") ;Create font family object
    $tLayout = _GDIPlus_RectFCreate() ;Create string bounding rectangle X=0, Y=0
    _GDIPlus_PathAddString($hPath, "Autoit", $tLayout, $hFamily) ;Add the outline of the string to the path

    ; Tranform Path to fit to window
    $aBounds = _GDIPlus_PathGetWorldBounds($hPath) ;Get bounding rectangle of the path
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixScale($hMatrix, ($iW - $iPenWidth) / ($aBounds[2]), ($iH - $iPenWidth) / $aBounds[3], False) ;Scale Matrix
    _GDIPlus_PathTransform($hPath, $hMatrix) ;Translate and Scale Path

    $aBounds = _GDIPlus_PathGetWorldBounds($hPath)
    _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) ;Reset Matrix
    _GDIPlus_MatrixTranslate($hMatrix, -$aBounds[0]+$iPenWidth/2, -$aBounds[1]+$iPenWidth/2)
    _GDIPlus_PathTransform($hPath, $hMatrix) ;Translate and Scale Path

    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example

 

Share this post


Link to post
Share on other sites
UEZ

@marcoauto: well done! :thumbsup:

Even shorter:

...
    ; Tranform Path to fit to window
    $aBounds = _GDIPlus_PathGetWorldBounds($hPath) ;Get bounding rectangle of the path
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, -$aBounds[0], -$aBounds[1]) ;Translate Matrix to the offset of the bounding rectangle
    _GDIPlus_MatrixScale($hMatrix, ($iW - $iPenWidth) / $aBounds[2], ($iH - $iPenWidth) / $aBounds[3], True) ;Scale Matrix
    _GDIPlus_PathTransform($hPath, $hMatrix) ;Translate and Scale Path
    _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0)
    _GDIPlus_MatrixTranslate($hMatrix, $iPenWidth / 2, $iPenWidth / 2)
    _GDIPlus_PathTransform($hPath, $hMatrix)

    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
...
  • Like 1

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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

    • mdepot
      By mdepot
      I have a situation where I am repeatedly capturing a region of the screen and feeding it into Tesseract OCR.  Since the OCR is a relatively slow operation, I would like to create an in memory cache of the ocr results.  An ideal hash key for this cache would be a checksum of the captured image.  With this I could capture the region, checksum it, and then only if I don't get a cache hit I would write the image out to disk for external OCR.
      Now I know I can do this by saving the captured image out to disk, and then summing the disk file with _Crypt_HashFile().  But that's still slower than I would like, and it shouldn't be necessary.  Ideally, it should be possible to checksum the image data directly in memory so I don't have to go to disk at all.  In order to do that, I need a way to dump a representation of the image into a string  (or some equivalent).  Then I could use the _Crypt_HashData() function against that string to create my cache hash key.
      Googling around I found an article here that shows a way to convert an image object to a byte array using System.Drawing.  This was the closest thing I found to what I'm trying to do.  I don't know if that method could be used from within AutoIT, or if perhaps there may be a better way I don't know about.  If someone could give me a shove in the right direction it would be a big help.  Thanks!
    • caramen
      By caramen
      Hey.  
       
      I requested help about how to get a value from a text in a variable. 
      Now i know how to do that. But i learned with the command FileRead. Now i whould like to know how to replace the command :
      FileRead('Dossier.txt') The purpose is to read a webpage text. To find some value inside. 
       
      Btw i tryed to play with WindowsInfo.au3 but i dont got much thing.  
    • UEZ
      By UEZ
      Here some graphical examples written completely in FreeBasic just for fun.  
      3D Starfield Rotating Flight 3D Starfield Scrolling v1 Booster 3D Starfield Scrolling v3 Booster CreateWindowEx (hGUI) Example FB File2Bas Code Generator (AutoIt script) FB GFX Examples Fire Particles FMOD Examples GDI - GDI+ 3D Sinus Wave GDI - GDI+ Animated Pythagoras Tree GDI - GDI+ Particles - Repulsive Force Sim v2.0 GDI - GDI+ Plasma v5 Booster GDI - GDI+ Random Pattern GDI - GDI+ Space Flight GDI - GDI+ Tunnel Flight - WipeOut Style GDI Classic Raytraced Tunnel GDI Elastic Twister Effect GDI Exploding Pixels GDI Infinite Image Zoom Flight GDI Liquid Pixels GDI Particle Repulsion Grid GDI Particles Mouse Attraction GDI Starfield GDI The Nautilus Raymarcher GDI Worm Tunnel Flight GDI+ Impossible Possible GDI+ Kaleidoscope GDI+ Performance Test - Au3 vs FB GDI+ Polar Clock GDI+ Rotating Earth GDI+ Star Wars Scroller GDI+ Streamer GDI+ Swiss Railway Clock Ini Read - Write Mandelbrot Plasma Puristic Clock Rutt_Etra_Izer_Booster Tunnel Flight uFMOD _WinAPI_SetWindowTitleIcon  
      Download: FreeBasic Examples build 2018-07-10.rar
       
      I will add new examples from time to time.
       
      FreeBasic source codes are also included.
       
    • therks
      By therks
      I'm trying to create a simple clock widget that automatically scales the text to the size of the window. I came up with the following method, but it doesn't work as well as I'd like. It especially has trouble scaling to the width of the window for some reason (in the example, try resizing the window to be narrow and tall).
      Does anyone have a better method?
      #include <Misc.au3> #include <WinAPIConv.au3> #include <GUIConstants.au3> #include <GDIPlus.au3> Opt('MustDeclareVars', 1) Global $_FONT_FAMILY = 'Arial', $_LB_TEXT Main() Func Main() _GDIPlus_Startup() Local $hGUI GUIRegisterMsg($WM_SIZE, WM_SIZE) $hGUI = GUICreate('', 300, 100, Default, Default, $WS_OVERLAPPEDWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $_LB_TEXT = GUICtrlCreateLabel('This is a string', 0, 0, 300, 100, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont($_LB_TEXT, _MeasureString($hGUI, GUICtrlRead($_LB_TEXT), $_FONT_FAMILY), 0, 0, $_FONT_FAMILY, 5) GUISetState() Local $iGM While 1 $iGM = GUIGetMsg() Switch $iGM Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GDIPlus_Shutdown() EndFunc Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) GUICtrlSetFont($_LB_TEXT, _MeasureString($hWnd, GUICtrlRead($_LB_TEXT), $_FONT_FAMILY), 0, 0, $_FONT_FAMILY, 5) EndFunc Func _MeasureString($hWnd, $sString, $sFont = 'Arial') Local $iError, $aSize, $hGraphic, $hFormat, $hFamily, $tLayout, $iFontSize, $hFont, $aInfo If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) EndIf $aSize = WinGetClientSize($hWnd) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate($sFont) $tLayout = _GDIPlus_RectFCreate(0, 0, $aSize[0], $aSize[1]) $iFontSize = 0 Do If Not $hFamily Then $iError = 1 $iFontSize = 10 ExitLoop EndIf $iFontSize += 1 $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize, 0) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat) _GDIPlus_FontDispose($hFont) If $aInfo[1] = 0 Then ExitLoop Until DllStructGetData($aInfo[0], 3) >= $aSize[0] Or DllStructGetData($aInfo[0], 4) >= $aSize[1] $iFontSize -= 1 _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) Return SetError($iError, 0, $iFontSize) EndFunc
    • dadalt95
      By dadalt95
      Hi!
      I want to get the signal in this website:
      https://binary-signal.com/pt/chart/eurusd
      I have tried using _IEBodyReadText  and some _StringBetween. What happens is that the text are being update every tick and _IEBodyReadText doesn't.
      To perform the update I used  _IEAction($oIE, "refresh") but it's not good because the website block me after some time due too many requests..
      Is there any other way to get this text every tick?
      PS: The text I want to get is WAIT, CALL or PUT.
       
      Here is the code:
      global $oIE = _IECreate ('https://binary-signal.com/pt/chart/eurusd', 0, 1 , 1 , 0) Local $sText = _IEBodyReadText($oIE) $result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA') ;MsgBox ( 0, "asf", $result[0]) $espera=StringInStr($result[0], "WAIT") $compra=StringInStr($result[0], "CALL") $venda=StringInStr($result[0], "PUT") ;MsgBox($MB_SYSTEMMODAL, "", $espera) $n=0 $c=0 Captar() Func Captar() ;_IENavigate($oIE, "https://binary-signal.com/pt/chart/eurusd") ;MsgBox($MB_SYSTEMMODAL, "", $n) Local $sText = _IEBodyReadText($oIE) $result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA') If (Not $compra=0) And $n=0 Then MsgBox($MB_SYSTEMMODAL, "", "COMPRE") $n=1 $c=$c+1 ;_IEAction($oIE, "refresh") Sleep(60000) Captar() ElseIf (Not $venda=0) And $n=0 Then MsgBox($MB_SYSTEMMODAL, "", "VENDA") $c=$c+1 $n=1 ;_IEAction($oIE, "refresh") ;MsgBox($MB_SYSTEMMODAL, "", $n) Sleep(60000) Captar() ElseIf (Not $venda=0) And $n=1 Then ;MsgBox($MB_SYSTEMMODAL, "", "Esperando próxima rodada") $n=1 ;MsgBox($MB_SYSTEMMODAL, "", $n) ;_IEAction($oIE, "refresh") Sleep(60000) Captar() ElseIf (Not $venda=0) And $n=1 Then ;MsgBox($MB_SYSTEMMODAL, "", "Esperando próxima rodada") $n=1 ;MsgBox($MB_SYSTEMMODAL, "", $n) ;_IEAction($oIE, "refresh") Sleep(60000) Captar() Else ;MsgBox("", "", "ESPERE") $n=0 Sleep(1000) ;_IEAction($oIE, "refresh") Local $sText = _IEBodyReadText($oIE) $result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA') Captar() EndIf EndFunc  
×