How To: Dialogboxen mit MacPerl
Frage:
Wie kann ich in einem MacPerl-Script eine Dialogbox zum Auswählen einer Datei realisieren? Ich möchte als Resultat den kompletten Pfad zurückhaben.
Antwort:
Wie wäre es hiermit:
#!perl -w use Mac::StandardFile; my($file);
$file = StandardGetFile(0, 'TEXTclpt');
if ($file->sfGood())
{
printf("You choose %s, of type %s.\n", $file->sfFile(), $file->sfType());
}
else
{
print "You cancelled the operation.\n";
}
Gibt bei mir z.B. zurueck:
You choose Yogi:dev:perl:Perl Artistic License, of type TEXT.
(Yogi heißt meine Powerbook-Festplatte, scheint also wirklich der komplette Pfad zu sein ![]()

