I've found a solution, I build the script and then execute it a line
at a time using the following handler:
on doScript theScript
repeat with i = 1 to number of lines in theScript
do line i of theScript
end repeat
end doScript
In case anyone is interested the following is the script I use to set
up the stack parameters:
on getParams
global gProgPath, gProgName, gProgVersion
if word 2 of the environment is "Development" then
# developer mode uploads control params from control file into
custom property:
put gProgPath & "control.txt" into controlFile # gProgPath is
path of this stack
if there is a file controlFile then
open file controlFile
read from file controlFile until eof
close file controlFile
set the ControlParams of this stack to it
end if
end if
# always actually get params from custom property:
put the ControlParams of this stack into ctrlParams
put empty into makeParamsScript
set itemDelimiter to "="
repeat with i = 1 to number of lines in ctrlParams
put line i of ctrlParams into paramLine
if first char of paramLine <> ";" and paramLine is not empty then
put item 1 of paramLine into theParam
put item 2 of paramLine into theValue
put "global " & theParam & ";" after makeParamScript
put "put " & quote & theValue & quote & " into " &\
theParam & return after makeParamScript
end if
end repeat
set itemDelimiter to comma
if makeParamScript is not empty then
doScript makeParamScript
end if
if word 2 of the environment is "Development" then
set the title of this stack to gProgName && gProgVersion
end if
end getParams
This allows me to use a control file ('control.txt') in the
development environment that loads its details into a custom stack
property called "ControlParams". Whenever the stack is run outside
of the development environment, it reads the control params from this
custom property instead of the control file itself. The control file
reading element of the script ignores blank lines and lines beginning
with ";". An example control file contents is as follows:
; Control Params for CBT
gProgName=On-line Training Package
gProgVersion=v0.1
gProgDate=23 Nov 1999
gProgAuthor=Peter Reid
; Upload directories (all relative to stack directory):
gGenUploadsDir=Uploads
; File names (files found in Uploads directory):
gDescripFile=description.txt
gFaqFile=faq.txt
; Password for access to admin features:
gAdminPwd=LetMeIn
gToolTipDelayMilliSec=750
Sorry to have bothered people, I hope the above proves of interest.
Best regards
Peter
--------------------------------------------------------
Peter Reid
Reid-IT Limited, Loughborough, Leics., UK
Tel: +44 (0)1509 268843 Fax: +44 (0)1509 264986
E-mail: [EMAIL PROTECTED]
Web: http://www.reidit.co.uk