Ralle1976 icon

New WINDOWS_SETTINGS Func

Ralle1976 | PRO | 08/03/19 11:47:39 PM UTC | 0 ⭐ | 13064 👁️ | Never ⏰ | []
AutoIt |

4.26 KB

|

None

|

0 👍

/

0 👎

Func CheckPath($handel = 0)
    Local $__Path = GUICtrlRead($handel)
    IF  Not StringRegExp($__Path, "((?<!.)([a-zA-Z]\:\\)(?!\s)(([\w-+.]*((?<!\s)(\s{1})(?!\\)|(?<!\\)(\\{1})(?!\s))*)*)(\\?)(?!.))", 0) Or _
        Not FileExists($__Path) Then
        GUICtrlSetData($handel, "")
        Return False
    EndIf
    Return True
EndFunc
 
Func CheckX($string = "")
    Local $StringLen = StringLen($string)
    If  Not StringInStr($string, ' ') Then Return 2
    IF $StringLen < 3 Then Return 3
    IF $StringLen > 19 Then Return 4
    Return 1
EndFunc
 
Func CheckCharacterName($handel)
    Local $name = GUICtrlRead($handel)
    $name = StringRegExpReplace($name, "\s$", "")
    Local $State = CheckX($name)
    GUICtrlSetData($handel, $name);Make Sure the User not set aWhite Space at the end of tipping https://regex101.com/r/EiRCTB/1
    Local $_error_array = [4, "Check is tells there is a Space, there is a no lower 3 and not higher len than 19!", "No Space Found", "StringLen is lower 3", "StringLen is higher 19"]
    ConsoleWrite($_error_array[$State] & @CRLF)
    IF $State > 1 Then
        GUICtrlSetData($handel, "")
        Return False
    EndIf
    Local $StringSplit = StringSplit($name, " ")
    If IsArray($StringSplit) Then
        IF $StringSplit[0] > 1 Then
            For $n = 1 To $StringSplit[0]
                IF $StringSplit[$n] <> "" Then
                    IF Not  StringRegExp($StringSplit[$n], "(^[A-Z])([a-z]+)", 0) Then
                        GUICtrlSetData($handel, "")
                        Return False
                    EndIf
                EndIf
            Next
        EndIf
    EndIf
    Return True
EndFunc
 
Func CheckStringFromInput($handel, $ClassCheck = 0)
    Local $String = GUICtrlRead($handel)
    If $String = "" Then Return False
    Switch($ClassCheck)
        Case 1
            IF Not StringRegExp($String,"(\[\w+:\w+; \w+:\d+\])", 0) Then
                GUICtrlSetData($handel ,"")
                Return False; https://regex101.com/r/auydEg/1
            EndIf
        Case 2
            ;https://de.wikipedia.org/wiki/Dateiname
;~          $String = StringRegExpReplace($String, '[?*<>,\\+:=\/";\[\]\|]', "")
            IF StringRegExp($String,'[?*<>,\\+:=\/";\[\]\|]+', 0) Then
                GUICtrlSetData($handel ,"")
                Return False
            EndIf
        Case 3
            ;https://de.wikipedia.org/wiki/Dateiname
            IF StringRegExp($String,"[\w\`\'\{\}\(\)\%\&\-\@\#\$\~\!\_\^. ]+", 0) Then Return False;
    EndSwitch
    Return True
EndFunc
 
Func ChanceArrayData(byref $Array, $index = 0 , $Handel = 0)
$Array[$index] = GUICtrlRead($Handel)
GUICtrlSetData($Handel, "")
EndFunc
 
Func WINDOWS_SETTINGS($debug = False)
    Local $_array =     [ _
                        [7], _
                        ["CheckPath($GUI_ADD_GW_WAY)", "GW Path is not a Path or dont exists!", "ChanceArrayData($GuiPathToGw, $A, $GUI_ADD_GW_WAY)"], _
                        ["CheckPath($GUI_ADD_NEW_BOT_WAY)", "Bot Path is not a Path or dont exists!", "ChanceArrayData($GuiPathToBot, $A, $GUI_ADD_NEW_BOT_WAY)"], _
                        ["CheckCharacterName($GUI_ADD_NICK_NAME)", "The Charactername not equal with the rules!", "ChanceArrayData($GuiNameOfCharacter, $A, $GUI_ADD_NICK_NAME)"], _
                        ["CheckStringFromInput($GUI_ADD_BOT_NAME, 2)", "No Bot Name is set or" & @CRLF & "it holds Symbolys wich not are allowed!", "ChanceArrayData($GuiNameOfBot, $A, $GUI_ADD_BOT_NAME)"], _
                        ["CheckStringFromInput($GUI_ADD_BOT_NAME_SELECTOR, 1)", "No Classname for NameSelector is set or Format is not allwoed", "ChanceArrayData($GuiAutoClickNameSelector, $A, $GUI_ADD_BOT_NAME_SELECTOR)"], _
                        ["CheckStringFromInput($GUI_ADD_BOT_START_BUTTON, 1)", "No Classname of Start Button is set or Format is not allwoed", "ChanceArrayData($GuiAutoClickStartButton, $A, $GUI_ADD_BOT_START_BUTTON)"], _
                        ["CheckStringFromInput($GUI_ADD_BOT_DISABLE_RENDERING_BUTTON, 1)", "No Classname of Disable Rendering is set or Format is not allwoed", "ChanceArrayData($GUiAutoClickDisableRendering, $A, $GUI_ADD_BOT_DISABLE_RENDERING_BUTTON)"]]
    Local $count = 0, $Info = ""
    For $i = 1 To $_array[0][0]
        Local $State = Execute($_array[$i][0])
        ConsoleWrite($_array[$i][0] & " State = " & $State &  @CRLF)
        IF Not $State Then
            $count += 1
            $Info &= @CRLF & $_array[$i][1] & (($i < $_array[0][0]) ? (@CRLF) : (''))
        EndIf
    Next
    If $count > 0 Then
        MsgBox(0, "Info", $Info, 8, $guiMainWorkingControl)
    Else
        For $i = 1 To $_array[0][0]
            Execute($_array[$i][2])
        Next
        GUISetState(False, $subGuiSettings)
        ADD_NEW_ACCOUNT()
    EndIf
    GUICtrlSetState($GUI_BUTTON_ADD_ACCOUNT, $GUI_ENABLE)
EndFunc   ;==>WINDOWS_SETTINGS

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎