T0m4s Posted September 27, 2012 Share Posted September 27, 2012 Hi Forum, i want to automate a setup. Normally it should work without problems but i struggled at the point when i want to start the setup. When i use Run("setup.exe"); it will not work. I have to use Run(@ComSpec & " /c " & "setup.exe") instead. Then the Nighmare begins. I want to use ControlClick() to simulate the clicks on the Buttons that will continue the Setup Process. I used Autoit Window Info Tool to examine the correct controll IDs, but with no success, no clicks are processed. Then i tried to send Keys. I checked the Keys i have to send and try to send them. WinWaitActive(" Installation", "") Send("!i") or Send("{ENTER}") But it seems that no keystrokes are send to the setup programm. Then i read about the AU3Recorder integrated in Scite editor. But this recorder does not record correct. Output from Au3recorder: #region ---Au3Recorder generated code Start (v3.3.7.0) --- #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- #endregion --- Au3Recorder generated code End --- What happens here? Please help My System: Win 7 32 Bit Pro SP1 Autoit 3.3.8.1 Link to comment Share on other sites More sharing options...
water Posted September 27, 2012 Share Posted September 27, 2012 Which program do you try to setup? Are you sure there is no silent installation switch available? Can you describe your problem in detail? "What happens here?" is a bit vague. Your code misses error checking. After each function call you should check for success or error. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
T0m4s Posted September 27, 2012 Author Share Posted September 27, 2012 (edited) It is a setup of a USB driver for german health care terminal, i am sure you will not know it. "What happens here" is the question regarding the output form AU3recorder. Why do the recorder not record? also this piece of code : #region ---Au3Recorder generated code Start (v3.3.7.0) --- #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- #endregion --- Au3Recorder generated code End --- is the output from AU3recorder. If you miss error checking here, then i can say, that i miss the recorded things also. If you miss error checking in the other code snipets, then pls have in mind that they are only examples to demonstrate what is not working for me. I think the problem i have is more general than only missing error checking Are there any issues with WIN 7 and Autoit or should it wourk without any problems? Edited September 27, 2012 by T0m4s Link to comment Share on other sites More sharing options...
water Posted September 27, 2012 Share Posted September 27, 2012 Which version of AutoIt do you run? Is it 3.3.7.0 as the recorded code shows? 3.3.8.1 is the latest production version. Au3recorder can only handle Windows controls. If your setup is a java application or uses some non standard windows/controls then this might be the cause of your problems. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
T0m4s Posted September 27, 2012 Author Share Posted September 27, 2012 (edited) Which version of AutoIt do you run? Is it 3.3.7.0 as the recorded code shows? 3.3.8.1 is the latest production version. Please read the first post. It includes all informations. Why AU3recorder show version 3.3.7.0 ? Maybe its the version of AU3recorder. Au3recorder can only handle Windows controls. If your setup is a java application or uses some non standard windows/controls then this might be the cause of your problems. Please read the first post. If the setup would be a java application then it would not be an exe file, is this correct? And as i wrote i use to start the setup : Run(@ComSpec & " /c " & "setup.exe") I also wrote in the first Post, that all the Controls are recognized by "Autoit Window Info Tool" so i assume that this is no Java programm. I have only 2 Posts left now. Please read the first post! Edited September 27, 2012 by T0m4s Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 27, 2012 Moderators Share Posted September 27, 2012 (edited) T0m4s,You should now be able to post normally as I have lifted the "New Member" restriction from your account. Please let me know if you have any problems. M23 Edited September 27, 2012 by Melba23 Typo Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
water Posted September 27, 2012 Share Posted September 27, 2012 OK, I got it: Read the first post! Create a short reproducer script that only starts the exe and that tries to click on the first control. This will be the source we start to play with. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
T0m4s Posted September 27, 2012 Author Share Posted September 27, 2012 (edited) Thanks!This is my script:#cs --------------------------------------------------------- Automatic installation for CARD STAR /medic2 und CARD STAR /memo3 USB driver #ce ---------------------------------------------------------- ; start programm Local $result = Run(@ComSpec & " /c " & "setup_USB251.exe") Local $kTitle = " Installation" if $result > 0 Then WinWaitActive(" Installation", "") $aPos = ControlGetPos($kTitle, "", "[ID:1]") ; Do some errorchecking If IsArray($aPos) Then ; Now choose one of these and comment out the other ConsoleWrite($aPos[0] & " - " & $aPos[1] & @CRLF) $res = ControlClick($kTitle, "", "[ID:1]") ConsoleWrite("Result of ControlClick: " & $res &@CRLF) Sleep(5000) Else ; And then the matching one of these ConsoleWrite("Error" & @CRLF) EndIf Else MsgBox(0, "Error", "could not Run setup. error = " & @error ) EndIfOutput from SciTe console:>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:tempautoItScriptstest1.au3" /UserParams +>10:49:33 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0407 Keyboard:00000407 OS:WIN_7/Service Pack 1 CPU:X64 OS:X86) >Running AU3Check (1.54.22.0) from:C:Program FilesAutoIt3 +>10:49:33 AU3Check ended.rc:0 >Running:(3.3.8.1):C:Program FilesAutoIt3autoit3.exe "C:tempautoItScriptstest1.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop 324 - 327 Result of ControlClick: 1 +>10:49:42 AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 9.818AutoIt Window Info Tool output:Uploaded with ImageShack.us Edited September 27, 2012 by T0m4s Link to comment Share on other sites More sharing options...
water Posted September 27, 2012 Share Posted September 27, 2012 Doesn't look bad. The expected action is started when the script clicks the button? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
T0m4s Posted September 27, 2012 Author Share Posted September 27, 2012 Doesn't look bad.The expected action is started when the script clicks the button?Nope, and exactly this is the problem. No actions are startet if i use ControlClick() or Send().It seems that i cant send to this window, but the return of the functions is always ok. Link to comment Share on other sites More sharing options...
water Posted September 27, 2012 Share Posted September 27, 2012 I think the problem is related to the way you pass the ControlID. Try: $res = ControlClick($kTitle, "", 1) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
T0m4s Posted September 27, 2012 Author Share Posted September 27, 2012 I think the problem is related to the way you pass the ControlID. Try: $res = ControlClick($kTitle, "", 1) Doesnt work, i tried several different methods, but no one work. Link to comment Share on other sites More sharing options...
water Posted September 27, 2012 Share Posted September 27, 2012 Oops. I just noticed that "[iD:1]" and "1" is the same. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted September 27, 2012 Share Posted September 27, 2012 Could you please insert a "Sleep(3000)" before the Controlclick? Maybe the Control isn't active as soon as the Window is displayed? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
T0m4s Posted September 27, 2012 Author Share Posted September 27, 2012 (edited) does not help. $res = ControlClick($kTitle, "", "[ID:1]") ConsoleWrite("Result of ControlClick: " & $res &@CRLF) Sleep(5000) $res = Send("!w") ConsoleWrite("Result of Send: " & $res &@CRLF) will result in 324 - 327 Result of ControlClick: 1 Result of Send: 1 So it seems to be that everything is ok, but in the setup program nothing happens. If nothings helps, i will try it on Windows XP Edited September 27, 2012 by T0m4s Link to comment Share on other sites More sharing options...
JohnOne Posted September 27, 2012 Share Posted September 27, 2012 Or $res = ControlClick($kTitle, "", "[CLASS:Button; INSTANCE:2]") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
water Posted September 27, 2012 Share Posted September 27, 2012 How many windows with title "Installation" are open when you run the script? Can you please run this code when the installation script is active? #include <Array.au3> Global $aWindows = WinList() _ArrayDisplay($aWindows) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted September 27, 2012 Share Posted September 27, 2012 I noticed that the window title set in Local $kTitle = " Installation"starts with a space. Are you sure the window title starts with a space? Can you remove the space and try again? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted September 27, 2012 Share Posted September 27, 2012 Another idea: To make sure AutoIt grabs the correct window change the ControlClick statement to: $res = [url="http://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm"]ControlClick[/url]($kTitle, "CSm2 USB driver", "[ID:1]") My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
T0m4s Posted September 27, 2012 Author Share Posted September 27, 2012 How many windows with title "Installation" are open when you run the script? Can you please run this code when the installation script is active? #include <Array.au3> Global $aWindows = WinList() _ArrayDisplay($aWindows) It shows only 1 window running with taht name. I noticed that the window title set in Local $kTitle = " Installation"starts with a space. Are you sure the window title starts with a space? Can you remove the space and try again? I was wondering also, but the space is correct. [47]0x0005063C [48] Installation0x000F076E [49]C:Windowssystem32cmd.exe0x001806D8 [50]AutoIt v30x001A077E [51]AutoIt v30x00280768 [52]AutoIt v30x00130746 Another idea: To make sure AutoIt grabs the correct window change the ControlClick statement to: $res = [url="http://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm"]ControlClick[/url]($kTitle, "CSm2 USB driver", "[ID:1]") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now