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

Re: [MacPerl] 2 simple queries



Charlie Schofield writes on 10 Apr 1997 10:36:34 +0200:

>1.  How can I move items to the trash and delete them?
>I have tried using the following and it doesn't work:
>
>Mac::Files::FSpCatMove("file", "HardDisk:Desktop Folder:Trash");
>
>it will move the file anywhere else but just won't trash it.

The simplest way to move a file from one place to another is simply to
rename() it. For instance:

        $old = "HD:Desktop Folder:MyFile";
        $new = "HD:Desktop Folder:MyFolder:MyFile";
        rename $old, $new;

will move "MyFile" into the folder "MyFolder" (provided it exists). You can
watch it happen.

Beware if the folder does not exist, for MacPerl will try to rename MyFile
as MyFolder. The icon remains titled MyFile, but you won't be able to open
the file, and if you try to throw it away you will get an error message
saying that you cannot "because it cannot be found".

The partial ne-naming can be corrected with ResEdit. I am not sure if you
would call this a bug exactly, but MacPerl behaves in a rather unfriendly
fashion under these circumstances.

You cannot (I believe) move files into Trash this way: but if you want to
get rid of the file, unlink() might do what you want perhaps?

>2. I am happy using MacPerl::Answer etc but how can I display a status
>window while my script is running that just says "The files are being
>processed, please wait" and then can be replaced by a MacPerl::Answer
>window saying "Finished" when the script is finished.  I do not want to use
>the MacPerl window but rather a Mac style box.

You might try something like:

    open(OUT, ">Dev:Console:Hello");
    print OUT "Wait for me!\n";

It is sometimes useful to open additional windows by this means, but I
haven't found a way of closing them however, except manually or via
AppleScript.

Alan Fry







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