/* ** LoadSession V1.1 ** ---------------- ** ** Enables Sessions for FinalWriter. ** ** After running, it will pop up a requester, where the user can select, if he ** wants to load the default session, an alternate session or nothing. ** ** If user selects the default session, it just loads "sessions/default.ses" and ** jumps to the document. ** ** If user selects "alternate", he must select the session, he wants to work with. */ OPTIONS RESULTS /* some constants */ envname = "ENV:FWSessions" /* This env-var holds the dirname of the sessions */ dirname = "T:FinalWriter/Sessions" /* preferences of dirname */ NL = '0A'x filename = 0 pubscreen= "FinalWriterPubScreen" /* -------------------------------------------------------------- ** The various textelements for FW_LoadSession.rexx ** Try to translate it into your foreign language. ** --------------------------------------------------------------- */ /* requester texts for initial requester */ ls_body1 = NL || "Do you want to work with the last saved or" || NL || "with an alternate session?" || NL ls_gg1 = "_Last|_Alternate|_Cancel" ls_title1 = "FinalWriter - Load session" /* requester texts for the filerequester */ ls_title2 = "Please choose the session to load:" ls_ok = "_Load session" /* requester texts for the error requester */ ls_error1 = "Couldn't get access to the session!" ls_error2 = "Couldn't get access to the enviroment variable 'ENV:FWSessions'"||NL||"Using defaults."||NL /* ----------------------------------------------------------- ** The german texts ** ----------------------------------------------------------- */ ls_body1 = NL || "Wollen Sie an der zuletzt gesicherten oder" || NL || "an einer alternativen Sitzung weiterarbeiten?" || NL ls_gg1 = "_Letzte|_Alternative|Abbru_ch" ls_title1 = "FinalWriter - Sitzung laden" ls_title2 = "Bitte wählen Sie die zu ladene Sitzung:" ls_ok = "Sitzung _laden" ls_error1 = "Konnte nicht auf Sitzung zugreifen!" ls_error2 = "Konnte enviroment variable 'ENV:FWSessions'" ||NL|| "nicht finden."||NL||"Verwende Voreinstellung." ||NL /* Try to load rexxreqtools.lib */ if ~(Show("l","rexxreqtools.library")) THEN AddLib("rexxreqtools.library",0,-30,0) /* Try to get FINALW.port */ if (LEFT(ADDRESS(), 6) ~= "FINALW") THEN /* not started by FinalW */ address 'FINALW.1' /* Try to get the enviroment variable for the directory of the sessions */ if open( rdat, envname, 'R' ) ~= 0 then do dirname = readln( rdat ) close( rdat ) end else do call rtezrequest( ls_error2,, ls_title1, 'rtreqpos=reqpos_centerscr rtpubscrname='||pubscreen) end call rtezrequest( ls_body1, ls_gg1, ls_title1, 'rt_reqpos=reqpos_centerscr rt_pubscrname='||pubscreen,) if (rtresult = 0) THEN exit 0 if (rtresult = 1) THEN filename = dirname || "/default.ses" else do filename = rtfilerequest(dirname,, ls_title2, ls_ok, 'rtfi_matchpat=#?.ses rt_pubscrname='||pubscreen) if rtresult = 0 then exit 10 end /* Now open the desired filename */ if open( rdat, filename, 'R' ) = 0 then do call rtezrequest( ls_error1,, ls_title1, 'rt_reqpos=reqpos_centerscr rt_pubscrname='||pubscreen) exit 10 end else do path = readln( rdat ) section = readln( rdat ) parapos = readln( rdat ) sc = close( rdat ) Open path /* Open saved document */ GoToSection section /* Move to saved section */ MoveToPara parapos /* jump to saved paragraph */ end exit