At 17.20 +0000 2000.01.11, John Delacour wrote: >At 9:04 am -0500 11/1/00, Chris Nandor wrote: > >>Not if you are already using MacPerl. You may like controlling MacPerl >>from AppleScript, but I think most people will find it is a kludgier way to >>work. And the speed difference is not an issue for most Macs these days. > >I don't see what's kludgy about typing command-B and getting >immediately the result required, or clicking a button, optionally >linked to any key-shortcut and getting the result immediately. Because people want to do it from within their MacPerl programs. Your solution requires going outside of MacPerl. That is a fine solution, but it seems to me that it does not fit what was wanted (though I could be wrong). If someone wants a macro with a key or a button to close the window, then your solution is a good one. If someone wants to close the window from a MacPerl program, then mine is a good one, either calling MacPerl::DoAppleScript or a compiled AppleScript from Mac::OSA::Simple. >How do you assign a shortcut to your Perl script and how can it be >said to be anything other than kludgy and inconvenient? Well, I have plenty of MacPerl scripts in OSA Menu. The trick is to either embed MacPerl in an AppleScript, or have the AppleScript tell MacPerl to execute the script that is in a file on disk. It is a kludge of sorts, but it is not at all inconvenient. It is very convenient, actually, and easy to do with a droplet I wrote called p2as. You just drop a Perl script on p2as, and it creates the compiled AppleScript, all ready to go. I use these scripts all the time for various things. My favorite is edit_url which, uses Mac::Glue and is invoked as a compiled AppleScript from OSA Menu and the key combo cmd-opt-shift-=. It: 1. asks Netscape for the front URL 2. using Perl regexes, depending on the hostname and directory, converts the URL into an FTP URL 3. if necessary, goes to my .netrc file to get my username and password (which I don't use anymore under Mac OS 9 with the wonderful Keychain!) 4. then tells Anarchie to open the URL in BBEdit, where I then can edit the file >From there, Anarchie and BBEdit take over, where saving it in BBEdit tells Anarchie to put it back to the server. Anyway, a simple key combo is all it takes. Hardly inconvenient. But yes, slightly kludgy. But the alternative to me is not as attractive: writing it in AppleScript and calling MacPerl to do regexes. I'd rather write the whole darn thing in Perl and just have AppleScript launch it. But, that is me. To each his own. :) >This gives me # Can't locate Mac/OSA/Simple.pm in @INC. > >So far as I know I did a smooth install of all your stuff and the >CPAN, so what am I missing and where can I get it? Mac::OSA::Simple is not part of any bundle, it is a separate module to download and install. It is with all of my other modules on CPAN. It does not add functionality to existing Mac toolbox modules, it just makes using them a lot easier. -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org