Re: [NW] Delete Open File 2

From: Nobumi Iyanaga (n-iyanag@PPP.BEKKOAME.NE.JP)
Date: Thu Aug 03 2000 - 00:14:01 AEST


Hello Christian,

>
>this now deletes an open file, which is undoable, fine. But how do I trash
>an open loveletter, so that I can re-erase it later (when I realize that
>I'm still in love with that person)?
>

I think this is not possible directly in Nisus macro language; but if you
use AppleScript, it should be possible.  In AppleScript, you would write
something like this to put a file in the trash:

set fileToDelete to "Macintosh HD:Desktop Folder:my_file"
tell application "Finder" to delete (fileToDelete as alias)

So, you could do something like this:

qt = NumToChar (34)
cr = NumToChar (13)

fileToDelete = DocPath
if(! Nisus[FrontWindow][NeedsSaveAs]) goto doIt
beep
:1 "This macro works only on documents that have been saved to disk. Please
save and run the macro again."
Exit

doIt:
:1 "Do you want to save and close the front document now?" "OK"
if (Clipboard <> "OK") Exit
Save
Close
Clipboard = "tell application " + qt + "Finder" + qt + " to delete (" + qt
+ fileToDelete + qt + " as alias)"

Do AppleScript '\CC' "-"

==========

But you will find that the "Do AppleScript" command is very slow -- because
the script is compiled each time when this command is given.  On the other
hand, the Catalog window is not updated when a file is removed by
AppleScript, so you may want to add these lines to the macro:

Show Catalog
Close
Show Catalog

==========

Would this work for your love letters?

Best regards,

Nobumi Iyanaga
Tokyo,
Japan



This archive was generated by hypermail 2b29 : Sat Aug 05 2000 - 23:00:11 AEST