By using this script bound to a hot key, the selected text in the (active) Browser announcement is taken, and a string of just the last names (or first and last) is displayed for editing and then put on the clipboard
===edit
- Version info now included in code
Code: Select all
//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
CapsOff
ScrollOff
// for debug:
//SetFocus>Firefox*
// Versions:
// 1.1 - handles more special character as separators including spaces,
// most new ones interfere with regular expressions
// 1.2 - Edit of result possibe, EOL deleted if present in result
// 1.3 - Enter (CR) and/or New Line (LF) as name seperator implemented
// 1.4 - Closing parenthis now also end of name option
// 1.5 - made the dcipt interactive, edit result (last anmes artists) on screen now possible
//
// Script reads list of character roles and performing artists out of last active app
// Script outputs a list of last names only on the clipboard
//
// Input must have been selected in the last active app
// First char of selection must be the begin of a name separator. List may contain new line and return characters.
// See examples at the end of the script
//
// Option in script for getting both first and last name
let>lastNameOnly=yes
//
// Set separator between names in in output line and option to include first names
let>sepaResult=,
// in case LF CR are end of name symbols, replace these by sepaForEOL
let>sepaForEOL=}
// copy raw list form last active app and get it in CastAll
press CTRL
send>c
wait>0.2
release CTRL
GetClipBoard>castAll
// change return and linefeed so they look like an end separator
concat>castAll,sepaEnd
StringReplace>castAll,CR,sepaForEOL,castAllX
StringReplace>castAllX,LF,sepaForEOL,castAll
// find begin and end of name seperator in list ( can be , . ; :)
**BREAKPOINT**
MidStr>castAll,1,1,sepaBeg
// if selection starts with an Alfa character, both begin end are spaces
let>pattern=([a-zA-Z])
RegEx>pattern,sepaBeg,0,dummy,nFound,0
if>nFound<>0
let>sepaBeg=Space
let>specialSepa=1
endif>
// and find first symbol, assume that is a end of name separator
let>pattern=.{3,3}([,\.\(;:\}])
RegEx>pattern,castAll,0,seperators,nFound,0
MidStr>seperators_1,4,1,sepaEnd
// split cast in artist names array
// first handle (escape) seperators that have special meaning in regex
**BREAKPOINT**
if>sepaBeg=(
let>escBeg=\%sepaBeg%
else>
let>escBeg=sepaBeg
endif>
if>sepaEnd=(
let>escEnd=\%sepaEnd%
else>
let>escEnd=sepaEnd
endif>
let>pattern=(%escBeg%.*?%escEnd%)
RegEx>pattern,castAll,0,names,nCast,0
let>castOut=
let>num=0
// concatenate all last names into the out string
while>num<nCast
**BREAKPOINT**
let>num=num+1
let>nameCur=names_%num%
// replace start of name symbol, end of name symbol ans trim lead/trailing spaces
if>sepaBeg<>space
StringReplace>nameCur,sepaBeg,,nameCur
endif>
StringReplace>nameCur,sepaEnd,,nameCur
Trim>nameCur,nameCur
if>lastNameOnly=yes
// get last name only if requested by option
let>pattern=.*?(\s+|$)
RegEx>pattern,nameCur,0,firstLastName,nFound,0
let>nameCur=firstLastName_%nFound%
endif
// and builf output tsring
let>castOut=%castOut%%nameCur%%sepaResult%
endwhile>
// if eol substitue present replave by space
StringReplace>castOut,sepaForEOL,Space,castOut
Let>MSG_STAYONTOP=1
Let>INPUT_TIMEOUT=0
Let>INPUT_PASSWORD=0
Let>INPUT_BROWSE=0
Input>castOut,edit,castOut
PutClipBoard>castOut
//
// Example:Ennani by G. Verdi Dalyvauja V. Urmana, L. Tézier, M. Giordani, C. Faus,
// M. Cornetti, A. Rosalen. Dirigentas R. Palumbo,
// the text selected as input would have to start at the space before Urmana
// output: Urmana,Tézier,Giordani,Faus,Cornetti,Palumbo,
//
// Example personaggi ed interpreti: sì: margherita vivian, sopr; vera: amelia felle,
// sopr; palmira: marina gentile, msopr; luciano di chablis: mauro nicoletti,
// ten; cleo de mérode: antonio comas, ten; romal: giulio liguori,
// bs; orch sinf del cantiere internazionale d'arte di montepulciano e coro "symbolon
// ensemble" dir. sandro sanna - m° del coro: donato martorella (reg. 1987)
// the text selected would start at the colon
// output: vivian,felle,gentile,nicoletti,comas,liguori,
//
// Example: Mit Nicola Alaimo (Guillaume Tell), Helena Rasker (Hedwige), Eugénie Warnier (Jemmy),
// Marina Rebeka (Mathilde), John Osborn (Arnold Melchtal) u. a.
// Chor und Orchester der Netherlands Opera; Dirigent: Paolo Carignani
// the text selected as input would have to start at the space after Mit (before the first name Nicola)
// output: Alaimo,Rasker,Warnier,Rebeka,Osborn,
//
// Example:
//
//
//Doña Luisa, the Indian Queen... Julia Bullock
//Doña Isabel..................... Nadine Koutcher
//Ixbalanque..................... Christophe Dumaux
//Mayan hero.................... Vince Yi
//Don Pedrarias................. Markus Brutscher
//Don Pedro de Alvarado......... Noah Stewart
//Mayan Priest.................. Luthando Qave
//Leonor......................... Maritxell Carrero
//Mayan gods..................... Burr Johnson
// the text selected as input would have to start at J of Julia
// output: Bullock,Koutcher,Dumaux,Yi,Brutscher,Stewart,Qave,Carrero,Johnson,Kitamura,Scranton,Singh,Williams,