// // grouplist.vdm Christian Ziemski 25.03.2001 // // A macro for the multi purpose editor VEDIT // (see trial version on http://www.vedit.com) // //================================================================== // // Converts a newsgroup list retrieved from a news server via the // command "list newsgroups" in a telnet session // into a format that can be imported into [Free]Agent. // // Usage: // Load the news list into the main edit buffer of VEDIT. // Run the macro via the menu: Misc - Load/exec Macro. // The resulting import file is saved as "FA-GROUPLIST.TXT" // Exit VEDIT // // Open [Free]Agent // Menu: File - Import Messages // Check the two bottom checkboxes // ("If a message contains ..." and "Automatically create...") // Load the above created file FA-GROUPLIST.TXT // //================================================================== Buf_Switch(2) // switch to buffer 2 (for output) File_Save_As("FA-GROUPLIST.TXT", OK) // the resulting output file Buf_Switch(1) // back to the input file (the group list) Begin_of_File //---- loop through all lines while(! At_EoF){ Reg_Empty(11) // empty temporary text registers Reg_Empty(12) //---- get the group name Search("|{ ,|N}") // search for space or newline Reg_Copy_Block(11, BoL_Pos, Cur_Pos) // save it in Text Register 11 //---- get the description (if any) if (Cur_Char == 32){ Search("|!|W", NOERR) // search first not-whitespace Reg_Copy_Block(12, Cur_Pos, EoL_POS) // and save the rest of line in reg 12 } //---- fill the output file Buf_Switch(2) Ins_Text("From ???@??? Sun Mar 25 00:00:00 2001") Ins_Newline(1) Ins_Text("X-Folder: grplist") Ins_Newline(1) Ins_Text("Subject: ") Reg_Ins(11, BEGIN) // insert the group name //---- replace dots with spaces in the group name Replace_Block(".", " ", Cur_Pos, EoL_Pos, ALL+NOERR) End_of_Line Ins_Newline(1) //---- build the From line with abbreviated name Ins_Text("From: ") Reg_Ins(11) // insert name (with dots) Ins_Newline(1) Line(-1) // back one line Search(" ",ADVANCE) // to the beginning of the name Char(1) // leave the first character alone while(Match("|N") != 0){ // while not at end_of_line // ASCII 46 is a dot '.', 45 a hyphen '-' if((Cur_Char == 46) || (Cur_Char == 45)) { Del_Char(1) // delete all following chars Char(1) // but not the 1st character after a dot or hyphen }else{ Del_Char(1) } } Line(1) // down one line Ins_Newline(1) // insert empty line (required!) Ins_Text("news:") Reg_Ins(11) // insert dotted name again Ins_Newline(2) Reg_Ins(12) // insert description Ins_Newline(1) Buf_Switch(1) // back to the original grouplist Line(1,NOERR+ERRBREAK) // and jump to the next line there } // end of main loop Buf_Switch(2) // output file Begin_Of_File File_Save() // save it finally