AutoHotKey Detect Windows Popup - autohotkey

I am trying to write a script in AHK to detect windows popup and capture the message.
For example: Program X will create a popup with a message. The AHK script should be able to detect the popup and get the message in it.
Is this possible?
I tried the example from http://www.autohotkey.com/board/topic/23221-run-command-prompt-commands-and-capture-output/ but it is too complicated.
I just need to capture the message of a popup using AHK script.

Actually this can be done. The AHK code below will detect a Windows popup with the title "Test" and each time such a popup is detected it will write a message into a textfile.
Loop
{
Sleep 500
if (WinExist("Test"))
{
FileAppend, Another line. , C:\Users\user1\Desktop\testahk.txt
}
}
Take note: it is in a loop, so it will run continuously.
However I'm still trying to figure out how to grab the whatever message that will be shown inside the popup.
Still working on it. Anybody have an idea on that one?

Related

Run Power Automate flow from Windows Desktop via shortcut key or command line / shell

I would like to run a Power Automate flow by pressing a keyboard shortcut or alternatively calling it up from CMD or Powershell script.
The flow would simply start execution once the keyboard shortcut is pressed or a Powershell script is run.
As it is now; I need to start Power Automate and then click on play in order to start a specific flow. I am trying to avoid all that.
The ultimate goal is to, once the system is up (Windows 10) and I'm logged it, I press the shortcut key and go do something else and by the time I get back the flow is done. The flow itself works flawlessly. Please note that I am not looking for a solution which would involve smartphones and flow buttons on said phones, purely a Windows , PC, only solution or a way to a solution.
Here is a picture to clarify what Lukas was describing as a workaround.
Create a loop and make sure that the index variable for the loop is 0 so that it will never stop looping. Then make sure to put a 'wait for shortcut key' inside of the loop with you desired shortcut. Below that action and still inside of the loop, put all of your actions.
Run the script and the script will enter the loop at the 'wait for shortcut action. When the shortcut is pressed it will run all of the actions and then loop back to the 'wait for shortcut action again. As long as the script is running in the background the shortcut can trigger it.
Surprisingly, I do not think there is a way to do this. The best solution would probably be to use AutoIT to create a small automation to start your PAD flow.
As long as you're somewhat familiar with programming and even if you're not familiar with AutoIT, it shouldn't take you but a couple hours to write a script that is activatable via hotkey that opens PAD and starts the flow you want.
The AutoIT help file that you get when you install should be all the guidance you need.
(Depending on what your flow actually does, you might be better off just writing your whole automation in AutoIT)
You actually don't need to put everything in a loop, the loop is just from the end of the script to the top label. You just need a label at the top (if you want to be able to press the shortcut more than once), a wait for shortcut key event, and at the end a "go to the label" you created (in the image below it's 'start').
Then you can save the flow and start it. Nothing will happen until you press your shortcut key. Then the flow will execute, and return to the top, waiting for you to press your shortcut again.
You can even have errors go to the start label, instead of ending the script, so that the flow "stays alive".
Just put label on top of your code and then "Wait for shortcut key" and at the end use "go to" function, that will loop the code. This works for me

How to make AutoHotkey script for selecting a pen in OneNote(UWP)?

To give you an intro, I am not a programmer but a biologist who is learning a bit of programming.
Now I use OneNote a lot and continuously switch between typing and touch-based inking.
Now OneNote UWP does not have a shortcut for selecting a pen.
But I found out that by pressing Alt+d and then down and then continuously pressing right six times and then pressing enter, one can switch to pen via keyboard.
Now I want to automate the above process and link it to Numpad 1.
So I tried AutoHotkey and tried to learn making a script of the above command but still no success.
This is what I tried (3-4 different ways):
Numpad1::
!d
Down
Right
Right
Right
Right
Right
Right
Right
Enter
I know this script is wrong but I can't find the correct way to do it.
You're off to a good start! In order to send the keystrokes, you'll need to use one of the variations of the Send command. In addition, we can also make it so that it only work when OneNote is the active window using the #If directive. (It makes hotkeys context-sensitive.)
I don't have OneNote on my machine, but please verify that the title contains "OneNote" for the following script to work.
SetTitleMatchMode , 2
#If WinActive("OneNote")
Numpad1::Send , !d{down}{right 6}{enter}
#If
Edit: I installed OneNote to try it out. It appears to run too quickly. I added a key delay of 75ms and changed Send to SendEvent, which obeys the key delay. This worked fine for me:
SetTitleMatchMode , 2
SetKeyDelay , 75
#If WinActive("OneNote")
Numpad1::SendEvent , !d{down}{right 6}{enter}
#If

MATLAB: I cannot input anything after "No completion found" message

If there is no match for auto completion, I get "No Completions Found" message.
The problem is, when I got this message, I cannot input anything after that. To get able to input something, I have to move to different window and come back (e.g. Command Window -> Editor -> Command Window) or click the window. But this process is really annoying.
How can I continue typing without doing these annoying things written above? I am using MATLAB2011b on Windows 7.
Thank you in advance.

Eclipse After Running the file

Whenever i run Hello World Using C programming and Eclipse it shows Console as blank White, and the only method for me to view an output on a console is to click the red button "Terminate button" and it will show the output on console.
Is there a way to fix this, whenever we click run it will run the program and show the output on the console without having to click the terminate button?
Thank you very much.
I don't know what do you mean by "it shows blank white" as if it is closed quickly or hangs ?
but try adding
fflush(stdout);
while ( getch() != '\n' )
after your printf statement
As you can press the red "Terminate" button, your program can be started but hangs and never terminates by itself. We will need to see the source code of your program to tell you why.
Also, don't forget to add \n at the end of your printf() string or force a flush of the output with fflush(stdout);

Audio multi-cast software needs a multi-window `Click down` .. was this tested?

I'm trying to multi-cast audio do a number of channels. The software requires that I click and hold a button to broadcast. So, I wrote this little script to do the job.
After running several copies of the software, the loop is supposto cycle through the windows and click and hold all of the broadcast buttons. However, only the first button sticks but the other buttons do not appear to click or hold.
The encouraging thing is, I can run the script and as the first button is being held (by the script's action), I can manually click and hold down a second button in another window. The programs work as intended sending voice down all channels. Perhaps there is an issue in the auto-hot-key program.
Here is the code:
#enter::
Loop 3 {
SetTitleMatchMode, Slow
IfWinExist, Virtual Base Station, USER_%a_index%
{
WinActivate
WinWaitActive
Click down 400,60
}
}
Update: I have a work around. The multi-cast program allows the space key as a short cut too. Send {Space down} does function on multiple windows. All windows think the space bar is being held down.