IKilledBambi Posted December 4, 2008 Share Posted December 4, 2008 I'm wanting to make it so that if an array is added more than once it adds a number so the end result is like, Pan(3) because pan messaged me 3 times, frank(1) because he messaged me once, I'm not wanting it to add up in the array. I want it to at the end log who messaged me and how many times. expandcollapse popupHotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") Global $Paused Global $f = "I'm away. The window will be closed." Global $Number = 1 Global $GTitle = 0 AutoItSetOption("WinTitleMatchMode", 2) #include <file.au3> #include <array.au3> Global ChatArray[25] Func OnAutoItStart() If FileExists(@ScriptDir & "\Logs") Then Else DirCreate(@ScriptDir & "\Logs") EndIf If FileExists(@ScriptDir & "\Logs\Ammounts.log") Then FileDelete(@ScriptDir & "\Logs\Ammounts.log") EndIf If FileExists(@ScriptDir & "\Logs\Names.log") Then FileDelete(@ScriptDir & "\Logs\Names.log") EndIf EndFunc ;==>OnAutoItStart While 1 Sleep(100) If WinExists("Chat", "") Then $Title = WinGetTitle("Chat", "") $Title = $GTitle WinActivate("Chat", "") WinWaitActive("Chat", "") ClipPut($f) Send("^v" & "{ENTER}") Sleep(100) WinClose("Chat", "") _FileWriteLog(@ScriptDir & "\Logs\Ammounts.log", $Number) _FileWriteLog(@ScriptDir & "\Logs\Names.log", $Title) $Number = $Number + 1 Call("Arrays") EndIf Sleep(1) WEnd Func Arrays() Local $AS = _ArraySearch(ChatArray, $Title) If $AS Then Else _ArrayAdd(ChatArray, $Title) EndIf EndFunc Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) WEnd EndFunc ;==>TogglePause Func OnAutoItExit() If FileExists(@ScriptDir & "\Logs") Then ShellExecute(@ScriptDir & "\Logs") EndIf EndFunc ;==>OnAutoItExit Func Terminate() Exit 0 EndFunc ;==>Terminate Link to comment Share on other sites More sharing options...
Rental Posted December 4, 2008 Share Posted December 4, 2008 (edited) this what you mean? dim $array1[16] dim $array2[16] For $i = 0 to 14 $array1[$i] = "joe["&$i&"]";random names i thought of $array2[$i] = "sam["&$i&"]" MsgBox(0, "", $array1[$i]&" "&$array2[$i]) Next Edited December 4, 2008 by Rental Link to comment Share on other sites More sharing options...
IKilledBambi Posted December 4, 2008 Author Share Posted December 4, 2008 (edited) No I don't want it to increase the array, because I don't know who is going to message me. I just want it to be saved in the log in the end like this. Fan(4) Cramps(45) Tree(1) Pam(1) I can't create an array for everybody on my friends list, that would be madness, plus I couldn't give other people the script because they don't necessarily have my friends on their list. P.S. I've been using autoit for awhile but just not got into arrays, I'm going to bed hopefully I can wake up to some answers. Edited December 4, 2008 by IKilledBambi Link to comment Share on other sites More sharing options...
rasim Posted December 4, 2008 Share Posted December 4, 2008 IKilledBambiExample:#include <Array.au3> ;Only for _ArrayDisplay Dim $aTest[4] $aTest[0] = 3 $aTest[1] = "One" $aTest[2] = "Two" $aTest[3] = "Three" _ArrayDisplay($aTest, "Before") $aTest[0] += 1 ReDim $aTest[$aTest[0] + 1] $aTest[$aTest[0]] = "Four" _ArrayDisplay($aTest, "After") Link to comment Share on other sites More sharing options...
IKilledBambi Posted December 4, 2008 Author Share Posted December 4, 2008 I can't pre-define an array I don't want it to go up in array number, i want a whole new number created, i want pam(1) not pam[1] Link to comment Share on other sites More sharing options...
KaFu Posted December 4, 2008 Share Posted December 4, 2008 Then I would recommend to create a 2-dimensional array... 1 dimension with name, 2nd with count... If you receive a message you parse through the array if the senders name is somewhere in the first dimension, if not add the name in dim1 and a 1 in dim2. If senders name is found just add 1 to dim2... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now