How can I know whether process has a windows or not? - powershell

Sometimes my program is finished incorrectly. GUI is gone but processes still present in the system. So I need to verify whether the program finishes correctly or not by checking GUI presence. Could anyone help me with it?

It looks like what you need is WASP.
You can use WASP's Select-Window to list all window handles.
You can then use Select-Window Myapp* to set focus on the window, if required.

Related

Calling elisp code when awakening from sleep

I'd like to configure emacs a little differently when coming in over remote desktop. I can detect the rdp session, but I'd like to automatically run the function that checks when emacs wakes from sleep. I believe Windows issues a PBT_APMRESUMESUSPEND event when awakening because of user activity -- is there a way to hook this from within emacs?
This would be for emacs 24.4 on Windows. Some code or a pointer to the right documentation would be great. I've looked but am not seeing anything -- maybe I'm not looking in the right place. Thanks in advance.
I don't know of any hooks that are triggered in your situation, would it be possible to solve your situation using the input focus hooks?
Specifically, focus-in-hook.

Run a program automatically on script start-up

I am trying to make an AHK script open another program everytime it is started. The problem is, I don't want this to happen if that other program is already opened.
Here's what seems to be supposed to be working, but isn't : (this section is placed at the very top of my script)
SetTitleMatchMode, 2
#IfWinNotExist, Microsoft Excel - myExcelFile.xls
Run C:\myExcelFile.xls
#IfWinExist
;REST OF MY SCRIPT GOES HERE
What should be happening :
If the window "Microsoft Excel - myExcelFile.xls" is not opened, run it. If not, do not.
What is happening :
Whether it is opened or not, it will try to run it again.
So yeah, even though I had read the documentation, I had understood that the difference between #IfWin and IfWin was whether they were used inside or out of a specific hotkey. To my understanding, "creates context-sensitive hotkeys and hotstrings" also included "context-sensitive auto-execution" (when code is not inside a hotkey)
Indeed I was wrong and the solution is to remove the #.

How do I watch a variable in real-time when debugging on Eclipse?

I'm trying to watch a variable change in Eclipse's debug while my program run. But I can only find how to watch a variable when I have a breakpoint set, which pauses the program. I wanna watch the variable change in the eclipse window, while I'm using the program, without having the program pause each time the variable changes.
Is there any way to do that?
There is not a way to do this that I'm aware of. The closest I could imagine is to have a thread that captures the thing you want to monitor and periodically prints its value. You might have to synchronize access to that object at that point since multiple threads could be touching it.
For varX
Add System.out.println("varX = " + varX);
and see in console, or LogCat under tag = System.out
PS
You can see this answer in the link below, voted down! "Programmers" hate the simple solution, and for this reason the question remains unanswered.
Watching variables contents in Eclipse IDE

gtkmm and the system clipboard

I am wondering if there is a signal anywhere in gtkmm that is emitted when the system clipboard contents change/someone copies text. I looked into the gtk docs and it seems the only signal emitted by the Gtk::Clipboard object is the owner_changed signal. To be more specific, I don't care who changes the system clipboard whether it be my app (which it wont be) or the user.
My only other option to implement this is to loop and keep checking the clipboard for a change. Was hoping there was a more efficient means of accomplishing this.
Anyone know of a signal?
Thanks.
I'd take a look at this example. I did not compile and run it, but I think it is indicating that the "owner_changed" signal will do what you want.

Using NPAPI to detect browser minimize

Is there a way to use NPAPI to determine whether the browser is minimized.
Not directly. Depending on which platform you want (you should really specify things like that) there might be a way.
For example, on windows you might be able to get the browser HWND (NPN_GetValue with NPNVnetscapeWindow) and then check the state of that window with windows API calls.
On mac you're going to have a harder time of it; you could possibly intuit from the clipping information passed into NPP_SetWindow, but that doesn't tell you if the browser is minimized or if the plugin (or even the tab) is just not visible. Again, you'd need to try to figure out a way to use system calls to find your way back to the real window, but on Mac that's going to be very non-trivial.
Linux I'm not sure; you get a GtkSocket if you use XEmbed (only thing Chromium supports) and I haven't a clue if you can use that to get back to where you'd need to be to check minimized state.
So the short answer is no; NPAPI doesn't provide anything like that. You'd just have to try to find something that it does provide that gives you enough info to hack it.
Since I was using Core animation layer. I put in a timer which checks how often the candraw call back is called. If the time difference between the two callbacks are greater than a second I assume that either my plug-in is minimized or hidden.