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

Re: [MacPerl] Send Data and Do Script, alternative IDE for MacPerl



Philippe de Rochambeau wrote:
> Could someone show me an example of how to use MacPerl's "Send Data"
> AppleScript command? MacPerl's AppleScript dictionary is not too
> explicit on that matter. What is the 'input record'? How do you use it?
> How do tell the command the name of the Perl script?
> 
> I have not managed to use the Do Script command with more than two
> parameters: the Perl script's name and another parameter. How do you
> pass more than two parameters to Do Script (.e.g, Do script {scriptname,
> param1, param2, param3...)? Do you use Send Data? How?
> 

I did as follows;

1) I write an AppleScript code readFile(path) to read text file.
2) I write an Apple Script code setArgv(parametersList), which convert
paramaters list
	 {param0, param1, ...} to the Perl Script string, such as

	$ARGV[0] = 'pamam0';
	$ARGV[0] = 'param1';
	...

3) Then, I write a Perl Script, which gets parameters from @ARGV, as
usual. And save it.

4) Use them in AppleScript as follows;

	set argv to setArgv({param0, param2, ...})
	set perlScript to readFile
	tell application "MacPerl"
		Do Script (argv & readFile(pathToPerlScript))
	end tell

That's it.

Here is a short example to explain the idea;
-----AppleScript
set ARGV to ("$ARGV[0] = 'Hello, World!'; $ARGV[1] = 1;" & return)
set aPerlScript to "print @ARGV;"--a Perl Script

tell application "MacPerl"
	Do Script (ARGV & aPerlScript)
end tell
-----end of AppleScript
You can run this AppleScript.

For complete exsample, visit my home page,
http://www.clas.kitasato-u.ac.jp/home/fujiwara/wwwServer/wwwServer.html
The downloadable file "autoLink3.sit" is the example. See "Perl.lib" and
"File.lib" in the sit file.
(Sorry, but comments in the files and the WWW pages are in Japanese.
PerlScript and AppleScript are written in american, though. ^!^)

#I don't know how to use "Send Data".

See you.

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