Is there a way to shorten this script? (100 graphics and 200 lines of text)
Thomas McGrath III
mcgrath3 at mac.com
Tue May 8 15:46:55 EDT 2012
To print using AirPrint you can use the rreHardCopy external from Livecode which is included with you external examples:
Together with a script like this:
if not rreHardcopyIsAvailable() then
answer "Printing is not available at this time." titled "Printing Error"
exit to top
put the short name of this card into tPrintJob
export snapshot from rect (the rect of graphic "PrintArea") of this card to tPNG as PNG
put tPNG into URL ("file:" & specialFolderPath("documents") & "/" & tPrintJob & ".png") --if you want to store it as well
put (specialFolderPath("Documents") & "/" & tPrintJob & ".png") into tPDFFile
rreHardcopyPrintPDF tPDFFile, tPrintJob
if the result = "printing cancelled" then
exit to top
-- Tom McGrath III
3mcgrath at comcast.net
On May 8, 2012, at 2:57 PM, William de Smet wrote:
> Thanks everyone for the contribution!
> I first tried Mark Schonewille's script and that one works immediately.
> My app is almost finished now.
> Now searching the forum for a way to use AirPrint (but that one seems
> sort of impossible at the moment).
> 2012/5/8 Dar Scott <dsc at swcp.com>:
>> Whoops. Still not right. The line number has to go up twice as fast as the object number.
>> This can be done with a separate loop variable or doing some math on the repeat loop variable.
>> It might be easiest to count graphic objects and then calculate the lines as (2*i-1) and (2*i)
>> On May 8, 2012, at 12:38 PM, Paul Dupuis wrote:
>>> repeat with i = 1 to 200 step 2
>>> put "d"&i into tObjectName
>>> set the backgroundcolor of grc tObjectName to the text of line i of fld "in"
>>> set the foregroundcolor of grc tObjectName to the text of line i+1 of fld "in"
>>> end repeat
>>> On 5/8/2012 2:32 PM, John Dixon wrote:
>>>> repeat with i = 1 to 200 step 2
>>>>> set the backgroundcolor of grc "d1" to the text of line i of fld "in"
>>>>> set the foregroundcolor of grc "d1" to the text of line i+1 of fld "in"
>>>>> end repeat
>>> Paul Dupuis
>>> Researchware, Inc.
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode