/* $VER: RememberOpenDrawers.rexx 1.1 (29.03.2014) © 2014 Rob Cranley ARexx script to open drawer windows saved previously */ /* Configuration */ remember_until_forgotten=1 remember_window_positions=1 add_tools_menuitems=0 /* Set remember_until_forgotten to 0 if you want the script to forget the open windows automatically on each startup. Set it to 1 if you want the script to remember the open windows until you tell it to forget, or remember another set of open windows. Set remember_window_positions to 1 if you want the script to remember also the size and positions of the open windows. Set it to 0 to use the default positions and sizes (from Workbench's snapshot function). See the documentation for a full description. Set add_tools_menuitems to 1 if you want this script to automatically add the required items to the Tools menu. Set it to 0 if you want to manually add menu items using THE, or some other custom method (e.g. dockies). */ /* No need to edit the rest! */ OPTIONS FAILAT 11 SIGNAL ON syntax IF add_tools_menuitems=1 THEN DO ADDRESS WORKBENCH MENU ADD NAME remember_drawers TITLE '"Remember Open Drawers"' CMD 'REXX:SaveOpenDrawers.rexx' IF remember_until_forgotten=1 THEN DO MENU ADD NAME forget_drawers TITLE '"Forget Open Drawers"' CMD 'REXX:ForgetOpenDrawers.rexx' END END IF OPEN("File","S:SavedDrawers.list","READ") THEN DO wcount=0 DO WHILE ~EOF("File") wline=READLN("File") IF wline~=="" THEN DO wcount=wcount+1 wlist.wcount.name=wline wlist.wcount.x=READLN("File") wlist.wcount.y=READLN("File") wlist.wcount.w=READLN("File") wlist.wcount.h=READLN("File") END END /*SAY wcount*/ dummy=CLOSE("File") IF wcount>0 THEN DO DO i=1 TO wcount /*SAY "Attempting to open "wlist.i*/ 'WINDOW windows "'||wlist.i.name||'" OPEN' IF remember_window_positions=1 THEN DO CHANGEWINDOW LEFTEDGE wlist.i.x TOPEDGE wlist.i.y WIDTH wlist.i.w HEIGHT wlist.i.h END END END END IF remember_until_forgotten=0 THEN DO IF EXISTS("S:SavedDrawers.list") THEN DO /*ADDRESS COMMAND*/ DELETE "S:SavedDrawers.list" END END EXIT syntax: Say "Error occurred - Error code "ERRORTEXT(rc) EXIT