[futurebasic] Re: [FB] FB3 - the Book beta 0.5

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2000 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Fri, 12 May 2000 07:49:44 -0400
Joe Lewis Wilkins wrote (with slight modification in URL):

>  The latest beta is up. Some rather major changes have been
>  made, though not fully implemented.
>
>  For the curious, or concerned:
>
>  http://www.geocities.com/anderskarlkeller/fb_book.html


Dear Joe,

Thank you so much. The Book is a wonderful piece of work! I have been 
extremely busy the last two months with a large construction project, 
and really won't get a break until after the weekend after next. But 
as soon as I get some time, I hope to forward you some of my favorite 
code samples for consideration for inclusion in the book.

I notice the list has been quiet lately. Perhaps now would be the 
time to dig into your code archives and forward Joe some of your 
favorite samples.

In light of Bob Krueger's inquiries concerning the FBII "killer 
program" some prankster wrote, here are two short machine code 
snippets that will either shutdown or restart a Mac directly from 
FB^3 without calling an Apple Event from an external script:

/*
This code shuts down and restarts a Mac
in the same way as going to the Restart menu
Ken Shmidheiser
Somerset, KY
5-12-2000
*/

LOCAL MODE
LOCAL FN ShutDwnStart
` DC.W $3F3C,$0002,$A895
END FN

WINDOW 1, "Restart", (0,0)-(250,120),_docNoGrow

PRINT
PRINT "This Mac will restart in five seconds..."
PRINT

y$ = " ..."

FOR x = 5 to 1 STEP -1
PRINT x; y$
DELAY 1000
NEXT

CLS
PRINT
PRINT "Restarting. Bye!"
DELAY 500

FN ShutDwnStart

DO
HANDLEEVENTS
UNTIL 0
END


/*
This code shuts down a Mac in same
way as going to the Shutdown menu
Ken Shmidheiser
Somerset, KY
5-12-2000
*/

LOCAL MODE
LOCAL FN ShutDwnPower
` DC.W $3F3C,$0001,$A895
END FN

WINDOW 1, "Shutdown", (0,0)-(250,120),_docNoGrow

PRINT
PRINT "This Mac will shutdown in five seconds..."
PRINT

y$ = " ..."

FOR x = 5 to 1 STEP -1
PRINT x; y$
DELAY 1000
NEXT

CLS
PRINT
PRINT "Shutting down. Bye!"
DELAY 500

FN ShutDwnPower

DO
HANDLEEVENTS
UNTIL 0
END


These also can be called as TOOLBOX functions from FB^3. (Hint: Look 
at the Tblx Shutdowns.Incl in the headers file and read about TOOLBOX 
functions in the help manual.)

I mention these to show just how powerful a single line of machine 
code can be. Maybe these would be useful in The Book (the routines 
also demonstrate a simple FOR/NEXT loop with a negative STEP for a 
countdown). But remember, if executed they will restart or shutdown 
not only The Book, but also the machine!

In a Quark list I subscribe to, there has been a lot of talk 
concerning-- of all things-- ways a Mac can be crippled with 
Applescripts. This discussion, complete with code snippets, is an 
aftermath of the Love virus and its variants in the WinTel world. I'm 
of the same mind as Matt Beedle: I almost hate to discuss in public 
methods of handling file deletion, etc., from FB^3 for fear the 
knowledge will end up in the wrong minds.

Apparently some people have too much time on their hands.

Ken