A question about Workbench

3 posts / 0 new
Last post
OldFart
OldFart's picture
Offline
Last seen: 4 months 6 hours ago
Joined: 2010-11-30 14:09
A question about Workbench

Hi,

Workbench has the following behaviour:
When a window is opened for a second or more time, it is positioned (x,y-coordinates) at the same place it was at the previous time (in the meantime no reboot applied af course). Workbench seems somehow to 'remember' that position and store that info in one of its many lists.

My question:
Where and how is that information stored and how is it accessible?

Any info will be appreciated, but preferably not that it is not known...

OldFart

thomas
thomas's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2011-05-16 14:23
Re: A question about Workbench

All properties of a drawer are kept in the drawer's icon. As long as the icon is visible, Workbench keeps a copy of it in memory.

So for example if you open Workbench and in it open Utilities, as long as Workbench is open, everything you do with Utilities is remembered and the window opens where you closed it. But if you close both and then open Workbench and Utilities again, the latter will open where it was saved and not where it was before.

I don't think you can access this information from a foreign program. If you can, then probably using WorkbenchControl().

hypex
hypex's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-09-09 16:20
Re: A question about Workbench

I just found a file which looks like it may help. SaveOpenDrawers.rexx. From here:
http://aminet.net/package/util/wb/RememberOpenDrawers

It may be for OS3.9. But I found it on my UAE setup. Works on OS4 but here is the source:

  1. /*
  2.   $VER: SaveOpenDrawers.rexx 1.0 (18.02.2012) © 2012 Rob Cranley
  3.   ARexx script to save open drawer windows for reopening later
  4. */
  5.  
  6. /* Configuration */
  7.  
  8. snapshot_windows=0
  9.  
  10. /*
  11.   Set snapshot_windows to 1 if you want the script to snapshot window size
  12.   and position for every open window.
  13.   Set it to 0 to ignore positions or use the built-in remember function. See
  14.   the documentation for a fuill description.
  15. */
  16.  
  17. /*SIGNAL ON syntax*/
  18.  
  19. OPTIONS RESULTS
  20. ADDRESS WORKBENCH
  21.  
  22. GETATTR windows STEM wlist
  23.  
  24. IF OPEN("File","S:SavedDrawers.list","WRITE") THEN DO
  25. IF wlist.count>0 THEN DO
  26. DO i=1 TO wlist.count-1
  27. dummy=WRITELN("File",wlist.i)
  28. 'GETATTR window.left NAME "'||wlist.i||'"'
  29. dummy=WRITELN("File",result)
  30. 'GETATTR window.top NAME "'||wlist.i||'"'
  31. dummy=WRITELN("File",result)
  32. 'GETATTR window.width NAME "'||wlist.i||'"'
  33. dummy=WRITELN("File",result)
  34. 'GETATTR window.height NAME "'||wlist.i||'"'
  35. dummy=WRITELN("File",result)
  36. IF snapshot_windows=1 THEN DO
  37. 'WINDOW "'||wlist.i||'" SNAPSHOT'
  38. END
  39. END
  40. END
  41. /*dummy=WRITELN("MyFile","Testing!!")*/
  42. dummy=CLOSE("File")
  43. END
  44. ELSE DO
  45. SAY "Error opening file S:SavedDrawers.list for writing"
  46. END
  47. EXIT
  48.  
  49. syntax:
  50. Say "Error occurred - Error string: "ERRORTEXT(rc)
  51. EXIT
Log in or register to post comments