Renderer Posted April 19, 2016 Share Posted April 19, 2016 Hello there! Here we have 2 arrays : global $array1[3] = ['A','B','C'] global $array2[3] = ['1','2','3'] how can i match the elements from those two Arrays? For example how can i match the first Array 'A' with the second Array '3'? Thanks in advance! Link to comment Share on other sites More sharing options...
AutoBert Posted April 19, 2016 Share Posted April 19, 2016 More info's please. Why should 'A' match 3? What should matching C, and what B? Link to comment Share on other sites More sharing options...
czardas Posted April 19, 2016 Share Posted April 19, 2016 (edited) I'm not sure if this is what you mean. You need this: https://www.autoitscript.com/forum/topic/179779-_arraydeclarefromstring-_arraytodeclarationstring-_arrayshufflemultidim-_arraycompare-_arrayenumvalues-_arrayassign/ #include 'ArrayMultiDim.au3' Global $array1[3] = ['A','B','C'] Global $array2[3] = ['1','2','3'] If _ArrayToDeclarationString($array1) == _ArrayToDeclarationString($array2) Then ; change == operator to = for case insensitive check MsgBox(0, "", "Arrays are identical.") Else MsgBox(0, "", "Arrays are different.") EndIf Edit: Hmm it seems you mean something else. Edited April 19, 2016 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
mikell Posted April 19, 2016 Share Posted April 19, 2016 Hmm it seems what ? It actually means nothing Link to comment Share on other sites More sharing options...
Renderer Posted April 19, 2016 Author Share Posted April 19, 2016 3 hours ago, AutoBert said: More info's please. Why should 'A' match 3? What should matching C, and what B? I wanted to make some array matching. I want to make the $array1 each element correspond with the $array2 each element.So the basic idea is to create a corresponded for $array1 in $array2 , like the images bellow. Link to comment Share on other sites More sharing options...
alien4u Posted April 19, 2016 Share Posted April 19, 2016 Something like this: $oDictionary = ObjCreate("Scripting.Dictionary") $oDictionary.ADD("A", "1") $oDictionary.ADD("B", "2") $oDictionary.ADD("C", "3") Or Like this: $oDictionary = ObjCreate("Scripting.Dictionary") $oDictionary.ADD("A", "3") $oDictionary.ADD("B", "1") $oDictionary.ADD("C", "2") Regards Alien. Link to comment Share on other sites More sharing options...
spudw2k Posted April 19, 2016 Share Posted April 19, 2016 Not sure what the goal is here. You could use a scripting dictionary like Alien has shown. You could use another array to pair up the array indexes. You could even use a 1 dim array with values and a 2 dim array to create pairs. Lots of options, but like I said...without knowing the goal it's hard to tailor/polish a solution. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Gianni Posted April 19, 2016 Share Posted April 19, 2016 ??? Global $array1[3] = ['A', 'B', 'C'] Global $array2[3] = ['1', '2', '3'] For $i1 = 0 To UBound($array1) - 1 For $i2 = 0 To UBound($array2) - 1 ConsoleWrite($array1[$i1] & " --> " & $array2[$i2] & @CRLF) Next Next Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
AutoBert Posted April 19, 2016 Share Posted April 19, 2016 @alien4u: in a Scripting Dictionary for each key can only exists one value. @Chimp: seem that TE means your solution, the solution is showing all posible combinations of both arrays Link to comment Share on other sites More sharing options...
alien4u Posted April 19, 2016 Share Posted April 19, 2016 (edited) 2 hours ago, AutoBert said: @alien4u: in a Scripting Dictionary for each key can only exists one value. @Chimp: seem that TE means your solution, the solution is showing all posible combinations of both arrays Hi @AutoBert Of course in my example there is two different illustrative examples this is why I said "Like this" "OR like this", 2 different codes but not the same code twice in the same script. Sorry If I was not clear enough. Regards Alien. Edited April 19, 2016 by alien4u Typo Link to comment Share on other sites More sharing options...
AutoBert Posted April 20, 2016 Share Posted April 20, 2016 5 hours ago, alien4u said: Sorry If I was not clear enough. May be talking in native language is better, i am german Link to comment Share on other sites More sharing options...
iamtheky Posted April 20, 2016 Share Posted April 20, 2016 Ich spreche nur wenig. Ich spielte Fußball vor 15 Jahren. And did 6-8 grade in Wurzburg, So as long as you are calling me something derogatory, or telling me to sit down on the bench, then I should understand just fine. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
alien4u Posted April 20, 2016 Share Posted April 20, 2016 1 hour ago, AutoBert said: May be talking in native language is better, i am german I don't understand what you mean but anyways I'm Cuban and the last time I check Spanish is more difficult than German. But this is an English speaking forum so again I don't get what you mean. Regards Alien. Link to comment Share on other sites More sharing options...
iamtheky Posted April 20, 2016 Share Posted April 20, 2016 spanish is much easier for me than german. compound languages are a biatch inasmuch as they smash words together ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
alien4u Posted April 20, 2016 Share Posted April 20, 2016 We should not probably discuss this here but is not the same in English? Contractions? and words like: meritless, childhood and so on, to many to list? Anyways I don't get what he try to point. And to be clear I mean no offend to anyone I just don't understand what @AutoBert try to point. Regards Alien. Link to comment Share on other sites More sharing options...
iamtheky Posted April 20, 2016 Share Posted April 20, 2016 (edited) eh, discussing things and going off topic are what nights are for. And it was a joke to use inasmuch , which is three words smashed together, to say that is the issue with another language. They do both have a ton of phoenitically similar sounding words, but thats probably indicative of all the Western Germanic languages. Edited April 20, 2016 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Danyfirex Posted April 20, 2016 Share Posted April 20, 2016 (edited) Hello. Just for fun. expandcollapse popup#include <Crypt.au3> Global $array1[3] = ['A', 'B', 'C'] Global $array2[3] = ['1', '2', '3'] Global $array3[5] = ['A', 'B', 'C', "Autoit", ":)"] Global $array4[5] = ['3', '1', '2', "Rocks", ":S"] _CreateMatch($array1, $array2) ;Create Match base in a fingerprint of array data _CreateMatch($array3, $array4) ConsoleWrite("Array Match: " & _CheckMatch($array1, $array2) & @CRLF) ;match ConsoleWrite("Array Match: " & _CheckMatch($array3, $array4) & @CRLF) ;match ;change some array values to change the match $array1[2] = ":(" $array3[3] = "Danyfirex" ConsoleWrite("Array Match: " & _CheckMatch($array1, $array2) & @CRLF) ;not match ConsoleWrite("Array Match: " & _CheckMatch($array3, $array4) & @CRLF) ;not match Func _CheckMatch($aArray1, $aArray2) Local $sString = "" Local $sVar = "" If Not UBound($aArray1) = UBound($aArray2) Then Return SetError(1, 0, False) For $i = 0 To UBound($aArray1) - 1 $sString &= $aArray1[$i] & $aArray2[$i] Next ;~ ConsoleWrite($sString & @CRLF) $sVar = "fingerprint" & Hex(_Crypt_HashData($sString, $CALG_MD5)) ;~ ConsoleWrite($sVar & @CRLF) Return IsDeclared($sVar) EndFunc ;==>_CheckMatch Func _CreateMatch($aArray1, $aArray2) Local $sString = "" Local $sVar = "" If Not UBound($aArray1) = UBound($aArray2) Then Return SetError(1, 0, False) For $i = 0 To UBound($aArray1) - 1 $sString &= $aArray1[$i] & $aArray2[$i] Next ;~ ConsoleWrite($sString & @CRLF) $sVar = "fingerprint" & Hex(_Crypt_HashData($sString, $CALG_MD5)) ;~ ConsoleWrite($sVar & @CRLF) If Not IsDeclared($sVar) Then Assign($sVar, 0, 2) Return SetError(0, 0, True) Else Return SetError(2, 0, False) EndIf EndFunc ;==>_CreateMatch El español es bello lol Saludos Edited April 20, 2016 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
AutoBert Posted April 20, 2016 Share Posted April 20, 2016 (edited) 27 minutes ago, iamtheky said: spanish is much easier for me than german. 59 minutes ago, iamtheky said: Ich spreche nur wenig. Ich spielte Fußball vor 15 Jahren. Then your speaking perfect spanish, but understand the same german slang. Würzburg is < 50 km to my hometown. @alien4u: it was just for clarify, but meanwhile i know: just 2 examples. Edited April 20, 2016 by AutoBert Link to comment Share on other sites More sharing options...
alien4u Posted April 20, 2016 Share Posted April 20, 2016 (edited) 1 hour ago, AutoBert said: @alien4u: it was just for clarify, but meanwhile i know: just 2 examples. Here you lost me again. What you mean? 2 examples about what? Sorry I feel a little dump right now look like Cuban's beer is not as good as German ones(this is not a joke is a fact.) Regards Alien. Edited April 20, 2016 by alien4u Link to comment Share on other sites More sharing options...
iamtheky Posted April 20, 2016 Share Posted April 20, 2016 Living in south tx I am better with Spanish slang. The difference between bavarian and franconian slang was like two different languages. Do you want all possibilities, or to be able to set the matches. Can you make a complete one and have us divide it back into the original two arrays? ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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