AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

problem with Cutting and Pasting in EditPlus editor

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
dragonfly



Joined: 09 Jun 2005
Posts: 18

PostPosted: Sat Jun 11, 2005 6:57 pm    Post subject: problem with Cutting and Pasting in EditPlus editor Reply with quote

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.
Back to top
View user's profile Send private message
dragonfly



Joined: 09 Jun 2005
Posts: 18

PostPosted: Sun Jun 12, 2005 7:57 pm    Post subject: solved .. Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group