How to make a script runnable |
Advanced topics | |
1. Introduction
2. Under Windows (9x, NT, 2000, XP)
3. Under Unix
1. Introduction
If you're using aptilis for administrative jobs, you might
be tired of typing:
\aptilis\aptilis.exe scriptName.e.txt
Wouldn't it be nice to just type something like:
scriptName ?
It can be done, but it's a slightly differently trick under Windows than
it is under Unix.
We will use the following example (hello.e.txt) in both cases:
sub main(args[]) print("That's my programm\n") print("Neat, eh?\n") end main |
2. Under Windows
In both cases we need to call the interpreter.
Here is how we do it under Windows:
First we need to change the code slightly:
@echo off \aptilis\aptilis.exe hello.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 goto fin sub main(args[]) print("That's my programm\n") print("Neat, eh?\n") end main :fin |
This works because aptilis won't run anything outside
a sub, so we can put what we want around them.
Unfortunately, unlike with Unix, this trick won't work for
web scripts, although the people from
Imatix who do the Xitami
web server assure me that the Windows version of their product
understands the #! trick as well as the Windows version of the Apache Web Server does.
3. Under Unix
First, the program needs to be modified:
#!/HostedWebSites/glaine/cgi-bin/aptilis.exe sub main(args[]) print("That's my programm\n") print("Neat, eh?\n") end main |
This works because aptilis won't run anything outside
a sub, so we can put what we want around them.
The good thing about that is that the trick also works
for web scripts, and you can call your script directly in the
action parameter of your form tag, and no hidden file
needs to be passed.