Amiga Format article

One day when I was on my way to the train, I stopped at the newspaper shop. I was looking for something to read on the train. When I saw the front page of AMIGA FORMAT I was very surprised! In big writing on the cover disk it said "Selector - the easiest way to create your own toolbars". I looked in the magazine and found one full page and 1/3 page about my own program "Selector"... When you have read this article, you can imagine how great I felt on that trip.


AMIGA FORMAT MARCH 1998 - page 104
Many people have toolsdaemon or similar programs, launchpads and the like.

Selector is something quite different and can be used to work in conjunction with those types of programs or simply by itself.

Selector is a simple command that takes its information from a text file. The text file uses commands native to Selector to easily set up buttons and requesters so you can quickly build an interface or a menu that does just about anything. You can even build ones that are dynamic and run Selector scripts that they make on the fly, like listing a directory and creating a set of buttons for the programs (see below).

The program is so easy to use that you can have your first project up and running in under a minute.

First of all, run the SelectorFont program to choose the font you want to use in your Selector projects. Now you need to copy the Selector command to your C: and then you need to open

 
a text editor. You can use the Amiga's native Ed if you want. Simply open a Shell and type "ed ram:test.sel {return}" and it will open the editor and create the file for you.

Now type in the following commands:
Text "Amiga Format is cool"
Button "Exit" Exit
Save the file and then type into the Shell selector ram:test.sel {return}.

Buttons have the power to load other Selector scripts or AmigaDOS scripts, which is what makes this so powerful. You can easily make a program that asks if you want to launch your custom programs each time you start up.

Move your programs out of your WBStartup drawer into one called Start. This is not a default drawer so you can call it what you want as long as you follow the name through in the following example. Create a file in your text editor called S:Programns.dos. (the .dos isn't necessary, but it's useful for remembering that this is an AmigaDOS script rather than a Selector script). Now type:
list >ram:start.sel sys:start pat ~(#?.info) files lformat "run >nil: sys:start/%n"
selector s:programs.sel
and save it. This is the AmigaDOS script that scans the directory for which programs are there and launches a Selector script.

 
We now have to write the Selector script. Create a file called S:Programs.sel and enter:
Gap 6
Text "Welcome, Would you like to run your WBStartup programs?"
Startbox
Button "Yes" "execute ram:start.sel"
Endbox
Button "No" Exit
and save this file. Now we can test it by typing into Shell "execute s:programs.dos ".

As you can see from the Seleclor script, we've done some new things here. We used the Gap command to say how many pixels we wanted between each button and we used the box commands to put a box around the first button. To make the script more powerful, go back to the AmigaDOS script Programs.dos and change it to:
list >ram:start.sel sys:start pat ~(#?.info) files lformat "run >nil: sys:start/%n"
list >ram:which.sel sys:start pat ~(#?.info) files lformat "button *"%n*" *"run >nil: sys:start/%n*""
selector s:Programs.sel
delete ram:start.sel
delete ram:which.sel

Now change the Selector script Programs.sel to:
Gap 6
Text "Welcome! Would you like to run your WBStartup programs?"
Startbox
Button "All" "execute ram:start.sel"
Endbox
Button "Choose individual programs to launch" load ram:which.sel
Button "No" Exit

This script now has an extra button. The second line of the AmigaDOS script


AMIGA FORMAT MARCH 1998 - page 105

creates a new Selector script, which will change if the contents of the directory change because the Selector script is created every time the AmigaDOS script is executed. The AmigaDOS script creates a line in a Selector script for each program, inserting the button command in for Selector so when you click on the "Choose..." button in the Selector run script it has a button for each program. There is also the code in each line to run the corresponding program.

When you click on a button the program is run. You may not want to use WBStartup programs for this exercise as they are specifically designed to run from Workbench and we are forcing

 
them to run from Shell, but you could use part of this script for other things.

Use the part that lists the programs for Selector buttons and choose a folder containing your Utilities or Tools:
list >ram:which.sel dh1:tools pat ~(#?.info) files lformat "button *"%n*" dhl:tools/%n"
selector ram:which.sel
delete ram:which.sel

Now enter the command line execute S:programs.dos (or whatever you called the script) into your Toolsaemon-type program. You now have a line that launches the DOS script to scan the Tools directory and then launches Selector to display whatever

 
programs there are and the buttons for them. If you add or remove programs from that folder, you don't need to change the script as it will do it for you.

There are many more commands that Selector uses and you can do an amazing amount of interesting and varied things with it. For example, if you write your own Selector scripts rather than having them written on the fly, you can vary colours, headings, button types, use input and more. All the author asks is that you let him know you are using it and send him something. His address is in the documents with a list of all the commands and their uses, a beginner's tutorial and some sample files.

AF


Back to Selector - Article about BorayLetter (in Swedish)