Jonovision77 Posted March 24, 2015 Posted March 24, 2015 Hi this is my first time asking for help, I usually find a solution online but this one has stumped me. I am working with a business retail software and I have noticed a very annoying feature with the software, it doesn't matter what window or tab I am on the hidden text is almost always the same because the more tabs I visit the number of hidden text items grow, which pretty much eliminates the usefulness of the text portion of winwaitactive("title", "text"). Is there a way that I can use only the visible text in identifying a window/tab? The reason I need this to work is because I have a while loop that is intended to only activate the hotkeys on the final page of the software. While 1 WinWaitActive("Retail Merchant","") ;no text here because the software in open While WinWaitActive("Retail Merchant","visible text") Call("_HotKeys") Sleep(200) WEnd Sleep(200) WEnd Or is there any other way of identifying a page with a unique value that doesn't change upon reloading the system or software? Thank you
Realm Posted March 24, 2015 Posted March 24, 2015 (edited) WinGetHandle() will return the internal handle of a window. Edited March 24, 2015 by Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.
JohnOne Posted March 24, 2015 Posted March 24, 2015 (edited) Handle will change. What makes you think you're checking hidden text of the window? Edited March 24, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Jonovision77 Posted March 24, 2015 Author Posted March 24, 2015 Because the hot keys are active the moment the receipt page is visited, which has a hidden text value of TenderPage but it is not listed under visible text until the final receipt page is visited. This is the text I used on the second while command and the loop activates early.
Solution water Posted March 24, 2015 Solution Posted March 24, 2015 Is there a way that I can use only the visible text in identifying a window/tab? Use Opt("WinDetectHiddenText", 0) to specify that hidden window text can not be "seen" by the window matching functions. 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
jdelaney Posted March 24, 2015 Posted March 24, 2015 (edited) What do you mean by 'tab'. Output the AutoIT window info tool, while focused on your tab. If it truly is a tab, you can use the _GuiCtrlTab_* functions to see which one is active, and move the correct tab as required...example: _GUICtrlTab_GetCurSel ; returns the current tab's instance _GUICtrlTab_GetItemText ; get the text of the return of the above call Edited March 24, 2015 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
JohnOne Posted March 24, 2015 Posted March 24, 2015 (edited) While 1 WinWaitActive("Retail Merchant", "") ;no text here because the software in open If StringInStr(WinGetText("Retail Merchant"), "hidden Text") Then Beep(800, 100) _HotKeys() Sleep(200) EndIf Sleep(200) WEnd Edited March 24, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Jonovision77 Posted March 24, 2015 Author Posted March 24, 2015 (edited) Final Solution that worked 100% Opt("WinDetectHiddenText", 0) While 1 WinWaitActive("Retail Merchant", "Receipts") ;restricted to only run at the first page with receipt in the name If WinActive("Retail Merchant", "TenderPage") Then Call (_HotKeys) Sleep(100) Else Call (_ClearHotKeys) Sleep(100) EndIf Sleep(200) WEnd Thanks Water for the very helpful bit of code, a simple command. Of course this revealed that my coding was inherently flawed and I needed to adjust it before the hot keys became disabled upon leaving the final page. Edited March 24, 2015 by Jonovision77
water Posted March 24, 2015 Posted March 24, 2015 Glad you got it working 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