0
votes

The "Find" dialog in PowerPoint 2010 does not behave as expected. Pressing Ctrl+F will bring up the dialog and the last search term, but it will not be highlighted. The cursor will be at the beginning of the search term, so if I press Ctrl+F and just start typing, I'll essentially be prepending my new search term onto the one I searched for last. To avoid this, I have to manually delete the contents of the search box before I type what I want to search. Super annoying.

Enter AHK. I have this as my script:

loop {
    WinWait, ahk_class NUIDialog ahk_exe POWERPNT.EXE
    Sleep, 50
    Send ^a
    WinWaitClose
}

What this does is it waits for the Powerpoint Find dialog to appear, then it "presses" Ctrl+A for me so it highlights previous search term so I can just start typing. But here is where the problem arises, and I can't figure out how to get around it.

When I press Ctrl+F, the script works fine. And if I then press Ctrl+V, I can paste text into the box (as expected). But, if I instead keep Ctrl pressed after pressing Ctrl+F, then press V (Ctrl+F, then V, then release Ctrl), I just get the letter "v". It seems like AHK releases the Ctrl key after it sends Ctrl+A, when though I still have Ctrl still pressed. How can I avoid this behavior? How can I prevent AHK from releasing the Ctrl key if I still have the Ctrl key pressed (if that's what's even happening)?

1

1 Answers

1
votes

Use blind mode to not release the modifier.
And I would also recommend SendInput even though it's not going to make any meaningful difference with this script. It's faster and more reliable and generally the preferred send mode, so yeah.

SendInput, {Blind}^a