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

Re: [MacPerl] Re : Facespan



Paul Williams wrote:
> 
> Philippe,
> 
> Can you tell me how you interface between FaceSpan and MacPerl? The
> "scripting language" dropdown in the FaceSpan script editor does not seem
> to recognize MacPerl.
> 
> Appreciate any help you can offer.
> 
> paul williams
> paul@herald.ns.ca
> 
> At 11:37 AM 11/7/97 +0200, you wrote:
> >I agree that Facespan is expensive and slow, but there is a cheaper
> >alternative : it is called CrossBasic and only costs $25 I think. You
> >can send data to CrossBasic projects using the Do Script command and get
> >data back.
> >
> >On the downside, as far as I am aware, CrossBasic does not let you
> >create windows, window items, etc. from MacPerl; i.e., you cant just
> >say:
> >
> >use CrossBasic;
> >
> >$window = new Window;
> >
> >$window->addButton(...);
> >
> >etc.
> >
> >I personally plan to stick with Facespan for a while because:
> >
> >- it cost me $249
> >
> >- it lets you easily create grids which neither CrossBasic nor Tk let
> >you do (as far as I know)
> >
> >- it lets you create neater interfaces than Tk
> >
> >- you don't have to use arcane OO commands to program it
> >
> >Perhaps one day Larry Wall will add built-in interface-creation
> >capabilities to Perl, as in Java. That would solve all our problems :-).
> >
> >Philippe de Rochambeau
> >
> >***** Want to unsubscribe from this list?
> >***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch
> >


Actually, my "interface" is pretty crude. Here is an example of how to
exchange data between an AppleScript script and MacPerl.

Create an AS script and type the following code:

-- Chemin du fichier Perl a exŽcuter
set fichier to {"Macintosh HD:Desktop Folder:testASMacPerl.pl"}
-- Valeurs passŽes ˆ MacPerl (liste illimitŽe?)
set valeurs to {1, 2, 3, "chats", "blancs"}
-- ConcatŽner les deux listes
set listeParams to fichier & valeurs
-- Passer une liste contenant le nom du fichier et tous
-- les fichiers, ˆ MacPerl
set the result to listeParams

tell application "MacPerl"
	try
		Do Script listeParams
		-- the result contient la valeur renvoyŽe par MacPerl
		-- On peut la tranformer en nombre ou en cha”ne
	on error
		set the result to "error"
	end try
	
end tell

Create a MacPerl script called "testASMacPerl" containing the following
code:

my $i = 0;

#print "Le script Perl a reu les arguments suivants :\n";


#foreach $el (@ARGV) {

#  print "Argument $i : \"$el\"\n";
#		$i++;

#}

MacPerl::Reply(($ARGV[0] * $ARGV[1] * $ARGV[2] . " " . $ARGV[3] . " " .
$ARGV[4]));


As far as Facespan is concerned, the principle is the same. Create a
window with three fields and a button. When the user clicks the button,
the button's script takes the value in the first field, the value in the
second field, and sends the whole lot to MacPerl (see AS code above).
MacPerl uses the two values and returns a result which is then displayed
by FaceSpan in the third field.

Hope this is clear.

Philippe de Rochambeau

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