dragonfly
Joined: 09 Jun 2005 Posts: 18
|
Posted: Sat Jun 11, 2005 6:57 pm Post subject: problem with Cutting and Pasting in EditPlus editor |
|
|
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. |
|
dragonfly
Joined: 09 Jun 2005 Posts: 18
|
Posted: Sun Jun 12, 2005 7:57 pm Post subject: solved .. |
|
|
I have solved my newbie problem .. after studying more commands ..
added line .. SetTitleMatchMode, 2 ; partial match
which allows a partial matching of active Window Title
e.g. IfWinExist, EditPlus
instead of exact title (which changes after editing).
Now I can highlight text in EditPlus and pass cut text back to a textfilters.bat utility to perform various parsing operations.
Results are pasted back into EditPlus to replace original highlighted text. |
|