Jump to content

Set focus


Recommended Posts

Here is the simple script:

============

RUN("C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\ssmsee.exe c:\sqlbackup\CAM2000_backup.sql")

WinWaitActive("Connect to Database Engine", "")

sleep(500)

Send("{ENTER}")

sleep(500)

Send("!x")

sleep(15000)

Winclose("Microsoft SQL Server Management Studio Express")

============

It fails sometimes at WinWaitActive. How ControlSend() help me with this then?

Link to comment
Share on other sites

It fails sometimes at WinWaitActive. How ControlSend() help me with this then?

You could try this.

Run('"' & @ProgramFilesDir & '\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\ssmsee.exe" c:\sqlbackup\CAM2000_backup.sql')
WinWait("Connect to Database Engine")
sleep(500)
ControlSend("Connect to Database Engine", "", "", "{ENTER}")
sleep(500)
ControlSend("Connect to Database Engine", "", "", "!x")
sleep(15000)
Winclose("Microsoft SQL Server Management Studio Express")

Since I see a alt-x being used, meaning that it is a gui application, then you can use ControlClick() to press buttons and checkboxes.

:shocked:

Link to comment
Share on other sites

It's much help for me~

thank you for your help :(

You could try this.

Run('"' & @ProgramFilesDir & '\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\ssmsee.exe" c:\sqlbackup\CAM2000_backup.sql')
WinWait("Connect to Database Engine")
sleep(500)
ControlSend("Connect to Database Engine", "", "", "{ENTER}")
sleep(500)
ControlSend("Connect to Database Engine", "", "", "!x")
sleep(15000)
Winclose("Microsoft SQL Server Management Studio Express")

Since I see a alt-x being used, meaning that it is a gui application, then you can use ControlClick() to press buttons and checkboxes.

:shocked:

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