Sign in to follow this  
Followers 0
sbt

Input Field

6 posts in this topic

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

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by sbt

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by taietel

Share this post


Link to post
Share on other sites

Wow thanks a lot. I was searching for 2 days to find the solution for this. Great. THANKS again.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0