Jump to content

How to display a 2-digits variable in Dos command


susu6514
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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.

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