Sign in to follow this  
Followers 0
susu6514

How to display a 2-digits variable in Dos command

3 posts in this topic

Hi,

I'm new to autoit and I have a problem to print a "2-digit" variable in DOS command prompt.

Here is my code.

Dim $i

$i=10

While $i <=11

Run("cmd.exe")

WinWaitActive("C:\WINDOWS\system32\cmd.exe")

Send("{" & $i & "}")

sleep (2000)

send("{ENTER}")

send("type digonly.txt|sed -e 1,3d -e5,8d > 9_")

send("{"&$i&"}")

sleep (1000)

send(".txt")

send("{ENTER}")

WinClose("C:\WINDOWS\system32\cmd.exe")

$i=$i+1

WEnd

When I run the above program, the variable,i, should start from "10" but as I send i to DOS prompt by using "Send("{" & $i & "}")" the result output in DOS prompt is "1".

I am so confused that why it cannot display "10" in command prompt.

Please some one help me. Thank you so much!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I don't know if this is why it doesn't work as expected, but you have the syntax wrong for the WinWaitActive command.

Function WinWaitActive

Also, the WinClose syntax is wrong too.<br><br>Edit: For the actual problem though, try this. Change the value here, SendKeyDelay (Option), it defaults to 5, try 10 or higher..<br>

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

I changed Send("{" & $i & "}") to Send(&i) and problem solved.

As to other incorrect usage, I will look into it.

Thanks for the reply.

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