Jump to content

cmd.exe question


Recommended Posts

hello, i am building a program wich will use the cmd.exe.

i have everything working except one little problem.

my script works fine as long as the cmd.exe window is active.

i dont want the cmd.exe window to be active, i want it hidden.

so here comes my problem, how do i send my "commands" to the hidden window?

Run("cmd.exe","whatever directory needed",@SW_SHOW)
sleep(3000)
Send("FTP{ENTER}")
sleep(3000)
Send("open ftp-ip{ENTER}")
sleep(3000)
Send("username{ENTER}")
sleep(3000)
Send("password{ENTER}")
sleep(3000)
Send("mput{ENTER}")
sleep(3000)
Send("blah.txt{ENTER}")
sleep(3000)
Send("y{ENTER}")
sleep(3000)
Send("bye{ENTER}")
sleep(3000)
Send("EXIT{ENTER}")

Thats a generalized code, no personal info in it.

That code works fine like i said, but how do i use the Send() when the cmd.exe is hidden?

Thanks alot for your help.

[font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want.
Link to comment
Share on other sites

the best can be to create a .cmd file you run.

In Fact cmd is opening a windows that is different from regular windows so ControlSend which work on non active window cannot work in this case.

Link to comment
Share on other sites

hello, i am building a program wich will use the cmd.exe.

Send("FTP{ENTER}")
why do you use cmd.exe if you actually want to run ftp.exe?

also i'd advice you to use WinWaitActive after using Run to make sure the window is active.

Edited by torsti
Link to comment
Share on other sites

Thanks alot everyone, i think you have helped me alot.

I really appreciate your support.

[font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want.
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...