Sign in to follow this  
Followers 0
iggy

Input Problems

7 posts in this topic

Hi everyone :ph34r:

Im learning using autoit and i have this kind of problem.

I need to get a variable from a string copied.

I mean i let autoit copy a word in a window and then i want to paste in a InputBox but when the InputBox appears autoit stop working waiting for a human input.

Is a way to do this or a different way to copy a word and use it like a varible in an autoit script?

Share this post


Link to post
Share on other sites



AutoIt will stop execution whenever a message box or input box is displayed. However, you may specify a timeout like in my example below:

$string = "Sample text"
$text = InputBox("Window Title", "Enter some text below.", $string, "", -1, -1, -1, -1, 5)
MsgBox(4096, "Message", "You entered: " & Chr(34) & $text & Chr(34))

(The -1 values tell the command to use the default options)

Hope this helps!

Share this post


Link to post
Share on other sites

.. i let autoit copy a word in a window and then i want to paste in a InputBox but when the InputBox appears autoit stop working waiting for a human input...

<{POST_SNAPBACK}>

Sounds like you're looking for the default parameter to the InputBox function :ph34r:

;get string from window
    $sValue = "pretend this is the string"

;Prompt the user
    $nRC = InputBox(@ScriptName, "Is this the value?", $sValue)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks for explanation.

AutoIt will stop execution whenever a message box or input box is displayed

That means im using the wrong way to to catch up my scope.

Does exist a command that allow Autoit to get an information (like copy a string or a word that can change in the time) and use it in the script like a $var?

Or a command that read a word in a txt file for example so it is possible to convert it in a $var .

Edited by iggy

Share this post


Link to post
Share on other sites

Does exist a command that allow Autoit to get an information (like copy a string or a word that can change in the time) and use it in the script like a $var?

<{POST_SNAPBACK}>

Sure, but it all depends on where you want to copy it from. From another variable, user input, a file, a window title, etc etc. There are many many commands to get various pieces of information.

Or a command that read a word in a txt file for example so it is possible to convert it in a $var .

<{POST_SNAPBACK}>

If you want to read a text file, you'll want to look at FileReadLine, FileRead, and FileOpen. You can read lines (or the whole file) into a variable, and parse it as needed to search for any information contained inside them.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Thanks a lot to all for the explanations and suggestions now my script is working fine :ph34r:

Share this post


Link to post
Share on other sites

how do you take info from user input and insert it at a later point of the script?

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