ScriptTrashBin

From 40tude Dialog Wiki

Please read the Postkey script warning page before trying out this script.

Contents

A trash bin in Dialog

Installation

Copy the script below and paste it as "Custom Script". Use "Show Button Config" to assign a shortcut - preferably <Delete>. If you do so, you can still use <Shift><Delete> to permanently delete a message (or to delete it from your trash bin). You may configure a purging time in the group properties of your trash bin folder, too.

Prerequisites and Configuration

Create a folder named "!!! Trash !!!". If you use this name (or a similar one, starting with "!!", too), there's nothing left to do. Otherwise have a close look at the directions made in the script below.

Hints

As mentioned in the script, too, your trash bin folder must not be alphabetically the first of all your folders and groups, but just the first of all, starting with the same letter. Nevertheless, I recommend to use s/th like "!!! Trash !!!" as it's very unlikely that a (new) public newsgroup, a predefined system folder or even a private folder will ever start with a bunch of exclamation marks.

If, for any reason, you don't want to upgrade to Dialog Version 2.0.14.1 (Beta 37) (or higher), you can nevertheless use this script: Just change the offending "ADoLater('CopyMoveArticle');" to an "ADo('CopyMoveArticle');" and move the entire line down, beyond the PostKey() statements. As I've been told, this will do, too.

The Script

2004-10-16: Added "Expand Thread" to prevent trashing the complete thread
2004-10-16: Changed from ShortCut "M" to several <CurDown> (due to NLS problems)


//
// Implements a trash bin in 40tude® Dialog (2.0.14.1 (Beta 37)).
//

//
// Configuration
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
// 1.:  Create a folder named e. g. "!!! Trash !!!".  If you chose a
//      different name, make sure that it is alphabetically the first
//      of all folders and groups, starting with this letter, too.
//      +->  To verify this, you may go to menu "Message -> Copy/Move
//      |    selected articles".  Check "Allow groups as target", go
//      |    to the folder selection list and type any letter, but NOT
//      |    the first one of your trash bin's name.  Afterwards type
//      |    the first letter of your trash bin's name - if the trash
//      |    appears right now, everything's fine - goto 2. now.  ;o)
//      |    If not, chose a better name and go back to ... ---+
//      +------------------------------------------------------+
// 2.:  If you trash bin's folder name starts with a '!', you can skip
//      this paragraph and proceed to 3. immediately.
//      Otherwise, adapt the third PostKey() call below, corresponding
//      to the first character of your trash bin's folder name.  You
//      may use Michael Schierl's PostKey()-Generator "keycodes.exe"
//      (download@ <http://www.40tude.com/dialog/wiki/index.php/Links>)
//      to get the appropriate values.
//

program TrashBin;

begin
   lockdisplay;
   try
      ADo( 'ExpandThread' );            // prevent trashing entire thread
      ADo( 'MarkRead' );                // no unread messages in trash
      ADoLater( 'CopyMoveArticle' );    // call Copy/Move dialog box
      //
      // Had a PostKey('M') here, first - but as ...
      // a) ... this is language specific (thus has to be configured manually),
      // b) ... german version has no shortcut at all to select the "Move" option,
      // c) ... <CurDown> will never leave the folder drop down list,
      // I've changed it to several <CurDown>.
      //
      PostKey(40,false,false,false,false,false,false,false,false);  // <CurDwn> =~ select "Move"
      PostKey(40,false,false,false,false,false,false,false,false);  // <CurDwn> =~ goto folder list
      PostKey(49,true, false,false,false,false,false,false,false);  // <Shift>1 = ! =~ !!! Trash !!!
      Postkey(13,false,false,false,false,false,false,false,false);  // <Enter>   =~ DoIt!  ;o)
   finally
      unlockdisplay;
   end;  // finally
end.

Greets, Dirk Straka