I can't see why this script does not work .. I am trying to ......
- highlight some text in EditPlus editor window
- cut the selected text to clipboard
- run an external text filter (*bat file) which processes the text and responds in clipboard
- paste the clipboard content back into the EditPlus window to replace the original selected (highlighted) text which has been cut.
Code:
WinActivate, EditPlus - [hotkeys.ahk]
WinWaitActive, EditPlus - [hotkeys.ahk]
Send, ^X
MsgBox, Control-X cut the following contents from editor into the clipboard:`n`n%clipboard%
; process text filter
Run, "c:\AHK\textfilters.bat" A ; text filter
FileRead, Clipboard, *c "c:\temp\output.txt"
WinActivate, EditPlus - [hotkeys.ahk *]
WinWaitActive, EditPlus - [hotkeys.ahk *]
Send, ^V
MsgBox, Control-V paste the following contents into editor from the clipboard:`n`n%clipboard%
Note that the second reference to active window (EditPlus) has an asterix * in window title indicating that the file has been changed (after the Ctrl+X cut).
This window title is verified using Window Spy.
...
I end up with expected focus on the EditPlus window .. with the selected text having been cut (but the result not pasted).
If then I manually execute Ctrl+V (paste) in EditPlus the correct content (in clipboard) is pasted.
The puzzle is, the final command in the script ..
Send, ^V .. seems not to work as expected .. to paste the clipboard content.