A few notes on Ascripts/Pscripts/Script menu
A few notes on Ascripts/Pscripts/Script menu
- Subject: A few notes on Ascripts/Pscripts/Script menu
- From: Jesse Shanks <email@hidden>
- Date: Tue, 16 Apr 2002 20:04:39 -0700
on 4/16/02 12:22 PM, email@hidden at
email@hidden wrote:
>
> No, I haven't tried it, but why don't you just put the PERL script in an AS
>
> wrapper - just a few lines to call the PS and exit - and pop that in your
>
> script menu - can't see why it wouldn't work.
Yes, this is true. Here is a meaningless script that works just fine:
display dialog "Enter a name" default answer ""
set boo to text returned of result
set t to do shell script "perl -e 'my $r = scalar (localtime);print \"Hello
" & boo & ".\nIt is $r\"'"
display dialog t
Plus calling a Perl script from a full path works fine as well with
Applescript doing a shell script.
>
Perl scripts must be made executable or something from the command line or
>
they won't run.
Yah, I am hip to this. I write them and run them in BBEdit to get the syntax
right. Then I save it to a folder and use terminal to chmod on it.
>
set lPerlFile to alias "PowerBook
>
Docs:Users:jasonbou:Library:Scripts:Perl:Hello World.pl"
>
>
-- Get the unix-style path to the file/folder.
>
set lPerlFilePOSIX to POSIX path of lPerlFile
>
>
-- Make the Perl Script Executable.
>
do shell script "chmod 755 \"" & lPerlFilePOSIX & "\""
I liked this. I made my own version, one for the Script Menu and one for
BBEdit, that I uploaded to my Script Snippets pages.
<
http://www.blankreb.com/studiosnips.php?ID=8>
I downloaded the example of a Shell Script from the Script Menu page on the
Applescript site. It has no special aspects different from a typical shell
script. I made one that would get the date and pipe it to a new BBEdit
document (using the bbedit command line tool:
#!/bin/zsh
date | bbedit
It works straight from the script menu. Interestingly, the icon visible in
the submenu has a little # on it. The Perl Scripts I have saved to the
Scripts folder also show up in the submenu with the little #. If you remove
the path to the shell from a shell script, it won't show up in the menu. If
you remove the path to Perl from a Perl Script, it shows up, but has an
applescript application icon!
However, no script I try in Perl - no matter the permissions or any setting
or any icon - has run. It is true that there is no example of a Perl Script
(the link is an empty anchor) on the Script Menu page
<
http://www.apple.com/applescript/macosx/script_menu/>, where it says:
This convenient utility will launch Perl, Shell and AppleScript scripts with
a quick flick of the wrist. Power at your command, anywhere, anytime, from
within any application.
I aint complaining. There is already enough stuff to learn that works like a
charm and is unbelievably powerful. Plus there are many ways to run Perl
Scripts. I was just curious if anyone had got it to work.
--
Jesse Shanks
Writer & Web Developer
http://www.blankreb.com
email@hidden
530.886.0815
-
http://www.catsprite.com
http://www.digitallyobsessed.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.