Jump to content

Unexpected windows


Recommended Posts

Hi All,

I'm having some trouble dealing with an automated install set up using AutoIT. I am doing a SQL 2014 Express and will be installing in many envrions where no doubt there will other SQL instances of 2014. I can just about do this where there is no existing SQL 2014 pre installed but when I has been, it changes the order the windows appear (additional appears asking for different options where usually is licence agreement). I have looked for other examples of if winexists, copied them and tweaked to suit my own needs but it's getting a tad frustrating as it just seems to stop dead every time.  I'am thinking if, else, endif should be enough.  I'm new so sorry for silly question and if I search winexists I dont get many results. Perhaps I am barking up the wrong tree? Many thanks for any assistance :sweating:

 

;***Dealing With Installation Type If Previous Install Exists.
WinWait("SQL Server 2014 Setup", "Installation Type", 3)
; Test if the window exists and actions.
If WinExists("SQL Server 2014 Setup", "Installation Type") Then
WinActivate("SQL Server 2014 Setup", "Installation Type")
ControlClick("SQL Server 2014 Setup" ,'' ,"WindowsForms10.BUTTON.app.0.3ce0bb83")
Else
;***Licence Terms Check & Next
WinWait ("SQL Server 2014 Setup", "MICROSOFT SQL SERVER 2014 EXPRESS")
WinActivate("SQL Server 2014 Setup", "MICROSOFT SQL SERVER 2014 EXPRESS")
MouseClick("primary", 296, 386, 1, 0)
Sleep(300)
SEND("{TAB}")
SEND("{TAB}")
SEND("{TAB}")
SEND("{ENTER}")
EndIf

 

Link to comment
Share on other sites

I've been meaning to look into Autoit for some time and wanted this to be a starting process. Also for the company I work for we offer customer self installs to some clients and it would be great for them to see all the steps rather than not. Hope that makes sense. 

Link to comment
Share on other sites

The problem is that some of these newer Microsoft installers are custom installers and automating that may prove to be a challenge using standard auto IT. I also don't understand why you would want a customer to see an SQL install. 

In any case, there is an auto IT information tool that you can use to click on the controls you wish to automate like the buttons. It then captures the data for that control and you can usually use built-in auto IT functions to talk to those controls. 

If you could capture all the controls from the SQL installers that you care about and print them here, we might be able to help you

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Thanks for the replies. Other reasons are training internally, we have third party IT staff setting stuff up for us and could reduce the amount of hand holding. I think it could be very useful. I am aware of the tool that captures all the controls and I am okay using that and can run this project fine on a 'blank' system - no previous SQL instance. However when I run it on a system where there is a already a SQL 2014 instance the sequence of windows that appears changes (throws up add existing features windows, I need my code to do this for window Y or if it doesn't appear do X). In the code snippet above I have the 2 controls & windows I am interested in. I dont know why it doesn't work since I'm using the format of the F1 help guide. F7 yields no syntax errors. Just not sure what is up with it. I would also like to see this code working as I have other ideas for other installers where it may present different windows depending on the environs its run on. Many thanks. It's literally just this one block of code I need assistance with if possible. In blue are the 2 windows I'am interested in using if, else, endif statement with. Cheers. 

 

;***Dealing With Installation Type If Previous Install Exists.
WinWait("SQL Server 2014 Setup", "Installation Type", 3)
; Test if the window exists and actions.
If WinExists("SQL Server 2014 Setup", "Installation Type") Then
WinActivate("SQL Server 2014 Setup", "Installation Type")
ControlClick("SQL Server 2014 Setup" ,'' ,"WindowsForms10.BUTTON.app.0.3ce0bb83")
Else
;***Licence Terms Check & Next
WinWait ("SQL Server 2014 Setup", "MICROSOFT SQL SERVER 2014 EXPRESS")
WinActivate("SQL Server 2014 Setup", "MICROSOFT SQL SERVER 2014 EXPRESS")
MouseClick("primary", 296, 386, 1, 0)
Sleep(300)
SEND("{TAB}")
SEND("{TAB}")
SEND("{TAB}")
SEND("{ENTER}")
EndIf
Link to comment
Share on other sites

If I understand the problem at hand you have several known windows appearing at an unknow sequence in time?

You should look for a state machine solution. Take a look at this video: state-your-intentions-more-clearly-with-state-machines

EDIT:

Use if..elseif..elseif to identify available windows.

Edited by Uten
Add information
Link to comment
Share on other sites

On another note, you can tell if SQL Server 2014 is already installed on the system by checking the registry. Maybe make a decision what installer to call based on if SQL 2014 is already present. Still, manipulating WinForms or even WPF apps with ControlClick doesn't work. In that case, other means become necessary.

Also, please post the WHOLE script so others can also try to assist you in the logic.. What you have there will not be reliable from what I can see.

You may be better off using a Send command instead of that ControlClick in this case.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

You can also install from a config file which may serve your needs better

https://msdn.microsoft.com/library/dd239405(v=sql.120).aspx

; Microsoft SQL Server Configuration file  
[OPTIONS]  
; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE.   
; This is a required parameter.   
ACTION="Install"  
; Specifies features to install, uninstall, or upgrade.   
; The list of top-level features include SQL, AS, RS, IS, and Tools.   
; The SQL feature will install the database engine, replication, and full-text.   
; The Tools feature will install Management Tools, Books online,   
; SQL Server Data Tools, and other shared components.   
FEATURES=SQL,Tools

And, there is not one good reason ANYONE needs to see this, technician or not, if you can install full silent then that is your BEST option. period.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

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