Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

nkuitse (193)

  (email not shown publicly)

Journal of nkuitse (193)

Saturday November 22, 2003
09:54 AM

HyperCard and shell scripting

[ #15942 ]

So I have this HyperCard stack that serves as a CGI backend...

It runs on the 1GHz G4 server that sits in my office, about 18 inches from my computer.

Both machines run Mac OS X. HyperCard runs in Classic (of course).

Since my HyperCard stack requires hands-on intervention any time something goes wrong or I need to make any changes, I find myself scuttling back and forth from time to time.

Needless to say, cutting and pasting from one to the other is out of the question (well, I suppose I could use pbpaste and scp). Writing custom scripts for ad hoc reports, etc. is a problem because the stack runs as a standalone; hence you can't just pull up a card script and edit it.

So I wrote this little shell script...

if [ -z "$1" ]; then
    args=$(cat <&0)
htscript=$( { echo 'lock error dialogs'; echo "$args"; } \
    | perl -pe 's/\n/\\r/g; s/"/\\"/g' )
echo "tell app \"tls.cgi\" to do script \"$htscript\"" \
    | osascript | perl -pe 's/\r/\n/g'

(tls.cgi is the name of the standalone stack.)

And now I can ssh into the server and do things like this:

% tls return number of cds in bg 1

% tls >recipes.txt
put "" into reports
repeat with i = 1 to number of cds in bg "Recipes"
  put (bg fld "Title" of cd i) & return after reports
end repeat
return reports

% tls 'return somethingOrOther()' | grep ...

HyperCard is dead! Long live HyperCard!

(Next up: remote script editing using BBEdit!?)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.