Jump to content
Sign in to follow this  
atnextc

Issues with WinExists and ControlClick on CRM Silent Install

Recommended Posts

atnextc

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)

Share this post


Link to post
Share on other sites
kaotkbliss

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!

Share this post


Link to post
Share on other sites
atnextc

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)

Share this post


Link to post
Share on other sites
kaotkbliss

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!

Share this post


Link to post
Share on other sites
atnextc

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

Share this post


Link to post
Share on other sites
kaotkbliss

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!

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  

  • Similar Content

    • tentacole
      By tentacole
      Afternoon!
      This is my first post, so I apologize if this is in the wrong place. 
      I've created a while loop to click in a certain area of an application, and have the y axis change at the end of each loop. My loop continues to click at x:27, x:10, even though the $y is adding 15 at the end of each loop. I did a Send($x) and Send($y) into a Notepad to see if the $y had changed after each loop, and the 15 was being added to $y each loop. (If this makes sense)
       
      I'm unsure where I'm going wrong, and would be extremely grateful if someone can point me in the correct direction to fix this. 
      Local $rDirectory = "H:\oDemandProject\fList.txt" Local $rLine = _FileCountLines($rDirectory) Local $x = 27 Local $y = 10 While $rline > 0 WinActivate("OnDemand", "-> 1") WinWaitActive("OnDemand", "-> 1") ControlClick("OnDemand", "", "[CLASS:AfxFrameOrView120u; INSTANCE:1]", "left", 4, $x, $y) $y += 15 $rLine -= 1 WEnd  
    • Yirrlaar
      By Yirrlaar
      #Include <WinAPI.au3> local $ClassName = _WinAPI_GetClassName(WinGetHandle(WinGetTitle("[ACTIVE]"))) ControlClick(WinGetTitle("[ACTIVE]"), "", "[CLASS:"&$ClassName&"; INSTANCE:1]", "primary") When I am running this script it just gives me a ConsoleWrite output of "0x001D04A8"
      When using "AutoIT v3 Window Info" all the info I need for the ControlClick is there and displayed perfectly as if I typed it in normally.
      Upon click the button it should be clicking it, I see the following inn the console window:
      If I replace the $ClassName with the actual ClassName of "WindowsForms10.BUTTON.app.0.3296db7_r14_ad1" it works just fine, any ideas???
    • Tats
      By Tats
      Hi everyone,
      I have a problem with ControlClick function. It doesn't work no matter how I tried all the possible combination of the parameters.
      Below is the scripts of possible parameter combination:
      ;ControlClick("title","text","controlID ","button","clicks","x","y") ;title= Title, Class, Handle ;controlID= Class, ClassNN, Instance ;Title here is empty when I check it with AutoIt Info ControlClick("", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Class of the window ControlClick("[ScreenKeyboard::SKFrame]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Handle of the window ControlClick("[0x000907A0]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[INSTANCE:18]", "left", "1", "230","890") Am I coding it correctly?
      Thanks
    • MaximusCZ
      By MaximusCZ
      Hello, and apologies if this have been discussed before, but I googled and couldnt find anything relevant.
      I have a problem where I try to send a control clink into to a window. 
      Part of window I try to send clicks to looks like this . The black border is showing when I mouse over it Au3Info, I get following information:

      I am testing its interaction with code

      The result I get is that it makes control clicks trough first line, opens and closes menus, as expected.
      When It gets to second line, it does not click a single icon. I can tell that coords are correct as the dropdown menus (No view active) gets focused(altough not rolled out). Same behaviour happens if roughly 40<y<60, so I know I am hitting good height. You can look at how it behaves here: output.webm 
      Dropdown 1 focuses at around 8 sec mark, and 13 sec mark it changes to second dropdown, defocusing first one, seemingly not registering any clinks inbetween.
       
      Have you ever encountered similar behaviour? I need to click the Key button, first on second line, with controlclick (or any other way not hijacking the mouse). I cant trigger that button by keyboard and There is no other control having control over it.
      Help
       
    • Skysnake
      By Skysnake
      I need to automate a specific GUI from a legacy system written in C.
      The spy tool gives me this

      I use this code
      Local $swintit = WinGetTitle("[active]") ConsoleWrite("active Window " & $swintit & @CRLF) If $swintit = "FILES NOTES" Then ; If $swintit = "FILES NOTES" Then ; got Window, now atomate ConsoleWrite("got Window " & @CRLF) ; now focus, then click :) ;EditPaste ;ControlCommand("FILES NOTES", "", 404, $acno) ; paste acno GUICtrlSetState(404, $GUI_Focus) ControlCommand("FILES NOTES", "", 404, $acno) ; paste acno GUICtrlSetState(401, $GUI_Focus) ControlClick("FILES NOTES", "", 401, $acno) ; click okay EndIf ; If $swintit = "FILES NOTES" Then The idea is to paste the acno value into the edit box, then click an Okay button.
      I get a console write that the active Window is as expected, but my loop completes without ever writing anything into the GUI.
      I also tried the control ID as text "404" - same result
      What am I missing?
      Skysnake
       
×