dragonfly
Joined: 09 Jun 2005 Posts: 18
|
Posted: Tue Jun 14, 2005 4:09 pm Post subject: |
|
|
Thanks for the suggestion .. I'm still learning the subtle use of other Commands.
....
I got the script to work by using this preamble ....
| Code: |
; preamble
#SingleInstance force
SetTitleMatchMode, 2 ; partial match
; set GUI out of focus and EditPlus into focus
WinSet, Bottom,, Text Filter Selector ; set the bottom status of GUI
Sleep, 200
WinSet, AlwaysOnTop, On, EditPlus ; set the always-on-top status of EditPlus
Sleep, 200
; trace active window stats (use only for debugging)
WinGetActiveStats, Title, Width, Height, X, Y
MsgBox, on entry - The active window "%Title%" is %Width% wide`, %Height% tall`, and positioned at %X%`,%Y%.
; ... rest of code to cut and paste in active EditPlus window ..
|
The effect of WinSet was to switch the GUI out of focus, and the EditPlus window into focus before hitting the Send, ^x and Send, ^v code lines in the script.
The trace WinGetActiveStats was useful for inspecting the active window at the point of cutting and pasting; and sure enough, without the WinSet preamble the GUI was still in focus. The preamble script solved this.
...
One point I noted that when using
SetTitleMatchMode, 2 ; partial match
I had to be careful to ensure that two windows did not contain the same fragment of title, so causing confusion. e.g. I had title fragment "EditPlus" in bother EditPlus and also in the GUI Title, and had to change GUI Title to remove reference to EditPlus.
...
I did experiment with use of ControlSend as suggested.
ControlSend, AfxFrameOrView42s1, ^x, EditPlus ; cut highlighted text
where "Now Mouse Under Cursor" = AfxFrameOrView42s1 (in EditPlus)
This worked. But I got similar control by WinSet preamble code.
And I'm not sure if the Value AfxFrameOrView42s1 might change in different configurations/releases of EditPlus. "Send" is more general. |
|