Jump to content

Logic help


caramen
 Share

Recommended Posts

I got troubles for multiple keyword at same time, but I'm trying all weekend myself I will repost If I cannot do it alone. 

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

I will repost a new reproducer with modification and explain if you want but after if I keep stuck. 

Do you mind if i post with webdriver in the reproducer ?

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

Please do the reproducer as simple as possible, as the purpose is to point out the trouble you are in

If the problem is related to Webdriver there is people much better than me for this around here

Edited by mikell
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 <File.au3>



#include <GuiRichEdit.au3>

#include <GUIConstants.au3>
#include <GuiListView.au3>


HotKeySet("{F4}", "_Exit")
Global $sMsg , $sdk , $ConsoleTexte , $test1 , $test2 , $test3

            Global $GUI3 = GUICreate ( "Masque symptome" , 1100 ,500 , -1, -1, False )
            ;===========================================================================
            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 ( "PPF" , 130 , 135 )
            Global $hSymptLabel03 = GUICtrlCreateLabel ( "Téléphone utilisateur : " , 250 , 140 )
            Global $hInput02 = GUICtrlCreateInput ( "0" , 360 , 135 )
            Global $hSymptLabel04 = GUICtrlCreateLabel ( "Site utilisateur : " , 530 , 140 )
            Global $hInput03 = GUICtrlCreateInput ( "MGEN/" , 610 , 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)

            Global $ConsoleArea = GUICtrlCreateListView("Fiche consigne disponible pour votre symptôme :", 760 , 180 , 325 , 240 , $LVS_REPORT )
            _GUICtrlListView_SetColumnWidth ($ConsoleArea , 0 ,800 )
            GUISetState(@SW_HIDE, $GUI3)


_ConfigueDelArray ()
While 1
    Func1000 ()
WEnd

Func Func1000()
    GUISetState(@SW_SHOW, $GUI3)

    While 1
        Local $hNMsg = GUIGetMsg($GUI3)
        Switch $hNMsg
            Case $OKGO
                Local $TelCheck = GUICtrlRead ($hInput02)
                If StringLen ($TelCheck) <= 9 Then
                    MsgBox ( $MB_TOPMOST , "Téléphone" , "Veuillez renseignez un numéro de téléphone valide s'il vous plait." )
                    ContinueLoop
                EndIf
                Local $HostNCheck = GUICtrlRead ($hInput01)
                WinSetOnTop($GUI3, "", 0)
                GUISetState(@SW_HIDE, $GUI3)
                $hTexte = _GUICtrlRichEdit_GetText($hRish)
                $hTexte = $hTexte&@CRLF&"Téléphone utilisateur : "&$TelCheck
                $hTexte = $hTexte&@CRLF&"Hostname : "&$HostNCheck
                _GUICtrlListView_DeleteAllItems ( $ConsoleArea )
                $ConsoleTexte = ""
                GUICtrlSetData ($hInput01 , "PPF" )
                GUICtrlSetData ($hInput02 , "0" )
                _GUICtrlRichEdit_SetText ( $hRish , "Symptôme(s) :"&@CRLF )
                Raz ()
                ExitLoop
            Case $GUI_EVENT_CLOSE;, $GUI_CLOSE_BUTTON
                GUISetState(@SW_HIDE, $GUI3)
                _GUICtrlListView_DeleteAllItems ( $ConsoleArea )
                $ConsoleTexte = ""
                GUICtrlSetData ($hInput01 , "PPF" )
                GUICtrlSetData ($hInput02 , "0" )
                _GUICtrlRichEdit_SetText ( $hRish , "Symptôme(s) :"&@CRLF )
                Raz ()
                ExitLoop
;~          Case $GUI_MINIMIZE_BUTTON
;~              GUISetState(@SW_MINIMIZE, $GUI3)
        EndSwitch

; IMPORTANT !! =============================<<
    If _GUICtrlRichEdit_IsModified($hRish) Then
            $hTexte = _GUICtrlRichEdit_GetText($hRish)
            _ReadString($hTexte, $sdk)
        _GUICtrlRichEdit_SetModified($hRish, false)
    EndIf
    Sleep(10)
    WEnd
EndFunc   ;==>Func1000

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

Func _ReadString($TexteStringToCheck, $sd)
    local $sMsg
    For $kw In $sd
    ;  If StringRegExp($TexteStringToCheck, '\b' & $kw & ' ') Then $sMsg &= $kw & " "
;~       If StringRegExp($TexteStringToCheck, '\b' & $kw & ' ') Then $sMsg &= $sd.item($kw) & " " ;Mikell
;~       If StringRegExp($TexteStringToCheck, '\b(?i)' & $kw & '') Then $sMsg &= $sd.item($kw) & "" ;Cara
;~       If StringRegExp($TexteStringToCheck, '\b(?i)' & $kw & '') Then $sMsg = $sd.item($kw) & "" ;Cara
        If StringRegExp($TexteStringToCheck, '\b(?i)' & $kw & '') Then _ConsoleForDebug ( $sd.item($kw) ) ;Cara
    Next
;~     _ConsoleForDebug ($sMsg)
EndFunc

Func _ConsoleForDebug ($sMsg)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sMsg = ' & $sMsg & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    Local $test456 = _GUICtrlListView_FindInText ( $ConsoleArea , $sMsg )
        $sMsg = Exclusion ($sMsg)
        If $ConsoleTexte <> $sMsg And $sMsg <> "" And $test456 = -1 Then
            If $sMsg = "cons_view&consigne=49030" Then
                _ConsoleBIGIP ()
            EndIf
        $ConsoleTexte = $sMsg
                ;~ ==========================================Console============================================
                 _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg )
                 _GUICtrlListView_EnsureVisible ( $ConsoleArea , _GUICtrlListView_GetItemCount ( $ConsoleArea ) -1 )
                ;~ ==========================================/Console============================================

        EndIf
EndFunc   ;==>_ConsoleForDebug

Func Exclusion ($sMsg)
    If $sMsg = "cons_view&consigne=00001" Then
        $sMsg = ""
        $test1 = 1
    ElseIf $sMsg = "cons_view&consigne=00002" Then
        $sMsg = ""
        $test2 = 1
    EndIf
    If $test1 = 1 And $test2 = 1 And $test3 <> 1 Then
        _ConsoleForDebug_1 ("Themes Vpn-allo trouvé :")
        $sMsg = "cons_view&consigne=00003"
        $test3 = 1
    EndIf
    Return $sMsg
EndFunc

Func Raz ()
    $test1 = 0
    $test2 = 0
    $test3 = 0
EndFunc

Func _ConsoleBIGIP ()
            ;~ ==========================================Console============================================
             Local $sMsg2 = "BigIP détecté !"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "Réparer Bigip :"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "cons_view&consigne=00004"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "Probleme connu de BigIP !"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "cons_view&consigne=00005"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "Mot de passe BigIP incorrect :"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "cons_view&consigne=00480"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "réinstallation de BigIP :"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
            ;~ ==========================================/Console============================================
EndFunc

Func _ConfigueDelArray ()
    SplashTextOn ("", "Construction documentation..." & @crlf & "  ", 500, 55, -1, 400, 49, "", 10)

    $sdk = ObjCreate("Scripting.Dictionary")

    For $i = 1 to 50000
        If StringLen ($i) < 2 Then $i = 0000&$i
        If StringLen ($i) < 3 Then $i = 000&$i
        If StringLen ($i) < 4 Then $i = 00&$i
        If StringLen ($i) < 5 Then $i = 0&$i

        If $i = 49030 Then
            $sdk.Add ("BigIP" , "cons_view&consigne=" & $i)
        ElseIf $i = 00001 Then
            $sdk.Add ("Vpn" , "cons_view&consigne=" & $i)
        ElseIf $i = 00002 Then
            $sdk.Add ("allo" , "cons_view&consigne=" & $i)
        ElseIf $i = 00015 Then
            $sdk.Add ("lol" , "cons_view&consigne=" & $i)
        Else
            $sdk.Add ("FicheConsigne" & $i, "cons_view&consigne=" & $i)
        EndIf
    Next

    SplashOff()

    #cs ; check
    $a = _list($sdk)
    _ArrayDisplay($a)
    #ce
EndFunc

Func _list($dico)
    Local $keys = $dico.Keys
    Local $items = $dico.Items
    Local $count = $dico.Count
    Local $ret[$count+1][2]
    $ret[0][0] = $count
    For $i = 1 To $count
        $ret[$i][0] = $keys[$i-1]
        $ret[$i][1] = $items[$i-1]
    Next
    Return $ret
EndFunc

Func _ConsoleForDebug_1 ($sMsg)
                ;~ ==========================================Console============================================
                 _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg )
                 _GUICtrlListView_EnsureVisible ( $ConsoleArea , _GUICtrlListView_GetItemCount ( $ConsoleArea ) -1 )
                ;~ ==========================================/Console============================================
EndFunc   ;==>_ConsoleForDebug

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

@mikelltest the rish edit here : 

- Two linked word for one result : allo & vpn 

- 5 results for one word : bigip 

-1 result for 1 word : lol 

It work, but I will try to get easier implementation now before start.

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

11 hours ago, caramen said:

- 5 results for one word : bigip 
- Two linked word for one result : allo & vpn

With such brand new requirements I can see no way to make the job easier, you need special instructions to manage them
If you get 25,000 like these the thingy will become really huge ... good luck  :sweating:

Link to comment
Share on other sites

huge to code or huge to execute or both ?

I said you bro : I think when 50k is the maximum number probably in the rows 49001 to 49999 then is 40 links used. I think they use number to sort. 

And there will never be more than 15 key scanned at same time in one symptom. I think even with hard time coding, it will work without any latency or lake of performance. 

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

As a quick and dirty experiment, I used SQLite to perform the following with a table of 109582 english words (typos is an add-on function for a sophisticated Damerau-Levenshtein distance⁽¹⁾ between two strings):

select * from en where typos(word, 'year') < 2      -- (4 char word with no more than one typo)
yields 19 results in 141ms

select * from en where typos(word, 'xylop%') < 2     -- (4+ char word with 0 or 1 typo from 'xylop')
yields 10 results in 305ms

So even with a large word base and using such a complex fuzzy search, the response is quite fast. A search for exact input (typos = 0) is almost instantaneous.

My example table is only a list of words but it's trivial to use a {key, value} lookup table in the same way to return the value for any key without eating significantly more time. The fact that such a database is a separate single data file makes it easy to modify without distributing a new executable. SQLite databases are portable verbatim across any platform (hardware, OS, filesystem) you can think of.

If such a fuzzy search is never needed, then a Map or SD object is faster, with the burden of storing data in the program itself or maintaining a separate datafile to be loaded in Map or SD at runtime.

 

⁽¹⁾ This counts the number of character insertion or omission or exchange of neighbour characters needed to match two strings, both sides being lowercased and unaccented over the full Unicode range. The function is fast even given these specifications thanks to the efficiency of C compilers. It's part of my unifuzz SQLite extension, just ask or search forum to get it.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

And I already use Mysql commands. Interesting. I will definitely take a loot about it. 

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

FYI my extension is only SQLite-compatible. Also, if you need to distribute the application, SQLite is much, much easier to deploy than any other RDBMS: just copy one DLL.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

btw actually this is my timers

13:57:37.534
13:57:37.869

335ms and it feet to my needs. It's comparing 50k items. 

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