sbt Posted November 8, 2010 Posted November 8, 2010 Hello, how can I do that autoit gives me the values of an input field separated by a komma in different, sorted variables? For example i write in the input field: 1,3,28,17,19 and the result should be that autoit gives me the variables: a1=1, a2=3, a3=17, a4=19, a5=28. For explanation i need this, cause i have a B/W-Printer with an Inserter for coloured pages, so i want to make a calculator that gives me the string for the inserts. Thanks in advance and sorry for my english sbt
taietel Posted November 8, 2010 Posted November 8, 2010 Try to understand this: #include <Array.au3> Local $arString=StringSplit("1,3,28,17,19",",") Local $a[UBound($arString)] For $i=1 To UBound($arString)-1 $a[$i]=$arString[$i] Next _ArrayDisplay($a) MsgBox(0,"Example","$a[4]="&$arString[4]) Ask if it's unclear. M.I. Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
sbt Posted November 8, 2010 Author Posted November 8, 2010 (edited) Is there a way to sort them automatically from smaller(starting from a1) to big? For the rest; wow great. I had to study with the array reference. Tanks in advance and thanks a lot Edited November 8, 2010 by sbt
taietel Posted November 8, 2010 Posted November 8, 2010 (edited) Sorry for the delay. Coffee break! You can use _ArraySort() function. I don't use it because it puts, for example, 17 in front of 2. #include <Array.au3> Local $arString=StringSplit("1,3,28,17,19",",") ;sorting the array For $i=2 To UBound($arString)-1 If Int($arString[$i-1])>Int($arString[$i]) Then _ArraySwap($arString[$i-1],$arString[$i]) Next Local $a[UBound($arString)] For $i=1 To UBound($arString)-1 $a[$i]=$arString[$i] Next _ArrayDisplay($a) MsgBox(0,"Example","$a[4]="&$arString[4]) Edited November 8, 2010 by taietel Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
sbt Posted November 8, 2010 Author Posted November 8, 2010 Wow thanks a lot. I was searching for 2 days to find the solution for this. Great. THANKS again.
taietel Posted November 8, 2010 Posted November 8, 2010 sbt, I was searching for 2 days to find the solution for this where? Sometimes those things that are obvious are the hardest to find. Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
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