Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Get Focussed Window Title
Topic Summary:
Created On: 05/28/2018 02:27 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 05/28/2018 02:27 AM
User is offline View Users Profile Print this message

Author Icon
MarkusKoop
n00b (>6 posts)

Posts: 2
Joined: 05/28/2018

Hi there,
I am quite new to Automate and hope someone can help me.

How do I get the Window Title of the focussed window in Automate 11?

I found something posted for Automate 6 (see post here, code see below), but that code is not working in my case (even after adjusting the code to Automate 11 language).

The problem is that I do not have a WindowHandle, which is required for the solution. "GetFocussedWindowHandle()" only returns "0", likely because the window was opened by executing a SAP transaction code instead of opening it via Automate.

Is there something like "GetFocussedWindowTitle()" or a workaround?

I am using Automate 11.0.2.22 on Win 7 and I have SAP opening new windows with very specific titles, which sometimes even change when I select another cost center or view of the data. There seems to be no Automate window handle for these windows). I need to read the title into a variable in order to use it dynamically for other Automate actions (such as movemousetoobject).
Since the window is opened by SAP (initiated by keystrokes), there is also no "Populate variable with Window Title" element for me to use.

I appreciate your kind assistance
Best regards
Markus

and here is the code from the mentioned post for Automate 6:


Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)
 06/01/2018 06:46 AM
User is offline View Users Profile Print this message

Author Icon
Alex Escalante
HelpSystems

Posts: 871
Joined: 02/26/2014

Hello Markus,

There is an option within the "focus window" action that allows you to populate a variable with the window title. Is this not properly populating? You can take a look at the screenshot below to see where you would setup the variable.

Another possible solution would be to take a screenshot of the window, and use the OCR action to "scrape" the name off of the screenshot and populate a variable.

Please let us know if either of these work for you.

Click for full image
Click for larger image



-------------------------

Alex Escalante | Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700 | F: +1.213.738.7665
 06/06/2018 05:33 AM
User is offline View Users Profile Print this message

Author Icon
MarkusKoop
n00b (>6 posts)

Posts: 2
Joined: 05/28/2018

Hello,
thanks for your response.

I know about the option to "populate a variable with window title" within the "Focus Window" action. However, I cannot use it, because in order to do so I have to give Automate something to know which Window it should focus.
The Drag&Drop system in the Focus Wndow action automatically fills in the Window title and window handle as identifier of this specific window, but I don't have either of it, since it is not fix (the title is different every time and GetFocussedWindowHandle() function only returns "0").

All I have to identify the window is the fact that the Window already is focussed. That's why I am looking for something like a GetFocussedWindowTitel() function.

The Screenshot to OCR option sound a bit extreme and risky in terms of getting the correct snapshot, the correct area, no errors during OCR, etc.

Do I have other options?
Thanks a lot
 06/08/2018 09:11 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Hi Markus,

Is there at least some portion of the window title that is static? If you're interacting with SAP and it opens a window like "SAP Reports - 20180608", you can actually do a Wait for Window activity and use a wildcard for the title such as "SAP Reports - *". You can then populate a dataset and/or focus the window from the Wait for Window step.

-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 471 guests browsing this forum, which makes a total of 471 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2019 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog