Jump to content

Need help whit WINDOWS COMMAND LINE


Recommended Posts

AutoItSetOption("WinTitleMatchMode",3)
AutoItSetOption("WinDetectHiddenText", 1)
Opt("TrayIconHide", 0) 

Run("SQLCMD",@SW_HIDE)
$sql = "use test"
WinWait("SQLCMD")
ControlSend("SQLCMD","","",$sql,0)
ControlSend("SQLCMD","","","{enter}",0)
ControlSend("SQLCMD","","","go",0)
ControlSend("SQLCMD","","","{enter}",0)
Sleep(10000)
WinKill("SQLCMD")
Exit

I can`t make it work when using @SW_HIDE

Probably because the windows command line don`t have a controlID.

When the window of the windows command line is visible everything is fine, but when i hide it does not work.

Any ideas.

Edited by kmetski
Link to comment
Share on other sites

You need to wait for the window to exist, otherwise $win is nothing but 0.

Opt("WinTitleMatchMode",3)
Opt("WinDetectHiddenText", 1)
Opt("TrayIconHide", 0)

Run("SQLCMD", '', @SW_HIDE)

WinWait("SQLCMD")
$win = WinGetHandle("SQLCMD")
$sql = "use test"

ControlSend("SQLCMD", "", "", $sql)
ControlSend("SQLCMD", "", "", "{enter}")
ControlSend("SQLCMD", "", "", "go")
ControlSend("SQLCMD", "", "", "{enter}")
Sleep(10000)
WinKill($win)
Exit
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...