Soundarya Posted June 28, 2023 Posted June 28, 2023 Using Autoit I have achieved automation to Open the Passport Mainframe application. I want to click on "Run Macro" button in the application for which I have a shortcut Alt+Shift+R, So using AutoIT I have used control send and sent the key. It worked fine in one machine and not working in another machine. Below is the code. Can any one help me understand why it is not working in another machine ? Please note that when I manually do Alt+Shift+R the action is performed as expected. Also I tried to record the steps using au3Recorder and it is not recording the Mainframe screen in machine where this automation I am referring is not working. Func PassportInputs() RunWait (@ComSpec & ' /c cscript.exe "' & @ScriptDir & '\initPassport.vbs" ALL /Q /NoCancel') Sleep(20000) Local $Title = WinGetTitle("[ACTIVE]") WinGetHandle($Title) WinSetState($Title,"",@SW_MAXIMIZE) WinActivate($Title) ;;Need to set up shortcut in Mainframe Keyboard to run macro using Alt+Shift+R ControlSend($Title,"","","{ALTDOWN}{SHIFTDOWN}r{SHIFTUP}{ALTUP}") EndFunc
water Posted June 28, 2023 Posted June 28, 2023 Check the returnvalue of the Win* and Control* functions to make sure everything works as expected. 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
Soundarya Posted June 28, 2023 Author Posted June 28, 2023 @water Thanks for replying. The Win* functions working appropriately I see the WinSetState function have maximized the application. The problem is I could not send keys to the application. Again it is only in few machines and in other machines same code is working and sending keys that I sent using ControlSend in my above code.
Gianni Posted June 28, 2023 Posted June 28, 2023 maybe using SendKeepActive() ? Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
water Posted June 28, 2023 Posted June 28, 2023 Another idea: Every Host emulator provides an API. Have a look at the provided manuals on how to access this API. 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
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