Jump to content

Issues with WinExists and ControlClick on CRM Silent Install


atnextc
 Share

Recommended Posts

I have been trying to write a script to silently install CRM Outlook client for about the past 6 days. No matter what I have tried this doesn't seem to be doing anything.

Code is below. Any help is appreciated.

Opt("TrayIconDebug",1)
ShellExecute("R:\IT\SoftLib\CRM2011\CRM2011-Client-ENU-i386\SetupClient.exe")
winwait("Microsoft Dynamics CRM 2011 for Outlook Setup")
WinActivate("Microsoft Dynamics CRM 2011 for Outlook Setup")
WinExists("Microsoft Dynamics CRM 2011 for Outlook Setup","I &accept the license agreement")
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","I &accept the license agreement",1007)
WinExists("Microsoft Dynamics CRM 2011 for Outlook Setup","&Next")
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","&Next",1008)

WinExists("Microsoft Dynamics CRM 2011 for Outlook Setup","Install Now")
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","&Install Now",1019)
WinExists("Microsoft Dynamics CRM 2011 for Outlook Setup","The installation completed successfully.")
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","&Close",1038)
Link to comment
Share on other sites

when you hover your mouse over your autoit icon after running this, what line is it showing?

I also see a couple errors using winexists. That function as you use it will either return true or false, then move on to the next line.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

It just sits at the first screen without ever selecting any boxes.

I have also tried this as well..

winwait("Microsoft Dynamics CRM 2011 for Outlook Setup")
WinActivate("Microsoft Dynamics CRM 2011 for Outlook Setup")
;sleep (10000)
If WinExists("Microsoft Dynamics CRM 2011 for Outlook Setup","I &accept the license agreement")Then
;controlgettext("Microsoft Dynamics CRM 2011 for Outlook Setup","",1007)
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","",1007)
;sleep (3000)
EndIf
If WinExists("Microsoft Dynamics CRM 2011 for Outlook Setup","&Next")Then
;controlgettext("Microsoft Dynamics CRM 2011 for Outlook Setup","Next",1008)
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","", 1008)
;sleep (3000)
EndIf
If WinExists("Microsoft Dynamics CRM 2011 for Outlook Setup","Install Now")Then
;controlgettext("Microsoft Dynamics CRM 2011 for Outlook Setup","Install Now",1019)
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","",1019)
EndIf
;Dim $done
;While Not $done
;Select
;Case WinExists("Microsoft Dynamics CRM 2011 for Outlook Setup","The installation completed successfully.")
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","",1038)
;EndIf
;$done = 1
;Case Else
;   Sleep(300)
;EndSelect
;WEnd
  
;controlgettext("Microsoft Dynamics CRM 2011 for Outlook Setup","",1038)
Link to comment
Share on other sites

in case you were not aware, anything on a line after a ; gets ignored by autoit.

you are a little closer, however you have 'If WinExists' so when autoit hits that line, if that window does not exist yet, then it will skip to the line after 'EndIf'

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

Here is the finised code for CRM for Outlook Client Update 6.

This is working great. However, the update to Rollup10 apparently uses a weird form....IE "the next button is Windows.app.Button..etc which in searching the forum those can't really be controlled in Auto it so I just used send keys and it works however it will affect the user if they are using the machine.

;This will execute the CRM Outlook Client with Update 6 Installed.
MsgBox(0,"CRM Update Install", "Please Close Outlook so CRM can be updated.")
ShellExecute("R:ITSoftLibCRM2011CRM2011-Client-ENU-i386.exe")
;This will extract the contents of the program to the users desktop in a folder called CRM.
Winwait("Browse For Folder")
WinActivate("Browse For Folder")
Send("{UP}")
SLeep(100)
Send("{UP}")
SLeep(100)
Send("{TAB}")
SLeep(100)
Send("{ENTER}")
Sleep(100)
Send("CRM")
SLeep(100)
Send("{ENTER}")
SLeep(100)
Send("{TAB}")
SLeep(100)
Send("{ENTER}")

;This will step through the steps in the install.
winwait("Microsoft Dynamics CRM 2011 for Outlook Setup")
WinActivate("Microsoft Dynamics CRM 2011 for Outlook Setup")
WinWait("Microsoft Dynamics CRM 2011 for Outlook Setup","I &accept the license agreement")
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","I &accept the license agreement",1007)
WinWait("Microsoft Dynamics CRM 2011 for Outlook Setup","&Next")
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","&Next",1008)

WinWait("Microsoft Dynamics CRM 2011 for Outlook Setup","Install Now")
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","&Install Now",1019)
WinWait("Microsoft Dynamics CRM 2011 for Outlook Setup","The installation completed successfully.")
ControlClick("Microsoft Dynamics CRM 2011 for Outlook Setup","&Close",1038)
MsgBox(0,"CRM Update Install", "The CRM Update is complete. You can now reopen Outlook.")
Link to comment
Share on other sites

Have you tried using the Window Info Tool that came with autoit on it to get the button's Class and Instance? You can use those to controlClick on it.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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

×
×
  • Create New...