milton@ccu.umanitoba.ca (David Milton) (03/05/90)
Is there any way that one can "Trap" the opening of a script?
What I want to do is provide a short script which traps the opening
of all scripts and inserts/changes the first few lines of the script
to indicate the date of the change. This would allow better tracking
of changes to the script.
The script below works for any script that I have tried but only if
the edit command is typed into the message box. I want to be able to
trap "Cmd Option S/B/C" or clicks used to edit scripts of buttons and
fields. I would also like to trap "edit" from the info box but I rarely
use this feature so it is not as critical.
on edit what,toss,object
global userName
if what contains "script" then
get script of object
if line 1 of it contains "Edit History:" then
repeat with i = 2 to the number of lines of it
if line i of it = "-- End History --"
then exit repeat
end repeat
put i into insertLine
else
put "-- Edit History:" & return^B
& "-- End History --" & return before line 1 of it
put 2 into insertLine
end if
put "-- Edited "&& the short date &","& the short time^B
& return before line insertLine of it
set script of object to it
end if
pass edit
end edit
Has anyone got any ideas on how this may be done easily?
Can this be done without changes to HyperCard?
Reply by mail and I will summarize (eventually) for the net.
Thanks in advance,
Dave Milton
<milton@ccu.UManitoba.CA>