• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Calling Perl from AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling Perl from AppleScript


  • Subject: Re: Calling Perl from AppleScript
  • From: Thomas Fischer <email@hidden>
  • Date: Mon, 06 Mar 2017 20:41:00 +0100

Hello Marc,

there really shouldn’t be a problem.

You might try to add
	open (my $fh, '>>', 'test.txt')
		or die "cannot open > test.txt: $!“;
to see if the file is actually opened successfully.
If it is, the script runs fine for me.
A full path to „test.txt“ might help, too.

Cheers
Thomas

> Am 06.03.2017 um 18:16 schrieb debt <email@hidden>:
>
> 	I’m trying to call a Perl script from AppleScript but I’m not having any success.  I’ve written very simple test scripts but I can’t get AppleScript to actually call the Perl script.  The Perl script runs fine on it’s own.  I’ve included it below, as well.
>
> 	Script Debugger doesn’t complain about the code.  I’ve tried leaving off the var_array but that doesn’t help.  I’ve tried using the full path to the Perl executable, but nothing changes.  This is so simple, it’s embarrassing.  I’m sure it’s something that I’m just not seeing.  I’d appreciate a fresh set of eyes.
>
> Thanks,
> Marc
>
>
> set xxx to "1"
> set zzz to "2"
>
> set var_array to xxx & " " & zzz
>
> do shell script "perl ~/Desktop/code/AppleScript/test.pl " & var_array
>
> ——————————————
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my ($name, $number) = @ARGV;
>
> $name   = 'x' if not $name;
> $number = 'z' if not $number;
>
> open (my $fh, '>>', 'test.txt');
> print {$fh} "$name\n";
> print {$fh} "$number\n";
> close $fh;
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Follow-Ups:
    • Re: Calling Perl from AppleScript
      • From: debt <email@hidden>
References: 
 >Calling Perl from AppleScript (From: debt <email@hidden>)

  • Prev by Date: Re: AppleScript Versions per Iteration of OSX?
  • Next by Date: Re: Calling Perl from AppleScript
  • Previous by thread: Calling Perl from AppleScript
  • Next by thread: Re: Calling Perl from AppleScript
  • Index(es):
    • Date
    • Thread