trescon Posted July 31, 2013 Posted July 31, 2013 Good evening, maybe I just sleep but I do not know / remember how to assign the contents of one variable to another variable. Let me give an example to better explain: global $ minni1 = "hello" global $ minni2 = "how" ... for $ i = 1 to 40 $pippo[1] [$ i] = $minni&$i (where I want to assign to the array $ foo the value of the variable compound) Next I tried that, but I assign the array name $minni1 , $minni2 and not its content, I tried to assign .... but does not work. How can I make. I have to create the Array $pippo with values ranging from $pippo [1] [1] to $pippo [8] [40], not to create hundreds of rows full of brackets and quotes I thought I'd use this trick but .... does not work, I can not assign the contents of the variable "compound" to the array. If there are other ways to create multidimensional arrays "simply", who knows so kind as to tell me how to do it? thanks Alberto Buonasera, forse ho solo sonno io ma non so/ricordo come assegnare il contenuto di una variabile ad un'altra variabile. Faccio un esempio per spiegarmi meglio : global $minni1 ="ciao" global $minni2="come" ... for $i = 1 to 40 $pippo[1][$i]=$minni&$i (dove io all'array $pippo voglio assegnare il valore della variabile composta) Next Ho provato così ,ma mi assegna all'array il nome $minni1,$minni2 e non il suo contenuto; ho provato con assign.... ma non funziona. Come posso fare. Io devo creare l'Array $Pippo con valori che vanno da $pippo[1][1] a $pippo[8][40] ; per non creare centinaia di righe piene di parentesi quadre e di virgolette ho pensato di usare questo trucco ma .... non funziona, non riesco assegnare il contenuto della variabile "composta" all'array. Se ci sono altri metodi per creare degli array multidimensionali "semplicemente" , chi lo sa è così cortese da dirmi come si fa ? Grazie Thank You Alberto --------------------------------------------------- I am translate with Google.
water Posted July 31, 2013 Posted July 31, 2013 (edited) Why don't you use an array for $minni as well? Global $minni[100] = ["hello", "how"] Edited July 31, 2013 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
trescon Posted July 31, 2013 Author Posted July 31, 2013 Water Thanks, but I have to create a two-dimensional array, and a Fourth Dimensional.There 'not a simpler method that is listed in the example of the manual.An example of my four-dimensional array is:$pippo[5] [4] [50] [3]If I create it as shown in the manual crazy.Are there any alternative methods?thanksAlberto Grazie Water, ma io devo creare un array Bidimensionale e uno Quadridimensionale. Non c'e' mica un metodo piu semplice di quello elencato nell'esempio del manuale. Un esempio del mio array quadridimensionale è : $pippo[5][4][50][3] Se lo creo come indicato sul manuale impazzisco. Ci sono dei metodi alternativi ?? Grazie Alberto Thank You Alberto --------------------------------------------------- I am translate with Google.
czardas Posted July 31, 2013 Posted July 31, 2013 Perhaps this will get you started. #include <Array.au3> Local $aQuestion[4] = ["hello", "how", "are", "you"] ; assign and declare 1D array Local $asArray[4][40] ; only declare 2D array For $i = 0 To 3 For $j = 0 To 39 $asArray[$i][$j] = $aQuestion[$i] & $j Next Next _ArrayDisplay($asArray) operator64 ArrayWorkshop
kylomas Posted July 31, 2013 Posted July 31, 2013 trescon, I thought I'd use this trick but .... does not work, I can not assign the contents of the variable "compound" to the array. If you are determine to use dynamically created variables (good luck trouble shooting) it can be done like this ; #include <array.au3> ; ; create 20 vars using assign for $1 = 1 to 20 assign('myvar' & $1,'element' & $1) Next ; populate array local $array[21] for $1 = 1 to 20 $array[$1] = eval('myvar' & $1) Next _arraydisplay($array) 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
jchd Posted July 31, 2013 Posted July 31, 2013 Water Thanks, but I have to create a two-dimensional array, and a Fourth Dimensional.There 'not a simpler method that is listed in the example of the manual.An example of my four-dimensional array is:$pippo[5] [4] [50] [3]If I create it as shown in the manual crazy.Are there any alternative methods? It is possible that some easier method exists, but look at what you're asking: you want this 4D array with 5 * 4 * 50 * 3 (that is 3000) elements be initialized without having to supply initialization values? If we refer to your title, creating the $pippo array is exactly the line you show above. Right after creation it contains only empty strings in its 3000 cells. If you want it to hold meaningful data you obviously have to supply 3000 values (or less if you want). What is your data source looking like? Is it a flat file, result of computations, output from a database, what else? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
trescon Posted August 2, 2013 Author Posted August 2, 2013 The data imserisco I them manually, in practice the array it is a table that contains fixed values. The four dimensions identify the value that I must return to varificarsi of individual dimensions values 4 ---------- I dati li imserisco io manualmente, in pratica l'array e' una tabella che contiene dei valori fissi. Le quattro dimensioni identificano il valore che mi deve restituire al varificarsi dei 4 valori delle singole dimensioni Thank You Alberto --------------------------------------------------- I am translate with Google.
trescon Posted August 2, 2013 Author Posted August 2, 2013 In practice, upon the occurrence of any of the various possibilities do I have to have a very precise reply from the array. If you know tell me a better way and less complicated to have a very precise output based on the selected parameters from 4 inputs entered by those who use the program. Thank you ------------ In pratica al verificarsi di ognuna delle varie possibilita devo avere una ben precisa risposta dall 'array. Se voi sapete indicarmi un metodo migliore e meno complicato per avere un output ben preciso in base a 4 parametri selezionati da degli input inseriti da chi usa il programma. Grazie Thank You Alberto --------------------------------------------------- I am translate with Google.
jchd Posted August 2, 2013 Posted August 2, 2013 Here is how you should declare and initialize a 2D and a 4D array: Local $a2D[2][3] = [ _ [1, 2, 3], _ [4, 5, 6] _ ] _ArrayDisplay($a2D) Local $a4D[2][3][3][2] = [ _ [ _ [[1, 2], [3, 4], [5, 6]], _ [[7, 8], [9, 10], [11, 12]], _ [[13, 14], [15, 16], [17, 18]] _ ], _ [ _ [[19, 20], [21, 22], [23, 24]], _ [[25, 26], [27, 28], [29, 30]], _ [[31, 32], [33, 34], [35, 36]] _ ] _ ] I must misunderstand the Google emasculation of your question. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
kylomas Posted August 2, 2013 Posted August 2, 2013 (edited) I must misunderstand the Google emasculation of your question. Yes, been looking at this on and off to try to get the sense of it. @trescon - If the arrays are static (not changing) then what jchd suggests is simple enough. If they will change periodically, you can devise a way to load them from files or a database using loops. kylomas edit: spelling Edited August 2, 2013 by 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
trescon Posted August 3, 2013 Author Posted August 3, 2013 Good morning, and if I create a 1 d array where the array weight accegno 4 D on the individual digits of the 1 d. Let me explain $pippo [1] [3] [2] [6] I mean it like it $pippo [1326] Should always have the link array match the values in the same way. Right? So I create an array only and also much more easy to configure. Critical aspect and tips Thank you Alberto Thank You Alberto --------------------------------------------------- I am translate with Google.
czardas Posted August 3, 2013 Posted August 3, 2013 (edited) No. That's wrong. 1 x 3 x 2 x 6 = 36 $pippo [36] $pippo [1] [3] [2] [6] can also be created as a 3D array $pippo [3] [2] [6] Have you tried the examples posted earlier? I understand what you are saying, but it's the wrong way to think about it. You should avoid making the array larger than the size you actually need. Edited August 3, 2013 by czardas operator64 ArrayWorkshop
trancexx Posted August 3, 2013 Posted August 3, 2013 My Itallian is just fine . What he wants is something like this: #include <Array.au3> Global $minni04 = "si" Global $minni01 = "come" Global $minni112 = "ciao" Global $minni12 = "fai!" Global $minni13 = "presto" Global $minni03 = "non" Global $minni05 = "parla" Global $minni10 = "fai" Global $minni02 = "mai" Global $minni04 = "si" Global $minni010 = "l'inglese" ;~ ... Local $pippo[2][41] For $i = 0 To 1 For $j = 0 To 40 $pippo[$i][$j] = Eval("minni" & $i & $j) Next Next _ArrayDisplay($pippo) Why does he want that is beyond me and Italian who doesn't know English just isn't right ♡♡♡ . eMyvnE
czardas Posted August 3, 2013 Posted August 3, 2013 (edited) My Itallian is just fine . What he wants is something like this: Why does he want that is beyond me and Italian who doesn't know English just isn't right LOL It took me a while for me to figure it out myself, and I see exactly how you came to the conclusion. @trescon Si prega di rispondere quando la gente offrire aiuto. Utilizzare Google translate. Edited August 3, 2013 by czardas operator64 ArrayWorkshop
jchd Posted August 3, 2013 Posted August 3, 2013 trancexx, You may be right but I question the actual need just as you do. I bet that if/when we get a clue at what this construction is aimed to then we'll provide a completely different and cleaner way. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
trescon Posted August 3, 2013 Author Posted August 3, 2013 Perhaps this will get you started. #include <Array.au3> Local $aQuestion[4] = ["hello", "how", "are", "you"] ; assign and declare 1D array Local $asArray[4][40] ; only declare 2D array For $i = 0 To 3 For $j = 0 To 39 $asArray[$i][$j] = $aQuestion[$i] & $j Next Next _ArrayDisplay($asArray) I'm sorry, but I took a quick look but not thorough. Now looking closely it seems to me that it is not feasible with a 4D though with very complicated code. Anyway, thank you, you always learn from the suggestions. AlbertoScusa, ma avevo dato un'occhiata veloce ma non approfondita. Ora guardando attentamente mi sembra che non sia attuabile con un 4D se con complicando molto il codice. Comunque grazie, dai suggerimenti si impara sempre. Alberto Thank You Alberto --------------------------------------------------- I am translate with Google.
trescon Posted August 3, 2013 Author Posted August 3, 2013 No. That's wrong. 1 x 3 x 2 x 6 = 36 $pippo [36] $pippo [1] [3] [2] [6] can also be created as a 3D array $pippo [3] [2] [6] Have you tried the examples posted earlier? I understand what you are saying, but it's the wrong way to think about it. You should avoid making the array larger than the size you actually need. No, have not tried them but I tried to understand how they work and I do not seem to fit.For the fact of having an array much larger than I could have, I agree with you, but I produce of a functional code with the skills I have, which are few.I have to do the work here for 2 months, and I do not work the programmer, so the time I can devote to the development of software can be up to 30-40 minutes a day.Thanks for letting me see it.Alberto NO, non le ho provate ma ho cercato di capire come funzionano e mi sembrano non adatte. Per il fatto di avere un array molto più grande di quello che potrei avere, sono daccordo con te, ma io dei produrre un codice funzionale con le competenze in mio possesso, che sono poche. Devo fare il lavoro da qui da 2 mesi, e io di lavoro non faccio il programmatore, quindi il tempo che posso dedicare allo sviluppo del software può essere al massimo 30-40 minuti al giorno. Grazie per avermi fatto notare la cosa. Alberto Thank You Alberto --------------------------------------------------- I am translate with Google.
trescon Posted August 3, 2013 Author Posted August 3, 2013 No. That's wrong. 1 x 3 x 2 x 6 = 36 $pippo [36] $pippo [1] [3] [2] [6] can also be created as a 3D array $pippo [3] [2] [6] Have you tried the examples posted earlier? I understand what you are saying, but it's the wrong way to think about it. You should avoid making the array larger than the size you actually need. To complete the previous answer is to say that practically the array might look like this:$ foo [5] [6] [70] [3]Sorry if I have specified before.Alberto Thank You Alberto --------------------------------------------------- I am translate with Google.
kylomas Posted August 3, 2013 Posted August 3, 2013 trescon, Can you describe at a higher level what you are doing and what kind of data the array holds? 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
trescon Posted August 3, 2013 Author Posted August 3, 2013 My Itallian is just fine . What he wants is something like this: #include <Array.au3> Global $minni04 = "si" Global $minni01 = "come" Global $minni112 = "ciao" Global $minni12 = "fai!" Global $minni13 = "presto" Global $minni03 = "non" Global $minni05 = "parla" Global $minni10 = "fai" Global $minni02 = "mai" Global $minni04 = "si" Global $minni010 = "l'inglese" ;~ ... Local $pippo[2][41] For $i = 0 To 1 For $j = 0 To 40 $pippo[$i][$j] = Eval("minni" & $i & $j) Next Next _ArrayDisplay($pippo) Why does he want that is beyond me and Italian who doesn't know English just isn't right Hello TRANCEXX, your solution strikes me.It seems simple to apply and at the same time also seems to me easy to read and understand.I will do the tests, but at the moment is the solution that I like the most 'thanksAlberto Salve TRANCEXX, la tua soluzione mi colpisce molto. Mi sembra semplice da applicare e nel contempo mi sembra anche facile da leggere e capire. Farò delle prove, ma al momento è la soluzione che mi piace di piu' Grazie Alberto Thank You Alberto --------------------------------------------------- I am translate with Google.
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