sankumar Posted August 31 Posted August 31 Hello all, I have developed a code to use WinActivate to login to an application for validation/testing. If I RDP to the machine, the code executes successfully. However, if I use an interactive console session, it does not work. I initially thought the root cause was related to the screen resolution, but even after settings the resolution to 1920x1080, the issue still persists. I would greatly appreciate your help. Thank you in advance! -SK
argumentum Posted September 1 Posted September 1 With a running script but failing for no good reason, you're gonna have to share more than "it works on RDP but not in front of the PC" 🤷♂️ Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting
sankumar Posted September 10 Author Posted September 10 Thank you for your response. Here are some additional details: The automation is compiled as an executable and launched through Windows Task scheduler. Its purpose is to open Microsoft Dynamics GP, log in and perform application validation. When an RDP session is active and the EXE is launched, it runs successfully. When it runs in the console environment, it reaches the window-activation portion of the code and does not proceed. Changing the screen resolution to 1920x1080 did not resolve the issue. This appears to be related to the Windows session or interactive desktop used by Task Scheduler rather than resolution. The task is configured to run only when the user is logged on and that is all configured properly at the OS level. I am providing the code snippet for review. ======================================================= FileWriteLine($sLog, "Waiting for the GP Window") Local $hGP = WinWait("Microsoft Dynamics GP", "", 180) if $hGP =0 Then $sStatus = "Failed" $sErrorMessage = "GP login window not found within 180 seconds." SendStatusMail($sStatus, $sErrorMessage) Exit EndIf FileWriteLine($sLog, "Attempting to activate GP Window") WinActivate($hGP) Sleep(2000) Local $hActive=WinGetHandle("[ACTIVE]") FileWriteLine($sLog, "Active Window handle after WinActivate") If Not WinWaitActive($hGP, "", 30) Then $sStatus = "Failed" $sErrorMessage = "GP login window found but could not be activated." SendStatusMail($sStatus, $sErrorMessage) Exit 1 EndIf =======================================================
Nine Posted September 10 Posted September 10 (edited) When you post code, please use the method shown in the link. The code you provide doesn't help a bit. We cannot run this. You need to post a runnable code that we can actually see the issue. But at first glance, your code is running on a different privilege level (I'm probably wrong on this). Edited September 10 by Nine argumentum 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ioa747 Posted September 11 Posted September 11 Take a look here. https://www.autoitscript.com/wiki/FAQ#Why_doesn't_my_script_work_on_a_locked_workstation? I know that I know nothing
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