home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
337.lha
/
WBScript
/
WBScript.doc
< prev
next >
Wrap
Text File
|
1990-02-07
|
8KB
|
155 lines
For all those who have ever had a grudge with the Workbench, this program's
for you. Macintosh users are used to point-and-clicking and having it work
every time (except on data files). Remember the time that you thought you
could simply drag a program by its icon onto your hard drive, double-click
it and have it work? There were always library files and assigns and
startup-sequence entries. Until now.
This program lets people with CLI experience make the Workbench idiot-proof
for themselves and others. WBscript lets you place scripts into project
icons. When you double-click the icon, the script is executed from a
console device (CLI) of your choice which has a current directory of the
icon's location, or a directory named in the project icon. In this way,
when you write your scripts, you do not even have to supply path names to
files and the script will still always find them.
Why a put a script into a project icon, you ask? And how can it be
associated with a directory full of stuff? There are several advantages to
placing a script inside a .info file rather than a separate script file.
Any icon will associate itself with a file or directory of the same name
regardless of whether it is the proper type. A project icon will attach
itself to a directory. When you drag it around, it will carry the entire
drawer, but it will not allow you to run the program or open the drawer in
the regular manner.
If you had a program with some related files that you wanted to keep in the
same directory but the program wants to find in your system directories
(terminal programs for instance), you could transform its directory's
drawer icon into a project icon and put the CLI commands in there. The
current directory of the script is whatever directory the icon is in so
that your script can refer to items inside that directory without full path
names. Now, you will be able to pick up the directory and move it wherever
you want while carrying all the related files, but when you double click it
will run the program. With a special tool type entry, you could freely
change the name of the directory and not have it effect the execution of
the script file.
A possible application would be if you had a program that requires some
assigns before it is run. Instead of having a separate script file,
startup-sequence entry, or to type the commands every time, you can
transform the program's tool icon into a project icon and put the assigns
right in there. It is now one integrated package that when double clicked
will run the program properly and when dragged will carry the icon, script,
and program.
Since the commands are true scripts, it is totally appropriate to use "if"
statements. You can create documentation icons that aggressively determine
and use whatever reading utility a person happens to have on their system.
Of course, WBscript will also allow you to do things from the Workbench
which just weren't possible before. CLI-only programs can be attached to
icons and be able to be dragged with them.
A clever Workbench user will be able to assemble packages that will make
them seem to have programming ability. For instance, by putting the
SuperView utility inside a directory with a bunch of pictures, you can run
an entire slide-show by clicking the directory icon and copy the whole
thing to your hard drive by dragging that same icon. People are likely to
never even realize it is not a program they are running. You can put
WBscript inside that directory and set the path to it so that people don't
need to already have the program.
I made a WBScript utility that will attach icons onto all files in a
directory by simply dragging an icon to the drawer from Workbench and
double-clicking it. When you closed the drawer and opened it, there laid
out in neatly placed order were icons belonging to the previously invisible
files. All I used that was not standard Amiga DOS was WBScript and LS, a
versatile listing command with a NOT operator. You can probably figure out
the rest.
You can see WBscript's CLI parameters by typing "wbscript" in a CLI or
shell. Operation should be pretty obvious for anyone who is already
familiar with CLI formats. You can change several things about an icon
from there. If you already have a script file prepared, you can set the
type of the icon to project and load the script into it and be in business
with little work. In order to see the changes you've made from the CLI,
you must remove it from Workbench's view then reintroduce it by closing the
drawer it resides in then reopening it. Now when you do an info on it, you
will see the change.
The script files can be created in any text editor and saved as a file
temporarily. The script can then be transferred into the .info file by
typing from a console:
wbscript load <icon file> <script file>
e.g.: wbscript load Program script
This will load a script named "script" into an icon named Program.info.
You do not use the ".info" extension on the icon names in these CLI
operations.
To implement WBscript, you should copy it to your C: directory and enter
"C:WBscript" as the default tool in project icons. If you didn't put
WBscript in the C: directory, you will have to supply a path name to where
it is.
The way WBscript works is it dumps the icon information into a temporary
file and executes the commands out of that. It writes to a file in your T:
directory called Temp-WBscript(n). If you don't already have your T:
directory assigned to RAM:T, I would recommend it in order to minimize
useless Macintosh-like disk writing.
WBscript needs to refer to a console creating command like newshell,
newcli, or ashell. It defaults to newcli. If you don't have newcli on
your system, you can enter a tool type of:
SHELL=<COMMAND>
e.g.: SHELL=C:Ashell
The shell windows that are created have executed the shell-startup file.
In order to invoke a CLI without a shell-startup being executed, the tool
type entry can be made:
CLI=<COMMAND>
e.g.: CLI=newcli
The size of the console window that WBscript must open can be set to
something other than default by entering a tool type of:
WINDOW=<CONSOLE PARAMETERS>
e.g.: WINDOW=newcon:50/50/400/200/Hello!
One of the most unique and powerful features of WBScript is its ability to
set the current directory for the script that will be executed. This
eliminates the need to use path names in your scripts or to worry about
changing the name of the directory from Workbench. To activate this
feature, make an entry into tool types of:
CURDIR=drawer
In order to debug your scripts, you can closely monitor the execution of
the script by entering a tool type of:
DEBUG=1.
When you have things working properly, you should discard this entry.
It is important to remember that the first half of a tool type entry must
be in ALL CAPITAL LETTERS!
The order of the entry is not important. These entries may be anywhere in
the tool type sequence and have the same results. This also applies to the
order of the script command entries. They are numbered as P0=, P1=, P2=,
etc., and will always execute in their numbered order regardless of their
position in the sequence. So you should feel free to operate right in the
icon info window. Delete and add as you please. Small script files can be
completely entered in this manner. You can number your entries in large
intervals to accommodate future entries like you would in BASIC.
The effect of this program on the Amiga computer overall is very promising.
Those of us who understand scripts can make operations form Workbench
fool-proof, thus eliminating one of the major complaints about the Amiga
(mostly by people who are used to Macs). It does not change anything in
the standard Amiga system; it merely better utilizes what is already there.
It will also eliminate the need for installation programs. The only thing
that will make its full potential come forth, is people putting WBScript in
their C directories and using it. Because of that, I have included a
WBScript application that will copy WBScript into your C directory. To see
what it is doing, do an info on the icon.
If you find this program useful and please send $10 (or whatever) to:
Howard Harrison
418 Centre Avenue
Jeffersonville, PA 19403