Clear all bookmarks (from among all loaded documents)

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Michael S. Sanders
Posts: 4
Joined: Sun Oct 05, 2003 6:18 pm

Clear all bookmarks (from among all loaded documents)

Post by Michael S. Sanders »

Howdy, I'm new to Textpad.

v4.7.1

Assuming several bookmarks spanning multiple documents...

Is there any method to clear all bookmarks (from among all loaded documents) without manually selecting each document first?
later on,
Mike

www.vega-tek.com
User avatar
CyberSlug
Posts: 120
Joined: Sat Oct 04, 2003 3:41 am

Post by CyberSlug »

I've written a program that does what you want, though it's not particularly efficient. (You may need to tweak the "sleep" statements if you are dealing with a lot of large files.)

How to use it:
1. Download AutoIt3.exe from http://www.hiddensoft.com/autoit3/
2. Save the following code in a file such as "unBookmarkAll.au3"
3. Create a user-defined tool (Configure/Preferences/Tools)
that points to the program AutoIt3.exe and takes parameter "unBookmarkAll.au3"

Note: Alternativly, you can download the entire AutoIt package (under 600 KB) to compile my script into a standalone executable. But the method described above allows you to easily tweak the script if you need to.

Code: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Clear all bookmarks from ALL documents in the active TextPad instance ;
; Simply cycle thru each file, and call "Clear all bookmarks" each time ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; AutoIt v3 script <www.hiddensoft.com/autoit3/> for TextPad 4.7.1
;   Philip Gump - 5 October 2003 - philipgump@yahoo.com


;;; First, Determine the number of files ;;;
$titles = WinGetText("TextPad - ","")  ; get list of files & toolbars...
;  I'll ASSUME each file path contains ":\" so I won't count toolbars.
$count = 0
While StringInstr($titles, ":\") <> 0
   $count = $count + 1
   $titles = StringTrimLeft($titles, StringInstr($titles, ":\"))
WEnd

;;; Now cycle through the files (returning to original at end) ;;;
SendSetDelay(0)
For $i = 1 to $count + 1
   Send("^+{F2}")  ; Ctrl+Shift+F2 "Clear all bookmarks"
   Sleep(5)        ; pause 5 milliseconds for operation to complete
     Send("{CTRLDOWN}")  ; Loop is needed due to the way that
     For $k = 1 to $i    ;   ctrl+tab (cycling thru files) works.
       Sleep(1)    ; pause 1 ms in case switching between large files
       Send("{TAB}")     ; It cycles you to the last active tab instead
     Next                ;   of simply the next tab...or something  
     Send("{CTRLUP}")	 ;   like that!		
Next

; End of Script
Michael S. Sanders
Posts: 4
Joined: Sun Oct 05, 2003 6:18 pm

Post by Michael S. Sanders »

CyberSlug writes in part:

I've written a program that does what you want, though it's not particularly efficient. (You may need to tweak the "sleep" statements if you are dealing with a lot of large files.)


Hi CyberSlug pleased to meet you.

I'll check this out and many thanx.
later on,
Mike

www.vega-tek.com
User avatar
POZLtd
Posts: 3
Joined: Thu Dec 11, 2008 5:44 pm
Location: Isle of Man
Contact:

Post by POZLtd »

5 years on and I've found this very useful. TextPad still doesn't support multiple documents very well with bookmarks.

I've updated your AutoIt script to AutoIt3 compatible. Hope you don't mind.

Cheers,

Barry.

Code: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
; Clear all bookmarks from ALL documents in the active TextPad instance ; 
; Simply cycle thru each file, and call "Clear all bookmarks" each time ; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 

; AutoIt v3 script <www.hiddensoft.com/autoit3/> for TextPad 4.7.1 
;   Philip Gump - 5 October 2003 - philipgump@yahoo.com 
;
; Updated to AutoIt3 functions
;   Barry Everett - 11 December 2008 - POZ Ltd (www.poz.co.im) 
;
; TextPad->Configure-Preferences; add a new Tool, command pointing to the AutoIt3.exe, and parameter to this file.
;

AutoItSetOption ( "WinTitleMatchMode", 2 )

;;; First, Determine the number of files ;;; 
$titles = WinGetText("TextPad - ","")  ; get list of files & toolbars... 
;MsgBox(0, "Text read was:", $titles )

;  I'll ASSUME each file path contains ":\" so I won't count toolbars. 
$count = 0 
While StringInstr($titles, ":\") <> 0 
   $count = $count + 1 
   $titles = StringTrimLeft($titles, StringInstr($titles, ":\")) 
WEnd 

AutoItSetOption ( "SendKeyDelay", 1 )

;;; Now cycle through the files (returning to original at end) ;;; 
For $i = 1 to $count + 1 
   Send("^+{F2}")  ; Ctrl+Shift+F2 "Clear all bookmarks" 
   Sleep(5)        ; pause 5 milliseconds for operation to complete 
     Send("{CTRLDOWN}")  ; Loop is needed due to the way that 
     For $k = 1 to $i    ;   ctrl+tab (cycling thru files) works. 
       Sleep(1)    ; pause 1 ms in case switching between large files 
       Send("{TAB}")     ; It cycles you to the last active tab instead 
     Next                ;   of simply the next tab...or something  
     Send("{CTRLUP}")    ;   like that!       
Next 

; End of Script 
Post Reply