Page 1 of 1
Find dialog in a macro, strange, again :roll:
Posted: Thu Mar 11, 2004 11:57 am
by s_reynisson
I'm pasting a string into the find dialog in a macro and getting strange results. Using
WinXPsp1 and TP472. Two documents open in TP. Macro records ok and I save it with the
option to execute once. When I run it,
step 4 is never executed. What am I missing? TIA!
Code: Select all
1.Home, Shift-End, Ctrl-C Goto start of line, Select it, Copy it
2.Ctrl-Tab, Ctrl-Home Switch to other open document, Goto the
start/top of it
3.F5 Open find dialog
4.Ctrl-V Paste into entry box
5.Alt-M, Esc Mark found lines, Exit the find dialog
6.Ctrl-Tab, Home, Arr-Down Switch back to other open document,
Goto start of line, Get ready to select
next line
Posted: Thu Mar 11, 2004 5:27 pm
by MudGuard
Help - Help Topics - Content - How to... - Use Keystroke Macros - Overview:
Points to bear in mind:
- Except where otherwise noted, typing in dialog boxes is not recorded.
- If you record a Find Next or Previous command, the current search string will be used. i.e. the search string will not be recorded, so when you play it back, it will try and find a pattern matching the last search string used.
Posted: Thu Mar 11, 2004 7:03 pm
by s_reynisson
Thx for the point MudGuard, I just looked at the Macro Examples again and saw my error,
in the examples the recorder is started after you type your data in the find dialog. *urgh*
Posted: Thu Mar 11, 2004 8:51 pm
by CyberSlug
Might try
AutoIt
Code: Select all
; AutoIt v3.0.100 sample script
Send("{Home}+{End}^c")
Send("^{Tab}^{Home}")
Send("{F5}")
WinWaitActive("Find")
Send("^v")
Send("!m{Esc}")
Send("^{Tab}{Home}{Down}")
Posted: Thu Mar 11, 2004 10:19 pm
by Bob Hansen
I think that TextPad records your pasting value into the macro when you run it the first time. If you later have something in the clipboard, and run the macro, the clipboard contents won't be pasted into Find field, it will be the same value as when you first recorded it.
Another macro program alternative to AutoIt is
Macro Scheduler
//Macro Scheduler 7.2.050
Label>Start
Press HOME
Press SHIFT
Press END
Press CTRL
Send>c
Release CTRL
Press CTRL
Press TAB
Press Home
Release CTRL
Press F5
Press Ctrl
Send>V
Release CTRL
Press ALT
Send>M
Press ESC
Press CTRL
Press TAB
Press HOME
Release CTRL
Press DOWN
Goto>Start //Insert IF conditions here to loop/Stop
Both Macro Scheduler and AutoEdit are editable. TextPad macros are not. (Use TextPad to do the editing with Syntax and Clip Libraries).
Posted: Fri Mar 12, 2004 10:28 pm
by s_reynisson
Just gave that script a quick run, it does not work. Mind you, it's the first time I ever saw AutoIt and I just downloaded it so I'm using version 3.0.101 (get with the times
CyberSlug!

)
When ran just once it leaves the find dialog in a mess. Is there a quick start quide out there for AutoIt? I'm not sure I'm starting the script correctly.
CyberSlug wrote:Might try
AutoIt
Posted: Sat Mar 13, 2004 1:44 am
by CyberSlug
s_reynisson wrote:Just gave that script a quick run, it does not work.
I probably should have warned you script was untested because I don't use TextPad keystroke compatibility and "Changing the emulation [would kill] all custom key assignments."
The AutoIt help file (AutoIt.chm) is a really good place to start. Especially look at the Send and WinWaitActive functions.
I think this might work My script would fail if the 'Cannot find' dialog pops up.
Code: Select all
Send("{Home}+{End}^c")
Send("^{Tab}^{Home}")
Send("{F5}")
WinWaitActive("Find")
Send("^v")
Send("!m{Esc}{Esc}") ;modified
Send("^{Tab}{Home}{Down}")
Here's an alternative script, but I can't promise it will work for you:
Code: Select all
; Advanced AutoIt script (uses Control commands)
; I assume the English version of TextPad is used....
$title = "TextPad" ;partial title of TextPad window
WinActivate($title)
;Step #1
ControlSend($title,"","HSEditor1", "{Home}+{End}^c")
;Step #2
ControlSend($title,"","HSEditor1", "^{Tab}^{Home}")
;Step #3
WinMenuSelectItem($title,"", "&Search", "&Find")
;Step #4
WinWaitActive("Find")
ControlSetText("Find","", "Edit1", ClipGet())
;Step #5
ControlClick("Find","", "&Mark All")
sleep(100) ;pause 100 millisecs
;Send Esc twice in case the 'Cannot find' dialog popped-up!
Send("{Esc}{Esc}")
;Step #6
ControlSend($title,"","HSEditor1", "^{Tab}{Home}{Down}")
Posted: Tue Jun 22, 2004 3:20 pm
by gbh
I had a similar problem, using one file as a reference & wishing to 'mark all' occurences in other open files.
Thanks to cyberslug & autoit suggestion, I managed to work out the following ... (not very efficient but works)
autoit script:
Code: Select all
WinWaitActive("TextPad") ; wait for TextPad window
$Line=InputBox("Mark All", "How many lines?", "", "")
$curr = 1
while $curr <= $Line ; loop number of times
WinActivate("TextPad") ; activate TextPad window
Send("{Home}+{End}^c") ; highlight current line & copy to clipboard
Send("^f") ; open 'find' dialog box
Send("^v") ; paste from clipboard
Send("{Tab 8}{+}{Tab 2}{ENTER}") ; ensure In all documents checked and Mark All
WinActivate("TextPad") ; re-activate TextPad window
Send("{Home}{Down}") ; get next line
$curr = $curr + 1 ; increment loop control
wend