Codemike 0 Posted February 11, 2011 Is it possible something programming way in AutoIt to know if is word group like: bread ($5) limodade ($1) cake ($10) limonade ($2) to take Clipget() to find out prices and give them symbols and notice that there is limonade word two times? Share this post Link to post Share on other sites
kylomas 415 Posted February 11, 2011 CodeMike, This is what I understand from your post. You have items: bread, limodade, cake, limodade And you want to associate prices with each item. Somehow clipget() is involved with the prices. You also want to detect duplicate items. Questions: - where do each of these data elements come from (gui, file, db, etc)? - what do you want to do with them? It is easy enough to detect duplicates. What you should do: Answer the two questions above, write some code, follow-up with questions resulting from code or design issues. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Share this post Link to post Share on other sites
Codemike 0 Posted February 17, 2011 CodeMike, This is what I understand from your post. You have items:bread, limodade, cake, limodadeAnd you want to associate prices with each item. Somehow clipget() is involved with the prices. You also want to detect duplicate items.Questions:- where do each of these data elements come from (gui, file, db, etc)?- what do you want to do with them?It is easy enough to detect duplicates.What you should do:Answer the two questions above, write some code, follow-up with questions resulting from code or design issues. kylomasThis is some vb.net example. Can AutoIt do something like?Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim prices = New Dictionary(Of String, Decimal)() Dim rows = Clipboard.GetText().Split(ControlChars.NewLine) For Each row In rows If (Not String.IsNullOrWhiteSpace(row)) Then Dim information = row.Split(ControlChars.Tab) Dim Sum As Decimal If information.Length <> 3 OrElse information(2) <> "dollars" OrElse Decimal.TryParse(information(1), Sum) Then MessageBox.Show("Row's information wrong form: " & row) ElseIf prices.ContainsKey(information(0)) Then MessageBox.Show("product " + information(0) + " is many times, only first notice") Else prices.Add(information(0), Sum) End If End If Next End SubEnd Class Share this post Link to post Share on other sites
Codemike 0 Posted February 17, 2011 Please some help? Is it some way do in AutoIt that if I get ClipGet() which include example words "computer, house, apple, computer" that program knows that there is two times "computer" word? Share this post Link to post Share on other sites
kylomas 415 Posted February 17, 2011 CodeMike, I do NOT know vb.net but am able to glean the following: - the code is splitting clip-board data on "tab" characters - there is some kind of dictionary look-up ocurring (unclear where the dict data is comming from, possibly some DB as do NOT understand the first line of the code) - there is something called "TryParse"...don't know if it is vb.net or a function that is not shown - after some editing results are either echoed to the user or a dict entry is added Net out, yes this can be done in AutoIT, need more info (especially code) to arrive at a solution kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Share this post Link to post Share on other sites
kylomas 415 Posted February 17, 2011 CodeMike, To answer your question specific to duplicates... The following code will work on alphameric data. The routine could be turned into a function within other code. ; ; ; clipboard contains "john sue mary alex john" as tab seperated values ; ; #include<array.au3> $str = stringsplit(clipget(),@tab) _arraysort($str) for $i = 0 to ubound($str) - 1 if $i = 0 then ContinueLoop if $str[$i] = $str[$i-1] then consolewrite('Dup found at elements ' & $i-1 & ' ' & $i & ' value = ' & $str[$i] & @lf) Next Good Luck, kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Share this post Link to post Share on other sites
Codemike 0 Posted February 18, 2011 Thanks very much. Share this post Link to post Share on other sites