Not able to select Menu items in NASPT Exerciser using pywinauto - python-2.7

I am using pywinauto to automate NASPT Exerciser tool.
app.IntelNASPerformanceToolkitExerciser.PhotoAlbum.Click().
to click photo album button,
app.IntelNASPerformanceToolkitExerciser.all.Click()
to click all. It's not selecting all buttons.
app.IntelNASPerformanceToolkitExerciser.MenuSelect("Configure->NASPT Tool")
It is throwing error saying can't select Menu to this object.
Is there any other way to achieve above problem?
Can anyone help about this?

This is .NET application. pywinauto has very limited support of .NET controls. So you need to use Windows UI Automation API for such toolbar. Precisely InvokePattern should help with pressing toolbar button.
Or you may try to click button by hard coded coordinates like that:
app.IntelNASPerformanceToolkitExerciser.Children()[54].ClickInput(coords=(300, 10))
This hard-coding way may be better than dealing with quite complicated UI Automation API.
BTW, you may get pywinauto clone with .NET programmatic names support. Just download it as zip and run python setup.py install.
With that mod you can code so:
app.IntelNASPerformanceToolkitExerciser.toolStrip.ClickInput(coords=(300, 10))
I've just checked it. I think hard-coded coordinates is OK here because the software is end-of-lifed and will not be changed. There are not so many unsupported .NET controls.

Related

Getting a external programs handle

I made a small program in C++ that can type text into a notepad document, it does so using FindWindow and FindWindowEx, but I was only able to do that because I knew the names of the windows I was trying to access (in this case it was "Notepad" for the doc and "Edit" for the text area).
If I didn't know the names how would I go about figuring that out? Lets hypothetically say I wanted to make text appear in Chrome's URL box, how would I figure out what the name of that box is so I can use FindWindowEx on it?
The least painful approach to automating 3rd party applications is to use UI Automation. It allows you to navigate UI hierarchies as well as operate on the individual objects.
All native windows controls support UI Automation out of the box. UI Automation also works with frameworks, that do not implement their UI using native controls (e.g. Qt). Particularly with Qt, tools like Spy++ will not give you the information you need.
Run the other app and then use a tool like Spy++, Winspector, etc to look at the other program's window hierarchy to find what you need.

Google Glass GDK Theme for XML layout

Is there a theme that we can use in Eclipse or Android Studio for doing XML layouts? I know we should use:
<style name="CustomTheme" parent="#android:style/Theme.DeviceDefault">
to get the Glass theme on the device, but how about while laying out in the editor?
Since it looks like the XML got eaten up in your original post, I'll repeat the tips to get the Glass theme on the device: remove any android:theme attributes that your IDE has automatically inserted, or if you need a custom theme, have it inherit from Theme.DeviceDefault (see GDK: Glass theme and UI widgets).
Eclipse and Android Studio do not yet provide an out-of-the-box exact Glass layout experience. You can approximate it fairly well by creating a device definition in the AVD Manager that matches the screen resolution on Glass (640 × 360, notlong, hdpi) as suggested by this post.
Then, select that device definition in your layout editor. You may also want to select Theme.DeviceDefault.FullScreen.NoActionBar to remove the status bar and action bar in your editor preview.
You might want to look at how I accomplished getting the Glass theme (which is just no theme as discussed in https://developers.google.com/glass/develop/gdk/ui/theme-widgets) in a Hello World app for Glass. Since the ADT in Eclipse creates a Theme by default and assigns it to the application in AndroidManifest.xml, I just had to remove it.
Here is a Git commit that shows this in action: https://github.com/luisdelarosa/HelloGlass/commit/a58208ddef2b9b25ac605735da0dd93860492477
Specifically I looked for this line in AndroidManifest.xml and removed it:
android:theme="#style/AppTheme"
I also removed the res/values/styles.xml since it was not being used anymore - it only had the themes in it.
As for having a graphical editor for Glass layouts, I don't think this is that well supported yet since we are still in Sneak Peek mode. Perhaps once we get to the Developer Preview mode, the Glass team will create editors that will allow us to design for the Glass UI exactly.

Using c++ how to show overlay icon in finder mac osx

Recently we developed a MAC installer(.dmg). This is developed in c++ and QT. We had a hard requirement to show overlay icons on the files in the finder like how CVS/Dropbox shows sync status on files.
My question is exactly similar to below post. I understand that, if we try to show overlay icons in finder, MAC app store doesn't allow my app to be there. I am fine with this, my users will download the app from the website.
How can i add icon overlay in finder?
Am pretty much new to MAC and c++ also, Can you please provide me suggestion or solution in c++ in detailed.
I know this answer is somewhat late, but better than no answer, isn't it?!
Dropbox uses an open source framework called mach_inject. Originally developed by Jonathan Rentzsch, and known as Mach_Star, it allows code injection into applications.
Dropbox use this to inject into the OSX Finder application. If you Google for "Dropbox mach_inject" you'll find various references to this. Although it's not exactly what you want, there's also a project here which also injects into Finder, but to add menu items. You should be able to use that as reference.

Controlling Internet Explorer in order to enter username/password

I was looking into trying to get my C++ application to do the following:
Open internet explorer
Open a webpage
Enter a name and password into specific forms in the webpage
Click the submit button on the webpage to open a new page
From my searching on the Internet it seems like using COM may make this possible, although I may be incorrect on that. I am doing my best to learn COM at the moment but some help would be great. I'm looking to do this without using MFC.
I have noticed this question which I kind of what I am looking for but I am having trouble understanding the suggested solutions. For example, I do not have a IWebBrowser2 option in my toolbox.
EDIT:
To make my question clearer, I had this task complete in a C# version by simply running a coded UI test but this will not work with C++. I am looking to open IE (not in the application itself), find the username and password forms, pass them string, then find the submit button on the page and click it.
This is very possible from c++. You will have to dive into the winapi to do some Keystroke stuff as well as window handling.
I'm not going to go into all of the code, but you have to do something like the following:
Start ie (if you give it a command line arg with the webpage, it will
open that page).
Make sure the ie window is focused (either just wait
if you want to keep it simple or use window's api to go through each
open HANDLE and find the window you want)
Use SendInput to send an Alt + D (to gain focus to the url bar, in firefox it will be a CTRL + L instead)
Use SendInput and javascript injection to modify the DOM as necessary
You can also submit the form (after everything is as you want it) using the above JS injection capability.
Yes, it is possible, but you have to embed a web browser control in your application, and it is not straightforward (I don't think you can automate DHTML in an external instance of Internet Explorer via COM).
I see that you don't want to use MFC, and this complicates even more the problem. Perhaps you can do it via ATL, I advise against even trying to do it without a framework.
If you could use MFC, then you could use a CDHtmlDialog form and access the underlying COM interfaces to automate the actions.
In the past, I developed an MFC application that used HTML as its user interface, but I used the CDHTMLView class that you can find here: http://www.codeproject.com/Articles/1783/Integrating-DHTML-into-MFC-Views
You can use this as an entry point for learning how to deal with DHTML events and how to play around with the IWebBrowser2 interface.
You should really take a look at WebDriver which is able to do exactly what you are describing. See (http://code.google.com/p/selenium/wiki/InternetExplorerDriverInternals) for more information about the InternetExplorerDriver internals. Even if you are not able to use the project directly, you can certainly browse the source to get a better idea of how what you want to do can be achieved.
What you want to do makes not much sense.
There are many APIs available to embed a browser view into your program. For example Qt offers this.
Then you can just do your HTTP POST request yourself and display the answer you get in your browser view.
That is a much cleaner solution.
Pro tip: Don't use Internet Explorer.

C++ style menu bar in VB.NET?

Ive been looking a long time for this, but can't seem to find it. When I add a menu strip in vb .net, it looks like this:
http://img19.imageshack.us/img19/4341/menu1sbo.jpg http://img19.imageshack.us/img19/4341/menu1sbo.jpg
and I want it to look like the WinRar, Calculator, Notepad etc menus like this:
http://img8.imageshack.us/img8/307/menu1a.jpg http://img8.imageshack.us/img8/307/menu1a.jpg
From what I gathered, in vb 6 you could create a mainmenu and do it this way, but in vb .net it seems like all there is is ugly menustrip.
Thanks
You may have to get dirty and create a CustomRenderer(ToolStripProfessionalRenderer) to apply to the ToolStripManager
Without rehashing to much, this doc looks like a nice overview or you can always opt for the Microsoft tutorial
menustrip is derived from toolstrip
You may need to enable XP theme support in your project settings. To do this, go to My Project in your Solution Explorer, and make sure "Enable XP Visual Styles" is checked under the Windows application framework properties group down near the bottom of the Application tab.
If this doesn't work, you might need to create an application manifest as described in this MSDN article.
This question is quite old but for anyone else interested, you can find this type of menu in the .NET framework components. Just right click the Toolbox -> Choose items -> .NET Framework Components and filter for MainMenu. Works exactly like any other menu strip from what I've seen so far.