Sign in to follow this  
Followers 0
Caterpillar

Set focus

6 posts in this topic

Hi,

I'm a newby with AutoIT3. My script works fine as long as the windows is active. If another window becomes on top my script fails. How can I fix this?

Share this post


Link to post
Share on other sites

Maybe use ControlSend()?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

I had same problem in this topic.

I hope someone reply us if resolved this.

thanks

Share this post


Link to post
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:

Share this post


Link to post
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:

Share this post


Link to post
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
Sign in to follow this  
Followers 0