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

Re: [MacPerl] Problem with open(CON2, ">Dev:Console:Another Window");



Philippe de Rochambeau wrote on Wed, 29 Oct 1997 10:28:36 +0100:

>The MacPerlFAQ says the following:
>
>"3.2.3) How can I output to another window?
>
>open(CON2, ">Dev:Console:Another Window");"
>
>However, this does not work in MacPerl 5.14r4.  No new window gets
>created. How do you output to another window than the console window?
>
>How do you close the console window?

You can close the window with an AppleScript:

MacPerl::DoAppleScript qq(
    tell application "MacPerl"
        Close Window "Another Window"
    end tell
);

However an 'AEBuild' version;

use Mac::AppleEvents;
$obj = "obj{want:type(cwin), from:null(), form:name, seld:"Another Window"}";
$evt = AEBuildAppleEvent('core', 'clos', typeApplSignature, "McPL", 0, 0,
                         "'----':$obj") or die $^E;
$rep = AESend($evt, kAEWaitReply) or die $^E;
AEDisposeDesc $evt;
AEDisposeDesc $rep;

fails possibly because macPerl cannot send an AppleEvent to itself?

You can close the MacPerl window (or the script winow), if it is the front
window by Windows.pm:

use Mac::Windows;   #MacPerl4.1.4r4/PPC/MacOS 8
$win = FrontWindow();
HideWindow($win);

DestroyWindow($win) causes a crash possibly because the MacPerl window must
always exist (although it may be hidden) while MacPerl is running.

Curiously, if the window created by 'Dev:Console' is the front window,
FrontWindow() returns no 'GrafPtr'. I wonder if anyone knows why this
should be so?

Alan Fry



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