Sign in to follow this  
Followers 0
HR78

how make simple calculate script?

10 posts in this topic

#1 ·  Posted (edited)

Hello again guys.

Give an example of how to make a simple edit box:

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $btn_SetData, $btn_GetData, $btn_Calculate

    ; Create GUI
    $hGUI = GUICreate("Clipboard", 650, 450)
    $iMemo = GUICtrlCreateEdit("", 2, 2, 650, 400, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    $btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
    $btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
    $btn_Calculate = GUICtrlCreateButton("Calculate", 450, 410, 120, 30)
    GUISetState()

    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btn_Calculate
                ;I dont know what function I need
            Case $btn_SetData
                _ClipBoard_SetData ("ClipBoard Library")
            Case $btn_GetData
                MemoWrite(_ClipBoard_GetData ())
        EndSwitch
    WEnd

EndFunc   ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

and if put it in the example:

1   4   5   21  25  28  29  41  49  51  53  55  56  63  66  67  72  74  76  79
5   7   16  19  27  29  32  38  39  43  45  51  52  54  56  58  66  73  75  80
7   14  19  25  28  31  32  33  40  45  49  56  57  58  63  68  69  70  72  78
7   10  21  26  28  31  37  38  43  44  47  48  55  57  63  66  68  73  77  78
2   4   6   22  28  37  38  45  46  49  54  57  59  62  63  68  69  73  74  78
4   5   6   8   10  14  15  20  25  29  34  50  52  54  55  58  59  68  71  77
2   5   8   10  14  15  18  21  27  28  34  41  49  50  52  56  57  69  70  73
5   10  11  13  14  18  21  23  28  29  30  32  41  45  46  47  49  58  72  76
1   9   11  21  26  28  30  32  34  39  48  51  55  59  62  64  69  70  73  78
7   8   11  17  18  21  25  28  32  38  41  44  50  52  54  62  67  71  78  79
1   2   3   9   12  17  19  23  42  48  49  54  55  57  62  65  67  75  76  78
3   8   13  14  15  21  28  34  38  44  48  56  59  61  68  70  73  75  78  80

And if Click Button Calculate To calculate how many times you repeat all the numbers and print them on test.txt or new window:

Search "63" (11 hits)

Search "6" (11 hits)

Search "2" (11 hits)

Search "80" (11 hits)

Search "57" (11 hits)

Search "10" (11 hits)

......

Thanks and sorry for my bad english.

Edited by HR78

[URL=http://www.4shared.com/file/CMpeMOgr/KMSnano_100_Final_AIO_Activato.html]KMSnano 10.0 Final AIO Activator for Windows 7, 8 and Office 2010, 2013.exe[/URL] [URL=http://www.4shared.com/file/ODqqYSju/Windows_7_Loader_v208__x86-x64.html]Windows 7 Loader v2.0.8 (x86-x64) by Daz.exe[/URL] [URL=http://www.4shared.com/file/Jc8lQNic/Windows_7_Manager_v426__x32-x6.html]Windows 7 Manager v4.2.6 (x32-x64).exe[/URL] [URL=http://www.4shared.com/file/WMdwBjBE/Windows_8_Manager_v114.html]Windows 8 Manager v1.1.4.exe[/URL]

Share this post


Link to post
Share on other sites



You might use StringReplace. Not that you necessarily want to replace the substring, but that function returns the number of replacements made. Otherwise you could use StringInStr, incrementing the counter and starting position every time a match is found, looping until no more matches are found.

Share this post


Link to post
Share on other sites

Here is an example using StringReplace.

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $btn_SetData, $btn_GetData, $btn_Calculate

    ; Create GUI
    $hGUI = GUICreate("Clipboard", 650, 450)
    $iMemo = GUICtrlCreateEdit("", 2, 2, 650, 400, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    $btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
    $btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
    $btn_Calculate = GUICtrlCreateButton("Calculate", 450, 410, 120, 30)
    GUISetState()

    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btn_Calculate
                GUICtrlSetData($iMemo, NumOfNums(GUICtrlRead($iMemo)))
            Case $btn_SetData
                _ClipBoard_SetData("ClipBoard Library")
            Case $btn_GetData
                MemoWrite(_ClipBoard_GetData())
        EndSwitch
    WEnd

EndFunc   ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite


Func NumOfNums($Data)
    Local $a, $arr, $iCount, $sRet = ""
    $a = StringRegExpReplace(StringStripWS($Data, 7), "\s+", "~")
    ;ConsoleWrite($a & @LF)
    $arr = StringSplit($a, "~", 2)
    $arr = _ArrayUnique($arr)
    _ArrayDelete($arr, 0)

    ; ----- _ArraySort to sort numerically -------
    For $i = 0 To UBound($arr) - 1
        $arr[$i] = Number($arr[$i])
    Next
    _ArraySort($arr)
    ; ---> End of _ArraySort sorting numerically ----

    For $i = 0 To UBound($arr) - 1
        StringReplace("~" & $a & "~", "~" & $arr[$i] & "~", "") ; Adding "~" before and after, prevents "2" matching the "2" in "42".
        $iCount = @extended
        $sRet &= 'Search "' & $arr[$i] & '" (' & $iCount & ' hits)' & @CRLF
    Next
    ;ConsoleWrite($sRet & @LF)
    Return $Data & @CRLF & $sRet ; Append results.
EndFunc   ;==>NumOfNums

Share this post


Link to post
Share on other sites

Here is an example using StringReplace.

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $btn_SetData, $btn_GetData, $btn_Calculate

    ; Create GUI
    $hGUI = GUICreate("Clipboard", 650, 450)
    $iMemo = GUICtrlCreateEdit("", 2, 2, 650, 400, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    $btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
    $btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
    $btn_Calculate = GUICtrlCreateButton("Calculate", 450, 410, 120, 30)
    GUISetState()

    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btn_Calculate
                GUICtrlSetData($iMemo, NumOfNums(GUICtrlRead($iMemo)))
            Case $btn_SetData
                _ClipBoard_SetData("ClipBoard Library")
            Case $btn_GetData
                MemoWrite(_ClipBoard_GetData())
        EndSwitch
    WEnd

EndFunc   ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite


Func NumOfNums($Data)
    Local $a, $arr, $iCount, $sRet = ""
    $a = StringRegExpReplace(StringStripWS($Data, 7), "\s+", "~")
    ;ConsoleWrite($a & @LF)
    $arr = StringSplit($a, "~", 2)
    $arr = _ArrayUnique($arr)
    _ArrayDelete($arr, 0)

    ; ----- _ArraySort to sort numerically -------
    For $i = 0 To UBound($arr) - 1
        $arr[$i] = Number($arr[$i])
    Next
    _ArraySort($arr)
    ; ---> End of _ArraySort sorting numerically ----

    For $i = 0 To UBound($arr) - 1
        StringReplace("~" & $a & "~", "~" & $arr[$i] & "~", "") ; Adding "~" before and after, prevents "2" matching the "2" in "42".
        $iCount = @extended
        $sRet &= 'Search "' & $arr[$i] & '" (' & $iCount & ' hits)' & @CRLF
    Next
    ;ConsoleWrite($sRet & @LF)
    Return $Data & @CRLF & $sRet ; Append results.
EndFunc   ;==>NumOfNums

Thanks man - YOU Are The Best..

[URL=http://www.4shared.com/file/CMpeMOgr/KMSnano_100_Final_AIO_Activato.html]KMSnano 10.0 Final AIO Activator for Windows 7, 8 and Office 2010, 2013.exe[/URL] [URL=http://www.4shared.com/file/ODqqYSju/Windows_7_Loader_v208__x86-x64.html]Windows 7 Loader v2.0.8 (x86-x64) by Daz.exe[/URL] [URL=http://www.4shared.com/file/Jc8lQNic/Windows_7_Manager_v426__x32-x6.html]Windows 7 Manager v4.2.6 (x32-x64).exe[/URL] [URL=http://www.4shared.com/file/WMdwBjBE/Windows_8_Manager_v114.html]Windows 8 Manager v1.1.4.exe[/URL]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Here's another way it could work.

#include <String.au3>

$input = InputBox("Title","Promp")

$String = "1   4   5   21  25  28  29  41  49  51  53  55  56  63  66  67  72  74  76  79" & _
        "5   7   16  19  27  29  32  38  39  43  45  51  52  54  56  58  66  73  75  80" & _
        "7   14  19  25  28  31  32  33  40  45  49  56  57  58  63  68  69  70  72  78" & _
        "7   10  21  26  28  31  37  38  43  44  47  48  55  57  63  66  68  73  77  78" & _
        "2   4   6   22  28  37  38  45  46  49  54  57  59  62  63  68  69  73  74  78" & _
        "4   5   6   8   10  14  15  20  25  29  34  50  52  54  55  58  59  68  71  77" & _
        "2   5   8   10  14  15  18  21  27  28  34  41  49  50  52  56  57  69  70  73" & _
        "5   10  11  13  14  18  21  23  28  29  30  32  41  45  46  47  49  58  72  76" & _
        "1   9   11  21  26  28  30  32  34  39  48  51  55  59  62  64  69  70  73  78" & _
        "7   8   11  17  18  21  25  28  32  38  41  44  50  52  54  62  67  71  78  79" & _
        "1   2   3   9   12  17  19  23  42  48  49  54  55  57  62  65  67  75  76  78" & _
        "3   8   13  14  15  21  28  34  38  44  48  56  59  61  68  70  73  75  78  80 "


$res = _StringBetween($String,$input," ")
If @error Then
    MsgBox(0,"Error",@error)
    Exit
EndIf

MsgBox(0,"Result",UBound($res)-1)

EDIT:

Hmm you would always have to ensure your test file had a trailing space.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Here is an example using StringReplace.

You're my script angel :mellow:

Last question.

If you insert in the edit box numbers:

1 3 5 7 9 12

1 2 5 6 7 10

2 4 5 7 9 11

Click on the button to read the script results each row and display the information in the form:

.......Col1.Col2.Col3.Col4.Col5.Col6.Col7.Col8.Col9.Col10.Col11.Col12.Col13.Col14.Col15.Col16.Col17.Col18.Col19.Col20

[0].....1..............3.............5.............7.............9........................12

[1].....1......2.....................5......6....7....................10

[2]............2...........4.........5.............7.............9..............11

Is this possible or will I need excel??

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $btn_SetData, $btn_GetData, $btn_Calculate, $btn_Statistics

    ; Create GUI
    $hGUI = GUICreate("Clipboard", 750, 450 )
    $iMemo = GUICtrlCreateEdit("", 2, 2, 700, 400, -1)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    $btn_SetData = GUICtrlCreateButton("Results", 10, 410, 120, 30)
    $btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 140, 410, 120, 30)
    $btn_Calculate = GUICtrlCreateButton("Calculate", 270, 410, 120, 30)
    $btn_Statistics = GUICtrlCreateButton("Statistics", 400, 410, 120, 30)
    GUISetState()

    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btn_Calculate
                GUICtrlSetData($iMemo, NumOfNums(GUICtrlRead($iMemo)))
            Case $btn_SetData
                Results()

                
            Case $btn_GetData
                ExitLoop
            Case $btn_Statistics
                ShellExecute("AllPickLoto", @ScriptDir)
        EndSwitch
    WEnd

EndFunc   ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite


Func NumOfNums($Data)
    Local $a, $arr, $iCount, $sRet = ""
    $a = StringRegExpReplace(StringStripWS($Data, 7), "\s+", "~")
    ;ConsoleWrite($a & @LF)
    $arr = StringSplit($a, "~", 2)
    $arr = _ArrayUnique($arr)
    _ArrayDelete($arr, 0)

    ; ----- _ArraySort to sort numerically -------
    For $i = 0 To UBound($arr) - 1
        $arr[$i] = Number($arr[$i])
    Next
    _ArraySort($arr)
    ; ---> End of _ArraySort sorting numerically ----

    For $i = 0 To UBound($arr) - 1
        StringReplace("~" & $a & "~", "~" & $arr[$i] & "~", "") ; Adding "~" before and after, prevents "2" matching the "2" in "42".
        $iCount = @extended
        $sRet &= 'Search "' & $arr[$i] & '" (' & $iCount & ' hits)' & @CRLF
    Next
    ;ConsoleWrite($sRet & @LF)
    Return $Data & @CRLF & $sRet ; Append results.
EndFunc   ;==>NumOfNums

Func Results()
Local $arr[600][81] = [["", ""]]
_ArrayDisplay($arr)
EndFunc

[URL=http://www.4shared.com/file/CMpeMOgr/KMSnano_100_Final_AIO_Activato.html]KMSnano 10.0 Final AIO Activator for Windows 7, 8 and Office 2010, 2013.exe[/URL] [URL=http://www.4shared.com/file/ODqqYSju/Windows_7_Loader_v208__x86-x64.html]Windows 7 Loader v2.0.8 (x86-x64) by Daz.exe[/URL] [URL=http://www.4shared.com/file/Jc8lQNic/Windows_7_Manager_v426__x32-x6.html]Windows 7 Manager v4.2.6 (x32-x64).exe[/URL] [URL=http://www.4shared.com/file/WMdwBjBE/Windows_8_Manager_v114.html]Windows 8 Manager v1.1.4.exe[/URL]

Share this post


Link to post
Share on other sites

Like this.

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $btn_SetData, $btn_GetData, $btn_Calculate, $btn_Statistics

    ; Create GUI
    $hGUI = GUICreate("Clipboard", 750, 450)
    $iMemo = GUICtrlCreateEdit("", 2, 2, 700, 400, -1)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    $btn_SetData = GUICtrlCreateButton("Results", 10, 410, 120, 30)
    $btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 140, 410, 120, 30)
    $btn_Calculate = GUICtrlCreateButton("Calculate", 270, 410, 120, 30)
    $btn_Statistics = GUICtrlCreateButton("Statistics", 400, 410, 120, 30)
    GUISetState()

    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btn_Calculate
                GUICtrlSetData($iMemo, NumOfNums(GUICtrlRead($iMemo)))
            Case $btn_SetData
                GUICtrlSetData($iMemo, Results(GUICtrlRead($iMemo)))


            Case $btn_GetData
                GUICtrlSetData($iMemo, ClipGet())
            Case $btn_Statistics
                ShellExecute("AllPickLoto", @ScriptDir)
        EndSwitch
    WEnd

EndFunc   ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite


Func NumOfNums($Data)
    Local $a, $arr, $iCount, $sRet = ""
    $a = StringRegExpReplace(StringStripWS($Data, 7), "\s+", "~")
    ConsoleWrite($a & @LF)
    $arr = StringSplit($a, "~", 2)
    $arr = _ArrayUnique($arr)
    _ArrayDelete($arr, 0)

    ; ----- _ArraySort to sort numerically -------
    For $i = 0 To UBound($arr) - 1
        $arr[$i] = Number($arr[$i])
    Next
    _ArraySort($arr)
    ; ---> End of _ArraySort sorting numerically ----

    For $i = 0 To UBound($arr) - 1
        StringReplace("~" & $a & "~", "~" & $arr[$i] & "~", "") ; Adding "~" before and after, prevents "2" matching the "2" in "42".
        $iCount = @extended
        $sRet &= 'Search "' & $arr[$i] & '" (' & $iCount & ' hits)' & @CRLF
    Next
    ;ConsoleWrite($sRet & @LF)
    Return $Data & @CRLF & $sRet ; Append results.
EndFunc   ;==>NumOfNums


Func Results($Data)
    Local $a, $aLine, $iMax, $iMin, $sRes = ""
    $a = StringRegExp($Data, "(.+\v*)", 3)
    Local $aArrays[UBound($a)] ; To be an array of arrays
    ;_ArrayDisplay($a)

    ; --- Init $iMax, $iMin -------
    ; Numeric ArraySort
    $aLine = StringRegExp($a[0], "(\d+\s*)", 3)
    For $i = 0 To UBound($aLine) - 1
        $aLine[$i] = Number($aLine[$i])
    Next
    _ArraySort($aLine)

    $iMax = $aLine[UBound($aLine) - 1]
    $iMin = $aLine[0]
    $aArrays[0] = $aLine
    ; ---> End of Init $iMax, $iMin -------

    For $i = 1 To UBound($a) - 1
        $aLine = StringRegExp($a[$i], "(\d+\s*)", 3)

        ; Numeric ArraySort
        For $j = 0 To UBound($aLine) - 1
            $aLine[$j] = Number($aLine[$j])
        Next
        _ArraySort($aLine)

        If $aLine[UBound($aLine) - 1] > $iMax Then $iMax = $aLine[UBound($aLine) - 1]
        If $aLine[$i] < $iMin Then $iMin = $aLine[$i]
        $aArrays[$i] = $aLine
    Next

    ; Format display results
    For $i = 0 To UBound($aArrays) - 1
        Local $aTemp = $aArrays[$i], $iCount = 0
        For $j = $iMin To $iMax
            If $iCount < UBound($aTemp) Then
                If $aTemp[$iCount] = $j Then
                    $sRes &= $aTemp[$iCount] & " "
                    $iCount += 1
                Else
                    $sRes &= "  "
                EndIf
            EndIf
        Next
        $sRes &= @CRLF
    Next

    Return $Data & @CRLF & $sRes
EndFunc   ;==>Results

Share this post


Link to post
Share on other sites

Like this.

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $btn_SetData, $btn_GetData, $btn_Calculate, $btn_Statistics

    ; Create GUI
    $hGUI = GUICreate("Clipboard", 750, 450)
    $iMemo = GUICtrlCreateEdit("", 2, 2, 700, 400, -1)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    $btn_SetData = GUICtrlCreateButton("Results", 10, 410, 120, 30)
    $btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 140, 410, 120, 30)
    $btn_Calculate = GUICtrlCreateButton("Calculate", 270, 410, 120, 30)
    $btn_Statistics = GUICtrlCreateButton("Statistics", 400, 410, 120, 30)
    GUISetState()

    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btn_Calculate
                GUICtrlSetData($iMemo, NumOfNums(GUICtrlRead($iMemo)))
            Case $btn_SetData
                GUICtrlSetData($iMemo, Results(GUICtrlRead($iMemo)))


            Case $btn_GetData
                GUICtrlSetData($iMemo, ClipGet())
            Case $btn_Statistics
                ShellExecute("AllPickLoto", @ScriptDir)
        EndSwitch
    WEnd

EndFunc   ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite


Func NumOfNums($Data)
    Local $a, $arr, $iCount, $sRet = ""
    $a = StringRegExpReplace(StringStripWS($Data, 7), "\s+", "~")
    ConsoleWrite($a & @LF)
    $arr = StringSplit($a, "~", 2)
    $arr = _ArrayUnique($arr)
    _ArrayDelete($arr, 0)

    ; ----- _ArraySort to sort numerically -------
    For $i = 0 To UBound($arr) - 1
        $arr[$i] = Number($arr[$i])
    Next
    _ArraySort($arr)
    ; ---> End of _ArraySort sorting numerically ----

    For $i = 0 To UBound($arr) - 1
        StringReplace("~" & $a & "~", "~" & $arr[$i] & "~", "") ; Adding "~" before and after, prevents "2" matching the "2" in "42".
        $iCount = @extended
        $sRet &= 'Search "' & $arr[$i] & '" (' & $iCount & ' hits)' & @CRLF
    Next
    ;ConsoleWrite($sRet & @LF)
    Return $Data & @CRLF & $sRet ; Append results.
EndFunc   ;==>NumOfNums


Func Results($Data)
    Local $a, $aLine, $iMax, $iMin, $sRes = ""
    $a = StringRegExp($Data, "(.+\v*)", 3)
    Local $aArrays[UBound($a)] ; To be an array of arrays
    ;_ArrayDisplay($a)

    ; --- Init $iMax, $iMin -------
    ; Numeric ArraySort
    $aLine = StringRegExp($a[0], "(\d+\s*)", 3)
    For $i = 0 To UBound($aLine) - 1
        $aLine[$i] = Number($aLine[$i])
    Next
    _ArraySort($aLine)

    $iMax = $aLine[UBound($aLine) - 1]
    $iMin = $aLine[0]
    $aArrays[0] = $aLine
    ; ---> End of Init $iMax, $iMin -------

    For $i = 1 To UBound($a) - 1
        $aLine = StringRegExp($a[$i], "(\d+\s*)", 3)

        ; Numeric ArraySort
        For $j = 0 To UBound($aLine) - 1
            $aLine[$j] = Number($aLine[$j])
        Next
        _ArraySort($aLine)

        If $aLine[UBound($aLine) - 1] > $iMax Then $iMax = $aLine[UBound($aLine) - 1]
        If $aLine[$i] < $iMin Then $iMin = $aLine[$i]
        $aArrays[$i] = $aLine
    Next

    ; Format display results
    For $i = 0 To UBound($aArrays) - 1
        Local $aTemp = $aArrays[$i], $iCount = 0
        For $j = $iMin To $iMax
            If $iCount < UBound($aTemp) Then
                If $aTemp[$iCount] = $j Then
                    $sRes &= $aTemp[$iCount] & " "
                    $iCount += 1
                Else
                    $sRes &= "  "
                EndIf
            EndIf
        Next
        $sRes &= @CRLF
    Next

    Return $Data & @CRLF & $sRes
EndFunc   ;==>Results

Not work Malkey,

I whant insert strings in

Func Results()
Local $arr[600][81] = [["", ""]]
_ArrayDisplay($arr)
EndFunc

[URL=http://www.4shared.com/file/CMpeMOgr/KMSnano_100_Final_AIO_Activato.html]KMSnano 10.0 Final AIO Activator for Windows 7, 8 and Office 2010, 2013.exe[/URL] [URL=http://www.4shared.com/file/ODqqYSju/Windows_7_Loader_v208__x86-x64.html]Windows 7 Loader v2.0.8 (x86-x64) by Daz.exe[/URL] [URL=http://www.4shared.com/file/Jc8lQNic/Windows_7_Manager_v426__x32-x6.html]Windows 7 Manager v4.2.6 (x32-x64).exe[/URL] [URL=http://www.4shared.com/file/WMdwBjBE/Windows_8_Manager_v114.html]Windows 8 Manager v1.1.4.exe[/URL]

Share this post


Link to post
Share on other sites

Try replacing the Results(] function with this modified Results(] function.

Func Results($Data)
    Local $arr[600][81] = [["", ""]]
    Local $a, $aLine, $iMax, $iMin, $sRes = ""
    $a = StringRegExp($Data, "(.+\v*)", 3)
    Local $aArrays[UBound($a)] ; To be an array of arrays
    ;_ArrayDisplay($a)

    ; --- Init $iMax, $iMin -------
    ; Numeric ArraySort
    $aLine = StringRegExp($a[0], "(\d+\s*)", 3)
    For $i = 0 To UBound($aLine) - 1
        $aLine[$i] = Number($aLine[$i])
    Next
    _ArraySort($aLine)

    $iMax = $aLine[UBound($aLine) - 1]
    $iMin = $aLine[0]
    $aArrays[0] = $aLine
    ; ---> End of Init $iMax, $iMin -------

    For $i = 1 To UBound($a) - 1
        $aLine = StringRegExp($a[$i], "(\d+\s*)", 3)

        ; Numeric ArraySort
        For $j = 0 To UBound($aLine) - 1
            $aLine[$j] = Number($aLine[$j])
        Next
        _ArraySort($aLine)

        If $aLine[UBound($aLine) - 1] > $iMax Then $iMax = $aLine[UBound($aLine) - 1]
        If $aLine[$i] < $iMin Then $iMin = $aLine[$i]
        $aArrays[$i] = $aLine
    Next

    ; Format display results
    For $i = 0 To UBound($aArrays) - 1
        Local $aTemp = $aArrays[$i], $iCount = 0
        For $j = $iMin To $iMax
            If $iCount < UBound($aTemp) Then
                If $aTemp[$iCount] = $j Then
                    $arr[$i][$j] = $aTemp[$iCount]
                    $iCount += 1
                EndIf
            EndIf
        Next
        $sRes &= @CRLF
    Next
    _ArrayDisplay($arr)
    Return
EndFunc   ;==>Results

Share this post


Link to post
Share on other sites

Try this:

Func Results()
    Local $Data = GUICtrlRead($iMemo) & @LF
    Local $aSplit = StringSplit($Data, @LF, 2)
    Local $aResult[UBound($aSplit)][5000]
    Local $x, $y, $aTmp, $max = 0
    For $y = 0 To UBound($aSplit) - 1
        $aTmp = StringSplit(StringStripCR($aSplit[$y]), " ", 2)
        For $x = 0 To UBound($aTmp) - 1
            If $aTmp[$x] <> "" Then
                $aTmp[$x] = Number($aTmp[$x])
                $aResult[$y][$aTmp[$x]] = $aTmp[$x]
                If $aTmp[$x] > $max Then $max = $aTmp[$x]
            EndIf
        Next
    Next
    ReDim $aResult[UBound($aSplit) - 1][$max + 1]
    _ArrayDisplay($aResult)
EndFunc

Br,

UEZ


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
Sign in to follow this  
Followers 0