Hello all,
With the help of this group my envelop printing script is now as
follows. I am planning to use this within Appleworks 6. This script
runs fine from within the "script editor" with an address select
in an AW6 do***ent. However when I copy the script to the appleworks
script folder as an application it fails as follows:
While executing the script "Print Seolection.app",
the scripting system re****ted that the application
"AppleWorks 6.2.9" encountered error -1727:
"Expected a reference"
Regards Fergus.
property envelopedoc : ""
if FileMissing(envelopedoc) then
set envelopedoc to choose file with prompt "Please select the
envelope template to use"
end if
on FileMissing(someFile)
try
set someFile to (someFile as text)
set anAlias to (someFile as alias)
return false
on error
return true
end try
end FileMissing
tell application "AppleWorks 6.2.9"
activate
try
set selectedText to selection of front do***ent
if length of selectedText is less than 20 then
say "Nothing worth printing"
return
end if
set the clipboard to selectedText
open envelopedoc
set envelopename to name of front do***ent
select do***ent envelopename
paste
select text of do***ent envelopename
set font of selection to "Helvetica"
set size of selection to 15
print front do***ent with print dialog
close do***ent envelopename without saving
on error theerror
close do***ent envelopename without saving
display dialog theerror
display dialog "Unable to print envelope." buttons {"OK"}
default button "OK" with icon 0
end try
end tell