AutoHotkey Community

It is currently May 26th, 2012, 2:36 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: June 11th, 2005, 6:57 pm 
Offline

Joined: June 9th, 2005, 4:20 pm
Posts: 21
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: solved ..
PostPosted: June 12th, 2005, 7:57 pm 
Offline

Joined: June 9th, 2005, 4:20 pm
Posts: 21
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], G. Sperotto, poserpro and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group