Part of the Samples Website. 8/16/97.

samples.basicStuff.removingSource

«Exports a table of compiled scripts, source code removed
«then saves the table out to disk, ready for importing into your users' systems
«first, we copy the table into a local
«then we traverse the table, removing the source from all scripts
«then we export the object, so that it loads in at the original table's address
«when you re-import the table, it will be loaded **over** the original
«but when users load it in, it will behave exactly like the original
«please be careful using this script on your system!
local (adrTable = @samples.lists) «change this address to export a different table
local (f = file.getSystemDisk () + "Compiled Code from Frontier") «change this too
local (localtable)
table.assign (@localtable, adrTable^) «make a local copy of the table
on removeSourceVisit (adrItem)
if typeOf (adrItem^) == scriptType
script.removeSource (adrItem)
return (true)
table.visit (@localtable, @removeSourceVisit)
on sendObject (adr, adrLoadAt, fname)
«this is a customized version of export.sendObject
«it takes two address parameters, instead of one
«adr is the address of the object to export
«adrLoadAt is the address that it's to be loaded at when imported
bundle «save the callimporter script
«this deserves some explanation...
«after the user double-clicks on the file, Frontier.finder2Click will get control
«it copies the 'scpt' resource into the object database at its old location and runs it.
«we copy the script first, so it's old location will be in a local table.
«when the script is loaded, it won't clobber the latest version of the script,
«or collide with another version that is currently running.
local (callimporter)
table.assign (@callimporter, export.callimporter)
export.sendtodesktop (@callimporter, fname)
bundle «double-pack the object at adr into a 'data' resource
local (resdata)
pack (adr^, @resdata)
pack (resdata, @resdata)
rez.putnamedresource (fname, 'data', string (adrLoadAt), @resdata)
return (true)
sendObject (@localtable, adrTable, f)


This page was last built on Sat, Aug 16, 1997 at 6:39:46 PM. You can download the current set of sample scripts from our FTP site. Dave