How To Switch b/w windows/dialogs in Autoit - autoit

I have Two Windows I have to Switch b/w them
I tried the following code but not worked, here I tried to Simply Press Keyboard button ALT+TAB but does't work:
Send("! {TAB}")
or
Send("ALT} {TAB}")

The best way to do it is to use WinActivate to activate each window each time you want. It's way more safe than use Send("!{TAB}").
WinActivate

You have a space in the Send-command. And so you send: Alt+Space+TAB.
So it works:
Send("!{TAB}")

Related

QDialog is on top of every Application

we need to execute dialog on top of every windows application.
we tried some code below for that but its not working for us.
setWindowFlags(Qt::WindowStaysOnTopHint);
setModal(true);
setWindowModality(Qt::WindowModal);
can you Please let us know how can we achieve this?
It should work with only:
setWindowFlags(Qt::WindowStaysOnTopHint);
Then remove:
setModal(true);
setWindowModality(Qt::WindowModal);
And try again.

Nightwatch Cannot Find/Click on Dropdown Option

I'm a backpacker and a programmer, trying to use the second skill to find openings in a full campsite. Rather than crawling fro scratch, I'm using the end-to-end testing framework nightwatch.js to navigate for me.
I've hit a roadblock, because nightwatch is having difficulty finding a specific element using css selectors.
Here are the elements and page:
Here is my test code:
Previous Attempts
My test code will click on the selection box with #permitTypeId. It will see that #permitTypeId option is visible. It will not see or click on any of the options when more specific values are specified. The five .click()'s are all css selectors I've already tried. None of the options are set to display:hidden or display:none. I have also tried all of the above without the .waitForElementToBeVisible() just in-case the waiting causes the dropdown to hide.
I've successfully clicked options from different dropdown menus on this website without any problem. Just this one is causing a headache.
The tests are running with the most current Selenium server and Firefox on Mac Yosemite.
tl;dr
Nightwatch.js/Selenium won't click on something from a dropdown menu.
The Path...
Cory got me thinking about jQuery and native DOM manipulation. Tried going that route and was successful selecting the correct option using Selenium's .execute() function:
.execute('document.getElementById("permitTypeId").options[1].selected=true')
However, it was not triggering the onchange event.
Saw this post which made me start thinking about using key-strokes and this one which suggested using arrow-keys to navigate down a <select> element to the option, then hitting enter.
...to the Solution
.click('select[id=permitTypeId]')
.keys(['\uE015', '\uE006'])
I've found that this is an issue with Firefox. Chrome and PhantomJS operate well clicking <option> tags.
you should be able to click like this way
browser.click('select[id="permitTypeId"] option[value="1451140610"]')
Additionally I was able to add a .click event for the specific option once I did a .click for the select. see my example below:
.click('select[name="timezone"]')
.pause(1000)
.click('option[value="America/Chicago"]') //selects the option but doesn't click
.pause(5000)
.keys(['\uE006']) //hits the enter key.
another solution:
.click('select[id="permitTypeId"]')
.waitForElementVisible("option[value='1451140610']")
.click("option[value='1451140610']")
Very simple way is to use .setValue('#element', 'value of option')

how do i use firebug or chrome console instead of alert() to see variable values?

how do i use firebug or chrome console instead of alert() to see variable values?
currently, I want to see the value of var i as it increases. Not sure that it's increasing.
You probably want to use console.log(). It just prints the parameters in the firebug console.
More info can be found on http://getfirebug.com/logging.
You can use a breakpoint on this variable. You can find explanations for the Chrome Inspector here: http://code.google.com/chrome/devtools/docs/scripts-breakpoints.html
You could use something like the YUI Logger control - http://developer.yahoo.com/yui/logger/ - which puts a log window on your webpage that you can write debugging messages to and clear/hide/etc.
Or you could try a javascript shell bookmarklet that opens a separate shell in the context of the main window. One example is available at https://www.squarefree.com/bookmarklets/webdevel.html, and there may be others.

take a snapshop of a qgraphicsview

I am using Qt 4.5 and a qgraphicsscene/view to show video to the user.
I would like to provide a "take a snapshop" button and I am sure that there is a pretty straightforward way much simpler of everything I am thinking about.
How can I do this elegantly?
BTW, the code is here :
http://gitorious.org/handy
You can use the method QWidget::grab(). This method renders the given widget to a pixmap and returns that pixmap. Then you can do whatever you like with that, like saving to a file using QPixmap::save().
See QScreen::grabWindow() and QWidget::grab().
With grabWindow you can even capture a window outside of your application, e.g. the screenshot example program:
http://doc.qt.io/qt-5/qtwidgets-desktop-screenshot-example.html

How to disable a Perl/Tk window close ('X') button on Windows

Is there a way to make a Perl/Tk window's close ('X') button disabled?
I know how to ignore clicking it using the technique described here, but I would much rather have it disabled.
I'm using Perl/Tk on Windows.
Thanks,
splintor
If you are in a Unix environment you are out of luck. The "close" button is managed by the Window Manager of the desktop which is a completely different process that you have no control on.
Even if by a hack you disable the "close" button the user can always bring it back
if the window manager permits this. The enlightenment window manager for example can
enable/disable all window buttons on demand.
The technique you give in the link is doing exactly this. It does not remove
the "close" button. It just gives a hint to the window manager (WM_DELETE_WINDOW).
It is up to the window manager if this hint will be honoured or not.
See also the icccm and NetWM pages.
What you want might be possible on Windows, but my experience with this OS
is limited so perhaps another poster will know this.
I have an app that I wrote, i was wondering about the same thing, and i don't disableit, but i have a call back to a subroutine, that simply does return;
$Mw->protocol('WM_DELETE_WINDOW',sub{return;});
According to the Perl Monks, it looks like the following works on Windows:
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $window = new MainWindow;
$window ->title("Close test");
$window ->geometry("400x250");
#prevents window from closing
$window->protocol('WM_DELETE_WINDOW' => sub {
print "Do stuff before exiting\n";
exit;
});
MainLoop;
In the above code, you are intercepting the signal sent when the user presses 'X' and can then write your own subroutine to execute when the button is pressed.
If you want to disable the close icon, set sub to empty (effectively telling it to "do nothing when pressed"): 'WM_DELETE_WINDOW' => sub {}
If you don't manage to really disable the close button (I mean to grey it out or even remove it from the window decoration), it might be the most intuitive thing to iconify your window instead of closing it. This is what I did.
$window->protocol('WM_DELETE_WINDOW', sub { $window->iconify(); } );

Resources