Jump to content

how do i change a var with a user input


Recommended Posts

Hello,

I got the following problem: 

I wrote the follwing script:

Func a()
       Local $sAnswer = InputBox("Question", "Amount ", "", "", _
             - 1, -1, 0, 0)
   Send($var)
   Sleep(2)
   WEnd
EndFunc

 

In a database are vars deposited with the following templates: $var1, $var2 etc.

If the user enters a number into the box, the script should send the text from the var to a chat (eg. he enters a 5, the script should send $var5).

After a lot of googling im not able to get the Send($var) the correct way.

Link to comment
Share on other sites

Well, not much information to go on here, so here's something to chew on...

Assuming (a lot here) that you already have variables defined and you want the user to be able to select one based on a number.  Well, you can append the number to a variable name to create a reference to and evaluate an expression/variable by using the Execute function.  Alternatively, you could create an array of "templates" and call them by referencing the index of the array using a number.

Question:

Chat....is this for a chat bot?

Link to comment
Share on other sites

thanks for the quick answer. 

first: no, this is not for a chat bot. It should be more like a tool for shortcuts.

second: I am not rly experienced with AutoIt and trying to get as far as possible with my knowledge. I got the script that far, that it sends the keys to the notepad without the InputBox, but I have no clue how to express the "Send(*****)" execute properly. 
I tried it with the mentioned execute funtion ($text= Execute("$var+$sAnswer") that the command should look like "Send($var5) as $text=$var5 but it did not work.

And I think that I will get the same problem with the index of the array u mentioned

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...