Cierre todas las revistas con una excepción.Estoy buscando una línea de código de script que me permita cerrar todos los diarios abiertos, excepto una ventana.
Acutalmente, la extracción de la lista de nombres correcta no funciona. Entonces no es posible hacer coincidir el nombre del diario que debe permanecer abierto. Ver abajo script ***.
CloseAllJournalsExcept = Function( {},
JournalName = "StaysOpen";
For( i = N Items( Window() ), i > 0, i--,
If( Window( i ) << GetName != JournalName, //***
Window( i ) << close window()
)
);
);
Gracias.
Re: cierre todas las revistas con una excepción
Utilizar findAll (revistas) para hacer una lista de revistas y usar loc () para ayudar a eliminar al guardián de la lista. Luego envía el Cerrar ventana comando a la lista. A continuación, el icono bloqueado se agrega a cada diario para indicarle a JMP "este diario está bloqueado, cree otro diario la próxima vez, en lugar de agregarlo a este". De lo contrario, es difícil hacer un montón de revistas. Las revistas también están marcadas setDirty (0) así que no hay un aviso al cerrarlos. Es posible que no desee eso para el que mantiene abierto.
myJrns = {};
For( i = 1, i <= 5, i += 1,
w = New Window( Char( i ), V List Box( Text Box( Char( i ) ) ) );
j = w << journalwindow;
w << closewindow;
j[Text Box( 1 )] << sibAppend( Icon Box( "Locked" ) ); // locked: just to make a new window each time
Insert Into( myJrns, j );
);
myJrns << setDirty( 0 ); // these were just created, make it easy to close them
// get a list of all open journals
alljournals = Find All( Journals );
// close all but the 2nd one just created...
// myJrns[...] is the list of journals just created
// myJrns[2] is the 2nd one that we decide to keep
// the allJournals list might be in a different order, so
// use loc() to find the matching index in allJournals
keeper = Loc( alljournals, myJrns[2] ); // returns a matrix
keeper = keeper[1]; // was a matrix of one element, now a scalar
// modify the allJournals list so we can close all of its items
Remove From( allJournals, keeper ); // remove the keeper from the list
allJournals << closewindow; // closes all the journals that remain in the list