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

Re: [MacPerl] macperl::choose, custom dialogs, and BBEdit



One way to do this is with AppleScript:

  tell application "MacPerl" to activate

  tell application "BBEdit 4.5"
     run macperl
     activate
  end tell

Put the following in the active BBEdit window along with the definition 
of the GetFolder function:

  print GetFolder("choose a folder","test");

Running the AppleScript given above with the Perl script given above in 
the front BBEdit window will bring MacPerl to the front, present the 
dialog, and put the results of the print function in a BBEdit window 
(which window depends on the options set in the Run MacPerl plug-in).

You need version 1.2 of the Run MacPerl plug-in for this to work. This 
example shows that the seemly useless ability of the Run MacPerl plug-in 
to be scripted may not be useless after all.

Brad

>I've been using the following routine to allow the user to select a folder
>of data to analyse:
>
>sub GetFolder {
>  require 'GUSI.ph';
>  my($prompt, $default) = @_;
>  MacPerl::Choose(
>    GUSI::AF_FILE(), 0, $prompt, '',
>    GUSI::CHOOSE_DIR() + ($default ? &GUSI::CHOOSE_DEFAULT : 0), $default );
>}
>
>This works fine. However, if I run the routine from bbedit, using the "Run
>File With MacPerl" tool, I don't get the custom dialog box for selecting a
>directory. I just get the standard dialog, and so then the routine
>/doesn't/ work. I can run the routine using the "Run MacPerl Front" tool
>instead -- this works (natch), but then I don't get my output sent to a
>bbedit window as I would like.
>
>Is there another way? Perhaps a way of getting a folder from a standard
>file dialog which bbedit could provide?

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