Jump to content

Input Field


sbt
 Share

Recommended Posts

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

Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...