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

Re: [MacPerl] 'Where is MacPerl?' in runtime



Kevin Johnson wrote:
>Hi all,
>I have a script that uses DoAppleScript for some file manipulation
>(copying, deleting, namechange, etc). When I create a runtime (with
>runtimebuilder), it asks "Where is MacPerl?". I want the script to run
>automatically without this need for interaction. Is this an applescript
>problem (I have Applescript activate MacPerl to bring the output window
>back to the front.) or do I need to give the directory pathway to something
>within the script?
>

Applescript can't find MacPerl. Giving the file path to the runtime should help

You could use Script Editor's recording feature to find and format the path
to your runtime. Turn on recording and then manually execute the runtime by
double clicking it. Script Editor will record the path for you.

As an alternative the following code will convert the path MacPerl returns
to the format AppleScript expects.

----------------------------

#!perl5

require "GUSI.ph";

$prompt = "Pick a file to convert its path to Applescript format...";
$default = "";
@types = "";

$file = MacPerl::Choose(
&GUSI::AF_FILE,0,$prompt,&GUSI::pack_sa_constr_file(@types),($default ?
&GUSI::CHOOSE_DEFAULT : 0),$default);

print "$file\n";
&AppleScript_path_finder;

exit(0);

# -------------------------------

sub AppleScript_path_finder {
	# ROUTINE FOR AppleScript path finder
	$out_filename="$file";
	@folders=split(/:/,	$out_filename);
	$ff=@folders - 1;
	$out_file=$folders[$ff-1];
	$fldrs=" of startup disk";
	for ($f = 1; $f < $ff; $f++) {
		$fldrs = " of folder \"$folders[$f]\"" . $fldrs;
	}
	$fldrs = "\"$folders[$f]\"" . $fldrs;
	print"$fldrs\n";
}




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