home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Magazine 28 Bonus
/
CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin
/
data
/
shared.dir
/
03105_Script_PRINTING
< prev
next >
Wrap
Text File
|
1996-06-21
|
6KB
|
156 lines
-- --------------------------------------------------------------
-- Handler printTextFromMac
on printTextFromMac theText
set charsPerLine = 85
set linesPerPage = 45
set charsPerPage = charsPerLine * linesPerPage
openXObjHandler "print_X XObj"
put print_X(mnew) into printObj
set titleStyle = 1 -- bold
set titleSize = 18
set titleFont = "Times"
set hdrStyle = 0 -- normal
set hdrSize = 10
set hdrFont = "Times"
set hdrText = "Artrageous! ⌐1995 SoftKey International, Inc. Page #"
printObj(mSetHeaderStyle2,titleFont,titleSize,titleStyle)
printObj(mSetJustify2, 0) -- centered
-- setting the "footerText" above the title because it doesn't seem to print as a footer
printObj(mSetHeaderStyle1,hdrFont,hdrSize,hdrStyle)
printObj(mSetJustify1, 1) -- left
printObj(mSetBodyTop, 90)
printObj(mSetBodyJustify, 1) -- left
printObj(mSetBodyStyle, "Times", 12, 0)
printPages(theText, charsPerPage, printObj, hdrText)
printObj(mDispose)
closeXObjHandler "print_X XObj"
end
-- --------------------------------------------------------------
-- Handler printPages to be used by both the mac and the pc after
-- specific properties for each have been set.
on printPages theText, charsPerPage, printObj, hdrText
-- get the number of chars in the text
set charsInText = the number of chars in theText
-- based on the number of chars per line and the number of lines
-- per page, get the number of pages to print.
set numPagesToPrint = charsInText / charsPerPage
if (charsInText mod charsPerPage >= 1) then
set numPagesToPrint = numPagesToPrint + 1
end if
set firstCharInPage = 1
-- print the pages one at a time
repeat with currentPage = 1 to numPagesToPrint
-- make sure the page end does not interrupt a word
set lastCharInPage = currentPage * charsPerPage
set Done = FALSE
repeat while not(Done)
set whichChar = char lastCharInPage of theText
if ((whichChar <> " ") and (whichChar <> EMPTY)) then
set lastCharInPage = lastCharInPage + 1
else
set Done = TRUE
end if
end repeat
-- get the text of the current page
set currentPageText = char firstCharInPage to lastCharInPage of theText
-- store the text of the current page in a text cast member
put currentPageText into field "printText"
-- print the page (print the title of the topic for the first page only)
if (currentPage = 1) then
printObj(mPrintPage, hdrText & string(currentPage),the text of field "Topic Title",the text of cast "printText", "", 128)
else
printObj(mPrintPage, hdrText & string(currentPage), "",the text of cast "printText", "", 128)
end if
-- set the first character of the following page
set firstCharInPage = lastCharInPage + 1
end repeat
end
-- --------------------------------------------------------------
-- Handler printTextFromPC
on printTextFromPC theText
openXObjHandler "print_X.dll"
put print_X(mnew) into printObj
set charsPerLine = 75
set linesPerPage = 40
set charsPerPage = charsPerLine * linesPerPage
set titleStyle = 1 -- bold
set titleSize = 18
set titleFont = "Times"
set hdrStyle = 0 -- normal
set hdrSize = 10
set hdrFont = "Times"
set hdrText = "Artrageous! ⌐1995 SoftKey International, Inc Page #"
printObj(mSetHeaderStyle2,titleFont,titleSize,titleStyle)
printObj(mSetJustify2, 0) -- centered
printObj(mSetHeaderTop2,20)
-- setting the "footerText" above the title because it doesn't seem to print as a footer
printObj(mSetHeaderStyle1,hdrFont,hdrSize,hdrStyle)
printObj(mSetJustify1, 1) -- left
printObj(mSetHeaderTop1,5)
printObj(mSetBodyTop, 80)
printObj(mSetBodyJustify, 1) -- left
printObj(mSetBodyStyle, "Times", 12, 0)
printPages(theText, charsPerPage, printObj, hdrText)
printObj(mDispose)
closeXObjHandler "print_X.dll"
end
-- --------------------------------------------------------------
-- Handler print_X(mDescribe)
-- I mNew
-- SSSSSI mPrintPage, hdr1, hdr2, bodyText, pictRsrcPath, rsrcID
-- SSSSSI mPrintFile, hdr1, hdr2, bodyTextPath, pictRsrcPath, rsrcID
-- XI mSetHeaderMargin, margin -- set the margin for the headers
-- XII mSetBodyTextMargin, left, right -- set left and right margin of the body text
-- XI mSetHeaderTop1, topPosition -- set the upper start point for header 1
-- XI mSetHeaderTop2, topPosition -- set the upper start point for header 2
-- XI mSetJustify1, j -- set the justification for header 1
-- XI mSetJustify2, j -- set the justification for header 1
-- XSII mSetHeaderStyle1, fontName, size, style -- font style for header 1
-- XSII mSetHeaderStyle2, fontName, size, style -- font style for header 2
-- XI mSetBodyTop, topPosition -- set the upper start point for body
-- XI mSetBodyJustify, j -- set the justification for the body text
-- XSII mSetBodyStyle, fontName, size, style -- font style for main body text
-- XI mSetPictTop, topPosition -- set the upper start point for image
-- To print a string, or text castmember, use mPrintPage
-- gXObject(mPrintPage, "h1", "h2", the text of cast "scheherazade", the pathName & "picts", 128)
--
-- To print a file (perhaps created using fileIo), use mPrintFile
-- gXObject(mPrintFile, "h1", "h2", the pathName & "tempFile", the pathName & "picts", 128)
--
-- Remember that pictRsrcPath is the full path to a resource file (not PICT file)
-- If no picture is desired then use "" for pictRsrcPath
--
-- For text and header justification : 0=center, 1=left, 2=right
-- For text and header style : 0=normal, 1=bold, 2=italic, 4=underline (add to combine)