Making handlers always available on startup

JonathanC at ag.nsw.gov.au JonathanC at ag.nsw.gov.au
Thu Jan 8 07:03:05 EST 2004


I have come to Rev fairly recently from HyperCard. One of the things I 
liked to do in HyperCard was creating custom handlers and having them 
available in any stack. Some of these handlers would refer to other stacks 
(usually in the same folder as the Home stack, so they could just be 
referred to by their short names rather than their full paths). 

The easiest way to do this was to put the custom handlers into the Home 
stack script. A slightly more complicated way was to put them into the 
script of a separate stack and insert this line into the Home stack's 
startup handler: start using stack <stack_name>.

 After a bit of experimentation, I have worked out a way of doing the 
equivalent of this in Revolution: 
1. Put a stack (e.g. "Launcher.rev") into the plugins folder.
2. Configure "Launcher.rev" to open when Revolution starts up.
3. With "Launcher.rev" open, execute 'toplevel this stack' with the 
message box to make the stack editable.
4. Put this handler into the stack script:
on openStack
  insert the script of me into back
  put the filename of this stack into pluginsFldr
  set the itemdel to "/"
  delete last item of pluginsFldr
  set the defaultFolder to pluginsFldr & "/"
end openStack 
5. Paste the custom handler(s) into the stack script.
6. Save the stack.
 
OK it works, but it seems like a very long-winded way of doing what I 
think should be a pretty common thing. Is there an easier way? (I hope 
so.)
Isn't there the equivalent of a default "startUp" handler somewhere (like 
HyperCard's)? If so, I couldn't find it. 
Also, I'm a bit concerned about the lines 3-6 of the openStack handler 
above. It makes the plugins folder the defaultFolder. I'd really like to 
make ANOTHER folder the defaultFolder if possible: the folder where I put 
most of my Rev stacks (currently ~/Documents/Revolution stacks/), so I 
could just refer to stack files by their short names.

Sorry if this question is very basic. 

Thanks,

Jonathan Cooper

Manager of Information / Website
Art Gallery of New South Wales
Sydney, Australia
http://www.artgallery.nsw.gov.au



More information about the use-livecode mailing list