kmetski Posted May 19, 2009 Share Posted May 19, 2009 (edited) 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 May 19, 2009 by kmetski Link to comment Share on other sites More sharing options...
Authenticity Posted May 19, 2009 Share Posted May 19, 2009 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 More sharing options...
kmetski Posted May 19, 2009 Author Share Posted May 19, 2009 the real problem is that i cant send the commands to the windows cmd Link to comment Share on other sites More sharing options...
Authenticity Posted May 19, 2009 Share Posted May 19, 2009 What about ControlSetText or specifying a control in the third paramter? Link to comment Share on other sites More sharing options...
kmetski Posted May 20, 2009 Author Share Posted May 20, 2009 I will try that but WINDOWS COMMAND LINE does not have a control ID Link to comment Share on other sites More sharing options...
TurionAltec Posted May 20, 2009 Share Posted May 20, 2009 Does the app respond to StdIn? Maybe that might be better than trying to use send() Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now