[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] graphics with MacPerl



Takeshi Yano mentioned Yves Piquet's "clip2gif" on Mon, 1 Sep 1997 02:17:54
-0400:

>If you want to run a cgi script to dynamically generate graphics
>on the macintosh only, why not look at clip2gif, which is
>AppleScriptable.

The way the "clip2gif" is designed also makes it relatively straightforward
to build AppleEvents. The exmple below is translated (with minor
embellishments) from an AppleScript in the "clip2gif" documentation.

The subroutine to launch "clip2gif" is added for the sake of completeness.
If it is omitted "clip2gif" must be launched by  hand before the script is
run.

I hope this is of interest.

Alan Fry

======================================================================

#!perl
use Mac::AppleEvents;
use Mac::Processes;
use Mac::MoreFiles;

launch_clip2gif();

$str = "Example using AEBuild with clip2gif";

$evt = AEBuildAppleEvent(
    'core', 'save', typeApplSignature, "c2gf", 0, 0,
    qq(
        '----':[120,105], kfil:type(cwin), drwg:[
            {klne:[10, 10, 105, 10], kths:2, colr:[65535,0,0]},
            {klne:[10, 95, 105, 95], kths:2, colr:[65535,0,0]},
            {krct:[10,20,100,80], colr:[13107,62914,65535]},
            {kfrm:[10,20,100,80]},
            {krct:[15,25,105,85], colr:[65535,65535,0]},
            {ktra:[20,35,100,80], pjst:cent, onst:bold,
                                  colr:[0,24576,0], ktxt:"$str"}
        ]
    )
) or die $^E;

$rep = AESend($evt, kAEWaitReply) or die $^E;

#print AEPrint($evt), "\n";
#print AEPrint($rep), "\n";

AEDisposeDesc $evt;
AEDisposeDesc $rep;

sub launch_clip2gif{
    my %Launch = {};
    tie %Launch, LaunchParam;
    $Launch{launchControlFlags} = launchContinue;
    $Launch{launchAppSpec} = $Application{c2gf};
    LaunchApplication(\%Launch) or die $^E;
}

======================================================================





***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch