Jump to content

Using variables in an input box - how?


Recommended Posts

Hello all,

I am a new AutoIt user and I wrote a script to auto-upload files to a website.

The script works perfectly, except for one thing:

if $filenumber >= 1 then $name[$i] = InputBox("File Upload", "Enter Name for file - root folder is 'K:\'", "test.avi", "")

I can't figure out how to put a $i in the input box...Everything I tried I get this:

Enter Name for file $i - root folder is 'K:\'

What am I doing wrong?

Thanks,

Agmonyy

Link to comment
Share on other sites

Try:

if $filenumber >= 1 then $name[$i] = InputBox("File Upload", "Enter Name for file " & $i & " root folder is 'K:\'", "test.avi", "")

Everything inside the " (or the ') is seens as pure text. So you need to close them and concatenate ( & ) the value of the Variant you need.

E.g.

$eg = ' the end'
MsgBox(0,'','And so this was' & $eg)

Will show a msgbox with 'And so this was the end'.

Instead:

$eg = ' the end'
MsgBox(0,'','And so this was $eg')

Will show 'And so this was $eg' that it may be not what you want.

Link to comment
Share on other sites

Try:

if $filenumber >= 1 then $name[$i] = InputBox("File Upload", "Enter Name for file " & $i & " root folder is 'K:\'", "test.avi", "")

Everything inside the " (or the ') is seens as pure text. So you need to close them and concatenate ( & ) the value of the Variant you need.

E.g.

$eg = ' the end'
MsgBox(0,'','And so this was' & $eg)

Will show a msgbox with 'And so this was the end'.

Instead:

$eg = ' the end'
MsgBox(0,'','And so this was $eg')

Will show 'And so this was $eg' that it may be not what you want.

<{POST_SNAPBACK}>

That solved my problem. Thanks! :)
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...