TSE: Only navigating selected filenames in the TSE ring

2 views
Skip to first unread message

knud van eeden

unread,
Jan 4, 2023, 9:30:41 AM1/4/23
to SemWare TSE Pro Text Editor
Hello,

Use case: You have say 100000 files loaded in the TSE ring. But only want to visit a selected few.

Usage: run, supply the part of the filename you are interested in (e.g. .txt, e.g. test, e.g. yourname, ...). It searches then for filenames which contain that search string.


// library: file: goto: next: file: name: given <description></description> <version control></version control> <version>1.0.0.0.10</version> 
// <version control></version control> (filenamemacro=gotofing.s) [<Program>] [<Research>] [kn, ri, we, // 04-01-2023 11:22:34]

INTEGER PROC FNFileGotoNextFileNameGivenB( STRING searchS )
 INTEGER B = FALSE
 INTEGER foundB = FALSE
 INTEGER startB = FALSE
 STRING fileNameStartS[255] = CurrFilename()
 STRING fileNameS[255] = ""
 REPEAT
  NextFile()
  fileNameS = CurrFilename()
  foundB = StrFind( searchS, fileNameS, "i" )
  IF foundB
   B = TRUE
  ENDIF
  startB = EquiStr( fileNameS, fileNameStartS )
 UNTIL ( foundB ) OR ( startB )
 IF ( ( startB ) AND ( NOT ( B ) ) )
  Warn( "Filename with", ":", " ", searchS, " ", "in the filename was not found in the TSE file ring" )
 ENDIF
 RETURN( B )
END

PROC Main()
 STRING s1[255] = GetHistoryStr( _EDIT_HISTORY_, 1 ) // change this
 IF ( NOT ( Ask( "file: goto: next: file: name: given: searchS = ", s1, _EDIT_HISTORY_ ) ) AND ( Length( s1 ) > 0 ) ) RETURN() ENDIF
 Message( FNFileGotoNextFileNameGivenB( s1 ) ) // gives e.g. TRUE
END

with friendly greetings
Knud van Eeden



Reply all
Reply to author
Forward
0 new messages