Jump to content

Logic help


caramen
 Share

Recommended Posts

Hello guy I admit I would need help on this one. 

I tried multiples things. Without success and I think the main problem here is my skills. 

First I have to explain the goal. 

Here I did a big tool for one of my customer. He's doing a lot of things. But I want to implement into it one single function that make me fall in troubles. 

That would have been easy with a multi threads coding. But with AutoIT the fact that only one function can be executed at same time is my problem.

I have a RishEdit Input box. And there is already some functions that works perfectly with it. So I would like to not touch to the working code as much as possible.  

I want to read that rishedit input box constantly when she is filled by any technician. And then when it read it and detect some words. Display a tool tip with links inside or a GUI depending on what is the easier. I will decide that later. 

Now where is my issue into that. 

I have 2 major knowledge/logic issue. 

-First issue is the flashing tool tip. I will have to check about 25 000 Keys words. Into the rich edit control and when I will have one or multiples keyword that are detected Then display a link somewhere. If I check constantly Then if I check for one work that is always here after type it into the rish edit. My function read it correctly detect it corectly, but it does that constantly, so the tool tip is flashing. I would request help on this first issue. I don't know how to implement something to stop the flash.

-Second issue is when I have to check 5 simultaneous keywords I don't success to display each one of them into my tool tip without doing an infinite loop. 

I guess for that one I will have to use a for loop with an array ? 

What I have tried so far ? 

 

I tried to make a thread for my tool tip and play with it. But seem like it's even more complicated than single thread. Not succeeding to remove the tool tip after calling it. 

And here is one of my multiple attempts of single thread coding

Func OpenLink ()
    ;Nothing for now
    ConsoleWrite("+1"&@CRLF)
EndFunc

Func _ReadString ($TexteStringToCheck = "" , $String1 = Null , $String2 = Null, $String3 = Null, $String4 = Null , $String5 = Null , $String6 = Null , $String7 = Null )

    If StringInStr ($TexteStringToCheck , $String1 ) <> 0 And StringInStr ($TexteStringToCheck , $String1 ) <> @error And $String1 <> Null and $NombreToolTip <= 2 Then
        $sMsg = "String 1 = OK"
        $NombreToolTip += 1
        _CreateThread1_ToolTip ()
    Else
        $NombreToolTip = 0
        _CreateThread1_ToolTip ()
    EndIf

EndFunc

Func _CreateThread1_ToolTip ()
    Local $Timer = 0
        If $NombreToolTip = 1 Then
            ToolTip ( $sMsg , 0 , 0)
            Sleep(10)
            $Timer = TimerInit ()
        Else
            $Diff = TimerDiff ( $Timer )
                If $Diff >= 5000 Then
                    ToolTip ( "" )
                EndIf
        EndIf

EndFunc

Here if the function that using above ones

Func Func1000 () ;~ Insérer un masque Symptôme
    _CleanAndWait ()
    GUISetState(@SW_SHOW, $GUI3)
    While 1
        $hTexte = _GUICtrlRichEdit_GetText ( $hRish )
        _ReadString ($hTexte , "big ip" )

        Local $hNMsg = GUIGetMsg ( $GUI3 )
            Switch $hNMsg
                Case $OKGO
                    WinSetOnTop ($GUI3 , "" , 0)
                    GUISetState(@SW_HIDE, $GUI3)
                    ClipPut ($hTexte)
                    _SendAvSaPrPa ($hTexte)
                    _RestorePP ()
                    ExitLoop
                Case $GUI_EVENT_CLOSE
                    GUISetState(@SW_HIDE, $GUI3)
                    ExitLoop
            EndSwitch
    WEnd
EndFunc

And here is the shorter reproducer I can make to demonstrate all issues

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here


#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>
#include <StringConstants.au3>
#include <TrayConstants.au3>
#include <Array.au3>
#include <ColorConstants.au3>

#include <GuiRichEdit.au3>
#include <GUIConstants.au3>

HotKeySet("{F4}", "_Exit")
Global $sMsg

            Global $GUI3 = GUICreate ( "Masque symptome" , 900 ,500  )
            Global $hGuiLabelDrag = GUICtrlCreateLabel("", 50, 0, 650, 30, $SS_CENTER + $SS_CENTERIMAGE , $GUI_WS_EX_PARENTDRAG)
            GUICtrlSetColor(-1, 0xb8b8b8)
            GUICtrlSetFont(-1, 14)
            ;===========================================================================
            Global $Color_1 = 0xb2b4dc
            Global $Color_2 = 0xb1b8be
            Global $hSymptLabel01 = GUICtrlCreateLabel ( "OS du poste : " , 50 , 100 )
            Global $hRadio01 = GUICtrlCreateRadio ( "W7"  , 150 , 95 )
            Global $hRadio02 = GUICtrlCreateRadio ( "W10"  , 200 , 95 )
            Global $hRadio03 = GUICtrlCreateRadio ( "T.L. HP"  , 250 , 95 )
            Global $hRadio04 = GUICtrlCreateRadio ( "T.L. Wase"  , 310 , 95 )
            Global $hSymptLabel02 = GUICtrlCreateLabel ( "Nom du poste : " , 50 , 140 )
            Global $hInput01 = GUICtrlCreateInput ( "PP" , 130 , 135 )
            Global $hSymptLabel03 = GUICtrlCreateLabel ( "Téléphone utilisateur : " , 250 , 140 )
            Global $hInput02 = GUICtrlCreateInput ( "0" , 360 , 135 )
            Global $hRish = _GUICtrlRichEdit_Create(    $GUI3,      "Symptôme(s) : " & @CRLF , _
                                                                    50 , 180 , 710 , 240 , BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL ) )
            Global $OKGO = GUICtrlCreateButton ( "Go" , 50, 450 )
            WinSetOnTop ($GUI3 , "" , 1)
            GUISetState(@SW_SHOW, $GUI3)
;~          GUISetState(@SW_HIDE, $GUI3)  ;Unused state for this reproducer



While 1
    Func1000 ()
WEnd

Func Func1000 ()
;~  _CleanAndWait ()                        ;Unused fonction for this reproducer
    GUISetState(@SW_SHOW, $GUI3)
    While 1
        Sleep (10)
        $hTexte = _GUICtrlRichEdit_GetText ( $hRish )
        _ReadString ($hTexte , "big ip" )
        _ReadString ($hTexte , "vpn" , "allo")
        Local $hNMsg = GUIGetMsg ( $GUI3 )
            Switch $hNMsg
                Case $OKGO
                    WinSetOnTop ($GUI3 , "" , 0)
                    GUISetState(@SW_HIDE, $GUI3)
                    ClipPut ($hTexte)
;~                  _SendAvSaPrPa ($hTexte) ;Unused fonction for this reproducer
;~                  _RestorePP ()           ;Unused fonction for this reproducer
                    ExitLoop
                Case $GUI_EVENT_CLOSE
                    GUISetState(@SW_HIDE, $GUI3)
                    ExitLoop
            EndSwitch
    WEnd
EndFunc

Func OpenLink ()
    ;Nothing for now
    ConsoleWrite("+1"&@CRLF)
EndFunc

Func _ReadString ($TexteStringToCheck = "" , $String1 = Null , $String2 = Null, $String3 = Null, $String4 = Null , $String5 = Null , $String6 = Null , $String7 = Null )
    If StringInStr ($TexteStringToCheck , $String1 ) <> 0 And $String1 <> Null And $String1 = "big ip" Then
        $sMsg = "BIG IP URL = blablablabla"
        _CreateThread1_ToolTip ()
    ElseIf StringInStr ($TexteStringToCheck , $String1 ) <> 0 And $String1 <> Null And StringInStr ($TexteStringToCheck , $String2 ) <> 0 And $String2 <> Null And $String1 = "vpn" Then
        $sMsg = "Keywords2 URL = BLIBLIBLI"
        _CreateThread1_ToolTip ()
    Else
        $sMsg = ""
        _CreateThread1_ToolTip ()
    EndIf
EndFunc

Func _CreateThread1_ToolTip ()
    ToolTip ( $sMsg , 0 , 0)
EndFunc

Func _Exit ()
        WinSetOnTop ($GUI3 , "" , 0)
        Local $cExitYesNo = MsgBox ($MB_YESNO , "Quitter?" , "Voulez-vous quitter ?")
        If $cExitYesNo = "6" Then
            Exit
        Else
            WinSetOnTop ($GUI3 , "" , 1)
        EndIf
EndFunc

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Hey,

I usually use a timer for stuff I don't want to trigger as often as they would do. Do whatever to collect the data and only present it after a certain amount has passed.

Another thing that comes to my mind is instead of multithreading, you could have another script that would check the contents of the richedit of the first script. And change first script to auto-start it perhaps.

Edited by GokAy
Link to comment
Share on other sites

12 minutes ago, GokAy said:

Another thing that comes to my mind is instead of multithreading, you could have another script that would check the contents of the richedit of the first script. And change first script to auto-start it perhaps.

I take this solution I don't even thought about it -.- ... Thanks. 

So right now. 

How to check for 5 Keywords with somthing like that 

Func _ReadString

Without having a flashing tooltip. Do you have an idea ? 

oh... In a second script it's easy as fu** I will just add a sleep ... hmmmmmmmmmmm I will try that and come back for feedbacks. Thanks bro :) .

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • Developers
25 minutes ago, caramen said:

StringInStr ($TexteStringToCheck , $String1 ) <> @error

Not even going to try to have a detailed look at the code when it isn't runnable and showing the issue, but what are you expecting this quoted code to do?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

9 minutes ago, Jos said:

what are you expecting this quoted code to do?

I was expecting if return is different than any @error

But this is incorrect syntax ? Because everything work as expected the only "issue" that is not really an issue is the tooltip is flashing. But the flashing issue is logic with this code. 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • Developers
1 minute ago, caramen said:

But this is incorrect syntax ?

Well...  try to think about this for a moment yourself first!
What is the result of StringInstr() when and error is encountered and what is the content of @error ?

 

 

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Error return

@error: 1 = Invalid "start" or "occurrence" parameter given.

And if not error the position of the string. 

 

After make the function bug. The content of error = 0

If StringInStr ($TexteStringToCheck , $String1 ) <> 0 And $String1 <> Null Then
        $sMsg = "String 1 = OK"
        $NombreToolTip += 1
        _CreateThread1_ToolTip ()
    Else
        $NombreToolTip = 0
        _CreateThread1_ToolTip ()
    EndIf

And so this is enough

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@caramen
The @error macro is always evalutated after the function call, so that line won't ever return an @error; then, you are not even using the occurence and start parameter, so you should just check for a value greater than 0 as "True", and anything else as "False" when calling the StringInStr() function :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

I just noticed that/ 

But anyway that won't resolve my flashing issue do I'm right ? 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • Developers
5 minutes ago, caramen said:

But anyway that won't resolve my flashing issue do I'm right ? 

You should know that answer as you already tried that ...right?

Post some code that is runnable and demonstrates the flashing and you might get proper help....

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@GokAy Do you know how to use from another script To the first one ? 

GUICtrlGetHandle ( controlID )

@Jos

2 minutes ago, Jos said:

Post some code that is runnable and demonstrates the flashing

Sorry doing this right now. I should have done it already. 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

The shorter reproducer I can make

It demonstrates all my issues

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here


#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>
#include <StringConstants.au3>
#include <TrayConstants.au3>
#include <Array.au3>
#include <ColorConstants.au3>

#include <GuiRichEdit.au3>
#include "MetroGUI_UDF.au3"
#include "_GUIDisable.au3"
#include <GUIConstants.au3>

HotKeySet("{F4}", "_Exit")
Global $sMsg

            _Metro_EnableHighDPIScaling()
            _SetTheme("LightCyan")
            Global $GUI3 = _Metro_CreateGUI ( "Masque symptome" , 900 ,500 , -1, -1, False )

            Global $Control_Buttons = _Metro_AddControlButtons(True, False, True, False, True) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True

            Global $GUI_CLOSE_BUTTON = $Control_Buttons[0]
            Global $GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
            Global $GUI_RESTORE_BUTTON = $Control_Buttons[2]
            Global $GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
            Global $GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
            Global $GUI_FSRestore_BUTTON = $Control_Buttons[5]
            Global $GUI_MENU_BUTTON = $Control_Buttons[6]
            Global $hGuiLabelDrag = GUICtrlCreateLabel("", 50, 0, 650, 30, $SS_CENTER + $SS_CENTERIMAGE , $GUI_WS_EX_PARENTDRAG)
            GUICtrlSetColor(-1, 0xb8b8b8)
            GUICtrlSetFont(-1, 14)
            ;===========================================================================
            Global $Color_1 = 0xb2b4dc
            Global $Color_2 = 0xb1b8be
            Global $hSymptLabel01 = GUICtrlCreateLabel ( "OS du poste : " , 50 , 100 )
            Global $hRadio01 = GUICtrlCreateRadio ( "W7"  , 150 , 95 )
            Global $hRadio02 = GUICtrlCreateRadio ( "W10"  , 200 , 95 )
            Global $hRadio03 = GUICtrlCreateRadio ( "T.L. HP"  , 250 , 95 )
            Global $hRadio04 = GUICtrlCreateRadio ( "T.L. Wase"  , 310 , 95 )
            Global $hSymptLabel02 = GUICtrlCreateLabel ( "Nom du poste : " , 50 , 140 )
            Global $hInput01 = GUICtrlCreateInput ( "PP" , 130 , 135 )
            Global $hSymptLabel03 = GUICtrlCreateLabel ( "Téléphone utilisateur : " , 250 , 140 )
            Global $hInput02 = GUICtrlCreateInput ( "0" , 360 , 135 )
            Global $hRish = _GUICtrlRichEdit_Create(    $GUI3,      "Symptôme(s) : " & @CRLF , _
                                                                    50 , 180 , 710 , 240 , BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL ) )
            Global $OKGO = GUICtrlCreateButton ( "Go" , 50, 450 )
            WinSetOnTop ($GUI3 , "" , 1)
            GUISetState(@SW_SHOW, $GUI3)
;~          GUISetState(@SW_HIDE, $GUI3)  ;Unused state for this reproducer



While 1
    Func1000 ()
WEnd

Func Func1000 ()
;~  _CleanAndWait ()                        ;Unused fonction for this reproducer
    GUISetState(@SW_SHOW, $GUI3)
    While 1
        Sleep (10)
        $hTexte = _GUICtrlRichEdit_GetText ( $hRish )
        _ReadString ($hTexte , "big ip" )
        _ReadString ($hTexte , "vpn" , "allo")
        Local $hNMsg = GUIGetMsg ( $GUI3 )
            Switch $hNMsg
                Case $OKGO
                    WinSetOnTop ($GUI3 , "" , 0)
                    GUISetState(@SW_HIDE, $GUI3)
                    ClipPut ($hTexte)
;~                  _SendAvSaPrPa ($hTexte) ;Unused fonction for this reproducer
;~                  _RestorePP ()           ;Unused fonction for this reproducer
                    ExitLoop
                Case $GUI_EVENT_CLOSE
                    GUISetState(@SW_HIDE, $GUI3)
                    ExitLoop
            EndSwitch
    WEnd
EndFunc

Func OpenLink ()
    ;Nothing for now
    ConsoleWrite("+1"&@CRLF)
EndFunc

Func _ReadString ($TexteStringToCheck = "" , $String1 = Null , $String2 = Null, $String3 = Null, $String4 = Null , $String5 = Null , $String6 = Null , $String7 = Null )
    If StringInStr ($TexteStringToCheck , $String1 ) <> 0 And $String1 <> Null And $String1 = "big ip" Then
        $sMsg = "BIG IP URL = blablablabla"
        _CreateThread1_ToolTip ()
    ElseIf StringInStr ($TexteStringToCheck , $String1 ) <> 0 And $String1 <> Null And StringInStr ($TexteStringToCheck , $String2 ) <> 0 And $String2 <> Null And $String1 = "vpn" Then
        $sMsg = "Keywords2 URL = BLIBLIBLI"
        _CreateThread1_ToolTip ()
    Else
        $sMsg = ""
        _CreateThread1_ToolTip ()
    EndIf
EndFunc

Func _CreateThread1_ToolTip ()
    ToolTip ( $sMsg , 0 , 0)
EndFunc

Func _Exit ()
        WinSetOnTop ($GUI3 , "" , 0)
        Local $cExitYesNo = MsgBox ($MB_YESNO , "Quitter?" , "Voulez-vous quitter ?")
        If $cExitYesNo = "6" Then
            Exit
        Else
            WinSetOnTop ($GUI3 , "" , 1)
        EndIf
EndFunc

Just write that into input box to test

Symptôme(s) : 
test: big ip // vpn allo

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

22 minutes ago, caramen said:

Do you know how to use from another script To the first one ? 

I can't be of much help with this, not without wasting few hours. First you need the window handle of the first script. Then use the AutoIt Window Info tool to get the window handle of the richedit. I would guess there is a more direct approach possible with AutoIT though.

For flashing, and how a timer can be used check the first script here:

https://www.autoitscript.com/forum/topic/204707-counter-skipping-0/?tab=comments#comment-1471344

Edit: Sorry pressed to post by mistake.

Edit2: You can also add a little sleep.

Edit3: To get window handle

https://www.autoitscript.com/autoit3/docs/functions/WinGetHandle.htm

I have only used FindWindow (window handle, should be as above?) and FindWindowEx (ctrl handle) win32 api functions in VBA so quiet nooby here. Someone will fill you in if you can't locate the equivalents.

Edited by GokAy
Link to comment
Share on other sites

My main difficulty is to keep the button Go usable and the tooltip must change depending on what the technician is typing. (c.f. reproducer.)

I see another issue coming ... how to manage the display of 4 tooltips also... If I have two checks returning "True" state at same time. 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • Developers
23 minutes ago, caramen said:

The shorter reproducer I can make

You will have to do better as this example contains none standard include files. I am sure you can make a much simpler example. ;) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here


#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>
#include <StringConstants.au3>
#include <TrayConstants.au3>
#include <Array.au3>
#include <ColorConstants.au3>

#include <GuiRichEdit.au3>
#include <GUIConstants.au3>

HotKeySet("{F4}", "_Exit")
Global $sMsg

            Global $GUI3
            $GUI3 = GUICreate ( "Masque symptome" , 900 ,500  )
            Global $hGuiLabelDrag = GUICtrlCreateLabel("", 50, 0, 650, 30, $SS_CENTER + $SS_CENTERIMAGE , $GUI_WS_EX_PARENTDRAG)
            GUICtrlSetColor(-1, 0xb8b8b8)
            GUICtrlSetFont(-1, 14)
            ;===========================================================================
            Global $Color_1 = 0xb2b4dc
            Global $Color_2 = 0xb1b8be
            Global $hSymptLabel01 = GUICtrlCreateLabel ( "OS du poste : " , 50 , 100 )
            Global $hRadio01 = GUICtrlCreateRadio ( "W7"  , 150 , 95 )
            Global $hRadio02 = GUICtrlCreateRadio ( "W10"  , 200 , 95 )
            Global $hRadio03 = GUICtrlCreateRadio ( "T.L. HP"  , 250 , 95 )
            Global $hRadio04 = GUICtrlCreateRadio ( "T.L. Wase"  , 310 , 95 )
            Global $hSymptLabel02 = GUICtrlCreateLabel ( "Nom du poste : " , 50 , 140 )
            Global $hInput01 = GUICtrlCreateInput ( "PP" , 130 , 135 )
            Global $hSymptLabel03 = GUICtrlCreateLabel ( "Téléphone utilisateur : " , 250 , 140 )
            Global $hInput02 = GUICtrlCreateInput ( "0" , 360 , 135 )
            Global $hRish = _GUICtrlRichEdit_Create(    $GUI3,      "Symptôme(s) : " & @CRLF , _
                                                                    50 , 180 , 710 , 240 , BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL ) )
            Global $OKGO = GUICtrlCreateButton ( "Go" , 50, 450 )
            WinSetOnTop ($GUI3 , "" , 1)
            GUISetState(@SW_SHOW, $GUI3)
;~          GUISetState(@SW_HIDE, $GUI3)  ;Unused state for this reproducer



While 1
    Func1000 ()
WEnd

Func Func1000 ()
;~  _CleanAndWait ()                        ;Unused fonction for this reproducer
    GUISetState(@SW_SHOW, $GUI3)
    While 1
        Sleep (10)
        $hTexte = _GUICtrlRichEdit_GetText ( $hRish )
        _ReadString ($hTexte , "big ip" )
        _ReadString ($hTexte , "vpn" , "allo")
        Local $hNMsg = GUIGetMsg ( $GUI3 )
            Switch $hNMsg
                Case $OKGO
                    WinSetOnTop ($GUI3 , "" , 0)
                    GUISetState(@SW_HIDE, $GUI3)
                    ClipPut ($hTexte)
;~                  _SendAvSaPrPa ($hTexte) ;Unused fonction for this reproducer
;~                  _RestorePP ()           ;Unused fonction for this reproducer
                    ExitLoop
                Case $GUI_EVENT_CLOSE
                    GUISetState(@SW_HIDE, $GUI3)
                    ExitLoop
            EndSwitch
    WEnd
EndFunc

Func OpenLink ()
    ;Nothing for now
    ConsoleWrite("+1"&@CRLF)
EndFunc

Func _ReadString ($TexteStringToCheck = "" , $String1 = Null , $String2 = Null, $String3 = Null, $String4 = Null , $String5 = Null , $String6 = Null , $String7 = Null )
    If StringInStr ($TexteStringToCheck , $String1 ) <> 0 And $String1 <> Null And $String1 = "big ip" Then
        $sMsg = "BIG IP URL = blablablabla"
        _CreateThread1_ToolTip ()
    ElseIf StringInStr ($TexteStringToCheck , $String1 ) <> 0 And $String1 <> Null And StringInStr ($TexteStringToCheck , $String2 ) <> 0 And $String2 <> Null And $String1 = "vpn" Then
        $sMsg = "Keywords2 URL = BLIBLIBLI"
        _CreateThread1_ToolTip ()
    Else
        $sMsg = ""
        _CreateThread1_ToolTip ()
    EndIf
EndFunc

Func _CreateThread1_ToolTip ()
    ToolTip ( $sMsg , 0 , 0)
EndFunc

Func _Exit ()
        WinSetOnTop ($GUI3 , "" , 0)
        Local $cExitYesNo = MsgBox ($MB_YESNO , "Quitter?" , "Voulez-vous quitter ?")
        If $cExitYesNo = "6" Then
            Exit
        Else
            WinSetOnTop ($GUI3 , "" , 1)
        EndIf
EndFunc

Here we go :D

 

Just write that into input box to test 

Symptôme(s) : 
test: big ip // vpn allo

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • Developers
16 minutes ago, caramen said:

Here we go :D

 

Just write that into input box to test 

Symptôme(s) : 
test: big ip // vpn allo

Ok.... this version runs... now what exactly do you expect to happen when typing that text ( and press go?)  ? 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Nevermind ...   you are trying to show way to many tooltips in a second. this is simply debugged by adding some consolewrite debug statements (alt+d in SciTE) like this:

Func _CreateThread1_ToolTip()
    ToolTip($sMsg, 0, 0)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sMsg = ' & $sMsg & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
EndFunc   ;==>_CreateThread1_ToolTip

So you need to rethink what you really want here. ;) 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

When you press go the expected behavior is not the issue. It work. 

But to answer the question after pressing go the functions : 

_SendAvSaPrPa ($hTexte) ;Unused fonction for this reproducer
_RestorePP ()           ;Unused fonction for this reproducer

Are Just sending the text from the input box elsewhere. And restoring the ClipBoard as before. 

My issues :

-The tooltip displayed. She's flashing. After True statement. 

-How to manage the 2 differents results  ? Is some case I will have 5 or 10 statement true that all need to be displayed in the tooltip.  

I have to keep the button Go Available and the tool tip must do a statement on all my future StringInString questions. There will be more than 1000 check. 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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