Jump to content
Sign in to follow this  
MisterC

Sorting duplicates using editboxes

Recommended Posts

MisterC

Hello peops,

Im just messing arrount with autoit to learn the code a bit and tried sorting data in edit boxes by changing a script a bit.

#include <E:\AutoIt3\Include\ButtonConstants.au3>
#include <E:\AutoIt3\Include\EditConstants.au3>
#include <E:\AutoIt3\Include\GUIConstantsEx.au3>
#include <E:\AutoIt3\Include\StaticConstants.au3>
#include <E:\AutoIt3\Include\WindowsConstants.au3>
#include <E:\AutoIt3\Include\Array.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 379, 192, 114)
$Edit1 = GUICtrlCreateEdit("", 8, 24, 121, 305)
GUICtrlSetData(-1, "")
$Edit2 = GUICtrlCreateEdit("", 160, 24, 121, 305)
GUICtrlSetData(-1, "")
$Edit3 = GUICtrlCreateEdit("", 312, 24, 121, 305)
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("Button1", 184, 344, 75, 25, 0)
$Group1 = GUICtrlCreateGroup("Group1", 480, 8, 137, 329)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    
Case $Button1
local $z
$x = guictrlread($Edit1)
$y = guictrlread($Edit2)
           
            
            
$file1 = StringReplace($x, @CRLF, "*!*") 
$file2 = StringReplace($y, @CRLF, "*!*")



$array1 = StringSplit($file1, "*!*") 
$array2 = StringSplit($file2, "*!*")

For $i = 1 To $array1[0] 
    For $j = 1 To $array2[0] 
        If StringLower($array1[$i]) = StringLower($array2[$j]) Then 
            $array1[$i] = "" 
            $array2[$j] = "" 
            ExitLoop
        EndIf
    Next
Next

_ArrayDisplay($array1)
_ArrayDisplay($array2)

For $i = 1 To $array1[0] 
    If $array1[$i] <> "" Then FileWriteLine($z, $array2[$i])
Next


GUICtrlSetData ($Edit3, $z)


    EndSwitch
WEnd

I just can't figure out how to get the end data.

just using GUICtrlSetData ($Edit3, $z) doesn't work.

Ány idea's ?

Greetings -C-

Share this post


Link to post
Share on other sites
whim

FileWriteLine($z, $array2[$i])

$z needs to be a file handle or filename here, an uninitilised local variable won't cut it ...

maybe you meant $z = $array2[$i] there ?

whim

Share this post


Link to post
Share on other sites
MisterC

Atleast it gives me a output, not the output I would like but it's something :) tnx

Share this post


Link to post
Share on other sites
MisterC

Atleast it gives me a output, not the output I would like but it's something :) tnx

Can't get it to do anything usefull, anyone has a idea what i'm doing wrong here ?

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  

×