! OneKey Noting - WPE Style. Dale E. Coy 29-OCT-1988 ! [ Ideas and some features gratefully borrowed from Chris Erskine ] ! Modified for TPU/Notes V2.0 Dale E. Coy 30-OCT-1989 ! Incorporate Extract Options Dale E. Coy 27-JAN-1990 ! Fix /NoAutomatic Problem Dale E. Coy 6-FEB-1990 ! Add error check - FNF & NSE Dale E. Coy 29-MAR-1990 ! DECUServe Version, with DSearch - OneKey V2.5 - 19-APR-1990 ! <><><><><><><><><> procedure onekey_update on_error endon_error; onekey_remember_position := mark(none); ! Create buffers and get the notebook file if get_info(onekey_notebook, 'type') <> buffer then ! First invocation ! Update everything ! Note: Comment-out next 4 lines to prevent initial update message ("Updating all entries..."); set(screen_update, OFF); ! notes$do_command ('update/class=*'); notes$do_command ('update' + onekey_x_update_class); set(screen_update, ON); onekey_msg_window := create_window (2,1,OFF); onekey_checking_buffer := create_buffer ("Checking"); set (NO_WRITE, onekey_checking_buffer); set (EOB_TEXT, onekey_checking_buffer, ""); position (onekey_checking_buffer); copy_text ("Checking Conferences..."); map (onekey_msg_window, onekey_checking_buffer); update (onekey_msg_window); onekey_to_do := create_buffer ("Conferences with Unread Notes"); set (NO_WRITE, onekey_to_do); set (EOB_TEXT, onekey_to_do, ""); ! Geoff Bryant onekey_notebook_file := file_parse ('','notes$notebook','sys$login:.note'); onekey_notebook := create_buffer ("notebook", onekey_notebook_file); set (NO_WRITE, onekey_notebook); unmap (onekey_msg_window); else ! Subsequent invocations if notes$x_notefile_ctx <> "" then notes$do_command('close'); endif; ! Update everything message ("Updating all entries..."); set(screen_update, OFF); notes$do_command ('update' + onekey_x_update_class); set(screen_update, ON); map (onekey_msg_window, onekey_checking_buffer); update (onekey_msg_window); erase (onekey_notebook); position (beginning_of(onekey_notebook)); read_file (onekey_notebook_file); message(" "); erase (onekey_to_do); position (beginning_of(onekey_to_do)); unmap (onekey_msg_window); endif; ! Process the notebook file onekey_pat1 := line_begin & arb(76) & ascii(223) & "'"; onekey_pat_max := ascii(223) + '3' + ascii(4); onekey_pat_read := ascii(223) + 'G' + ascii(9) + ascii(4) + ascii(0) + ascii(0) + ascii(0) + '@'; position (beginning_of(onekey_notebook)); onekey_to_do_number := 0; ! Search for current primary entries in the notebook file. loop onekey_line := search (onekey_pat1, FORWARD, EXACT); exitif onekey_line = 0; position (end_of(onekey_line)); onekey_read_index := index (current_line, onekey_pat_read); ! Find read-count and max-count if onekey_read_index <> 0 then onekey_read_number := substr (current_line, onekey_read_index+8, 3); else onekey_read_number := ascii(0) + ascii(0) + ascii(0); endif; onekey_max_index := index (current_line, onekey_pat_max); if onekey_max_index <> 0 then onekey_max_number := substr (current_line, onekey_max_index+3, 3); else onekey_max_number := ascii(0) + ascii(0) + ascii(1); endif; ! If the counts aren't equal, we have unread notes. if onekey_max_number <> onekey_read_number then move_horizontal (1); onekey_text := substr (current_line, current_offset + 2, ascii(current_character)); ! Ignore entries beginning with "OLD_" - Jack Harvey if substr(onekey_text, 1, 4) <> "OLD_" then position (onekey_to_do); if onekey_to_do_number <> 0 then split_line; endif; copy_text (onekey_text); onekey_to_do_number := onekey_to_do_number + 1; position (end_of(onekey_line)); endif; endif; endloop; ! This message gets obliterated on the initial invocation, but it's worth it. if onekey_to_do_number = 0 then message ("No Conferences with Unseen Notes"); else if onekey_to_do_number = 1 then message ("One Conference with Unseen Notes"); else message (Str(onekey_to_do_number) + " Conferences with Unseen Notes"); endif; endif; position (onekey_remember_position); endprocedure; ! onekey_update ! <><><><><><><><><> procedure onekey_enter local last; if notes$x_notefile_ctx = "" then ! Main menu onekey_open_next; else last := notes$x_last_error_count; execute (onekey_notes_enter_key); ! Bob Denny if notes$x_last_error_count > last then if (notes$x_last_error_name = 'NO_NEW_NOTE') then onekey_open_next; endif; else message (notes$x_entry_name); endif; endif; endprocedure; ! onekey_enter ! <><><><><><><><><> procedure onekey_open_next local last, last_pos; on_error; endon_error; last_pos := mark(none); position (beginning_of(onekey_to_do)); if mark(none) <> end_of(current_buffer) then if current_line = notes$x_entry_name then erase_line; onekey_to_do_number := onekey_to_do_number - 1; endif; endif; if mark(none) <> end_of(current_buffer) then last := notes$x_last_error_count; notes$do_command('OPEN/AUTOMATIC=UNSEEN "' + current_line + '"'); if notes$x_error_on_last_command then onekey_open_next; ! Recursive else ! Check for strange conditions if notes$x_last_error_count > last then if ((notes$x_last_error_name = 'NO_SUCH_ENTRY') OR (notes$x_last_error_name = 'OPENIN' )) then last_pos := mark(none); position (beginning_of(onekey_to_do)); if current_line <> notes$x_entry_name then message ("Could not Open Conference " + current_line); erase_line; onekey_to_do_number := onekey_to_do_number - 1; endif; position (last_pos); endif; endif; endif; else message ("Finished reading Unread Notes."); ! This section can be commented-out if the automatic prompt for updating is ! not wanted. update_Y := read_line ('No more unseen conferences... Do you want to update all conferences? [Y] ', 1); edit (update_Y, UPPER); if (update_Y = "Y") OR (update_Y = "") then onekey_update; if onekey_to_do_number > 0 then onekey_open_next; ! Recursive else position (last_pos); endif; else if (update_Y = "X") OR (update_Y = "E") then onekey_getout; else message (" "); position (last_pos); endif; endif; return; endif; endprocedure; ! onekey_open_next ! <><><><><><><><><> procedure onekey_getout on_error endon_error; message ("Exiting OneKey VAX Notes..."); onekey_screenclear; update (ALL); set(screen_update, OFF); if NOT eve$x_enable_parser_notes then eve_exit; notes$do_command('exit'); notes$do_command('exit'); else if notes$x_notefile_ctx <> "" then notes$do_command('exit'); notes$do_command('exit'); else notes$do_command('exit'); endif; endif; endprocedure; ! onekey_getout ! <><><><><><><><><> procedure onekey_screenclear on_error; endon_error; set (screen_update, OFF); onekey_clear_window := create_window (1,24,OFF); erase (onekey_checking_buffer); position (onekey_checking_buffer); copy_text ("Exiting OneKey VAX Notes..."); map (onekey_clear_window, onekey_checking_buffer); update (onekey_clear_window); set (screen_update, ON); endprocedure; ! onekey_screenclear ! <><><><><><><><><> procedure onekey_extract_new local last_pos, last; on_error; endon_error; last_pos := mark(none); message ("Extracting Unread Notes..."); set(screen_update, OFF); notes$x_hardcopy_active := TRUE; LOOP position (beginning_of(onekey_to_do)); exitif mark(none) = end_of(current_buffer); if current_line = notes$x_entry_name then erase_line; onekey_to_do_number := onekey_to_do_number - 1; exitif mark(none) = end_of(current_buffer); endif; notes$do_command('OPEN/AUTOMATIC=UNSEEN "' + current_line + '"'); if NOT notes$x_error_on_last_command then last := notes$x_last_error_count; LOOP ! Sanity check --- onekey_topic := str(notes$x_note_note); exitif onekey_topic <> substr(notes$x_noteid, 1, index(notes$x_noteid,".")-1); ! Assuming we're reading note 12.3, the following might translate ! to: "extract/seen tt: 12.3-12.*" notes$do_command (onekey_x_extract_command + ' ' + notes$x_noteid + '-' + onekey_topic + '.*'); notes$do_command ('next unseen'); exitif notes$x_last_error_count > last; ENDLOOP; endif; ENDLOOP; position (last_pos); notes$do_command('close'); notes$x_hardcopy_active := FALSE; set(screen_update, ON); message ("Finished Extracting Unread Notes."); refresh; return; endprocedure; ! onekey_extract_new ! Search DECUServe Titles Files - V1.2 ! Dale E. Coy 28-JAN-1990 ! <><><><><><><><><> procedure dsearch_get_info local topic, rest; on_error endon_error; dsearch_conference := substr(current_line, 1, 20); edit (dsearch_conference, COLLAPSE); dsearch_note := substr(current_line, 21, 7); edit (dsearch_note, COLLAPSE); if dsearch_note = "" then topic := substr(current_line, 41, 5); edit (topic, COLLAPSE); rest := substr(current_line, 46, 80); rest := substr(rest, 1, index (rest, " ")); edit (rest, COLLAPSE); dsearch_note := topic + rest; if int(topic) = 0 then dsearch_note := ""; endif; else if int(dsearch_note) = 0 then dsearch_note := ""; else dsearch_note := dsearch_note + ".0"; endif; endif; endprocedure; ! dsearch_get_info ! <><><><><><><><><> procedure dsearch_select on_error endon_error; dsearch_get_info; if dsearch_note <> "" then set (screen_update, OFF); eve_exit; update (eve$command_window); update (message_window); if notes$x_notefile_ctx = "" then update (notes$x_showtitle_window); else update (notes$x_line2_window); update (notes$x_line3_window); endif; update (eve$x_pre_command_window); if index (notes$x_entry_name, dsearch_conference) <> 1 then ! notes$do_command ("OPEN/NOAUTOMATIC " + dsearch_conference); ! notes$do_command (dsearch_note); notes$do_command ("OPEN/NOAUTOMATIC " + dsearch_conference + " " + dsearch_note); else if index (notes$x_noteid, dsearch_note) <> 1 then notes$do_command (dsearch_note); endif; endif; set (screen_update, ON); message (notes$x_entry_name + " " + dsearch_note); endif; endprocedure; ! dsearch_select ! <><><><><><><><><> procedure dsearch_buffer_titles on_error endon_error; dsearch_getbuffer_titles; notes$do_command ("eve buffer decuserve_titles"); endprocedure; ! dsearch_buffer_titles ! <><><><><><><><><> procedure dsearch_getbuffer_titles on_error endon_error; if get_info (dsearch_titles_buffer, "type") <> BUFFER then message ("Getting DECUServe_Topic_Titles ==> This may take " + "some time....."); update (message_window); dsearch_titles_buffer := create_buffer("DECUSERVE_TITLES", "DECUSERVE_TOPIC_TITLES"); set (NO_WRITE, dsearch_titles_buffer); endif; endprocedure; ! dsearch_getbuffer_titles ! <><><><><><><><><> procedure dsearch_buffer_all on_error endon_error; dsearch_getbuffer_all; notes$do_command ("eve buffer decuserve_all_titles"); endprocedure; ! dsearch_buffer_all ! <><><><><><><><><> procedure dsearch_getbuffer_all on_error endon_error; if get_info (dsearch_all_titles_buffer, "type") <> BUFFER then message ("Getting DECUServe_ALL_Titles ==> This may take " + "QUITE some time....."); update (message_window); dsearch_all_titles_buffer := create_buffer("DECUSERVE_ALL_TITLES", "DECUSERVE_ALL_TITLES"); set (NO_WRITE, dsearch_all_titles_buffer); endif; endprocedure; ! dsearch_getbuffer_all ! <><><><><><><><><> procedure dsearch_kp7 on_error endon_error; if (current_buffer = dsearch_titles_buffer) OR (current_buffer = dsearch_all_titles_buffer) then dsearch_select; else if get_info(dsearch_eve_kp7_key, "type") = PROGRAM then execute (dsearch_eve_kp7_key); endif; endif; endprocedure; ! dsearch_kp7 ! <><><><><><><><><> procedure dsearch_e4 on_error endon_error; if (current_buffer = dsearch_titles_buffer) OR (current_buffer = dsearch_all_titles_buffer) then dsearch_select; else if get_info(dsearch_eve_e4_key, "type") = PROGRAM then execute (dsearch_eve_e4_key); endif; endif; endprocedure; ! dsearch_e4 ! <><><><><><><><><> procedure dsearch_eve_kp6 on_error endon_error; if (current_buffer = dsearch_all_titles_buffer) then dsearch_getbuffer_titles; eve_buffer ("DECUSERVE_TITLES"); else if get_info(dsearch_eve_kp6_key, "type") = PROGRAM then execute (dsearch_eve_kp6_key); endif; endif; endprocedure; ! dsearch_eve_kp6 ! <><><><><><><><><> procedure dsearch_eve_gold_kp6 on_error endon_error; if (current_buffer = dsearch_titles_buffer) then dsearch_getbuffer_all; eve_buffer ("DECUSERVE_ALL_TITLES"); else if get_info(dsearch_eve_gold_kp6_key, "type") = PROGRAM then execute (dsearch_eve_gold_kp6_key); endif; endif; endprocedure; ! dsearch_eve_gold_kp6 ! <><><><><><><><><> Executable Statements <><><><><><><><><><><><><><><> ! NOTES Key additions define_key ('onekey_getout', key_name(F10, shift_key), ' Complete Exit', notes$kt_user_keys); define_key ('onekey_getout', key_name(F10, shift_key), ' Complete Exit', eve$x_user_keys); define_key ('onekey_getout', key_name('e', shift_key), ' Complete Exit', notes$kt_user_keys); ! CLE define_key("message (notes$x_entry_name)",key_name("w",shift_key),' where', notes$kt_user_keys); ! CLE define_key('notes$do_command("search")', kp8, 'Search Next', notes$kt_user_keys); ! CLE define_key('onekey_open_next', kp4, ' Open_next_unseen_conference', notes$kt_user_keys); ! CLE define_key ("notes$do_command ('read/marker')", key_name (kp9, shift_key), ' read /Marker',notes$kt_user_keys); define_key ("notes$do_command ('mark')", kp9, ' add mark',notes$kt_user_keys); define_key ('onekey_update', key_name("u", shift_key), ' Update', notes$kt_user_keys); ! Bob Denny - make independent of Notes version onekey_notes_enter_key := lookup_key (ENTER, PROGRAM, notes$kt_notes_key_map_list); define_key('onekey_enter', ENTER, '1K-Note', notes$kt_user_keys); define_key('onekey_enter', F20, '1K-Note', notes$kt_user_keys); ! DSearch Keys define_key ('dsearch_buffer_titles', KP6, 'Search DECUServe Titles', notes$kt_user_keys); define_key ('dsearch_buffer_all', key_name(KP6, shift_key), 'Search DECUServe All Titles', notes$kt_user_keys); ! WPS Key additions if notes$x_user_editor = "NOTES_EVE" then set (SHIFT_KEY, PF1, eve$x_key_map_list); endif; define_key ("eve_dcl ('')", key_name ('i', shift_key), " dcl",eve$x_user_keys); define_key ("eve_spell", key_name ('s', shift_key), " spell",eve$x_user_keys); define_key("eve_write_file ('')", key_name ('w', shift_key), " write_file", eve$x_user_keys); define_key ("eve_show", key_name ('z', shift_key), " show",eve$x_user_keys); define_key ("eve_replace ('','')", key_name (';', shift_key), " replace", eve$x_user_keys); define_key ("eve_spawn", key_name ('$', shift_key), " spawn", eve$x_user_keys); define_key ("eve$wps_next_screen", key_name ('>', shift_key), " next_screen", eve$x_user_keys); define_key ("eve$wps_previous_screen", key_name ('<', shift_key), " previous_screen", eve$x_user_keys); define_key ("eve$check_bad_window", ctrl_f_key, " editing_window", eve$x_user_keys); define_key ("eve_mark('')", kp9, " mark", eve$x_user_keys); define_key ("eve_go_to('')", key_name(kp9, shift_key)," go_to", eve$x_user_keys); define_key ("eve$wps_find_next", key_name (e1, shift_key), " find_next", eve$x_user_keys); define_key ("eve_insert_here", key_name (e2, shift_key), " paste", eve$x_user_keys); define_key ("eve$wps_copy", key_name (e3, shift_key), " copy",eve$x_user_keys); define_key ("eve$wps_top", key_name (e5, shift_key), " top", eve$x_user_keys); define_key ("eve$wps_bottom", key_name (e6, shift_key), " bottom", eve$x_user_keys); define_key('eve$wps_top', key_name(up, shift_key), ' top', eve$x_user_keys); define_key('eve$wps_bottom', key_name(down, shift_key), ' bottom', eve$x_user_keys); define_key ("eve_quote", f7, " quote", eve$x_user_keys); define_key ("eve$insert_text (ascii (27))", key_name (f7, shift_key), " escape", eve$x_user_keys); define_key ("eve_capitalize_word", f8, " capitalize_word", eve$x_user_keys); define_key ("eve_uppercase_word", key_name (f8, shift_key), " uppercase_word", eve$x_user_keys); define_key ("eve_one_window",f17," one_window",eve$x_user_keys); define_key ("eve_two_windows",f18," two_windows",eve$x_user_keys); define_key ("eve_get_file('')", key_name (f18, shift_key), " get_file", eve$x_user_keys); define_key ("eve_other_window",f19," other_window",eve$x_user_keys); define_key ("eve_buffer('')", key_name (f19, shift_key), " buffer", eve$x_user_keys); define_key ("if current_offset<>length(current_line)then" + " eve$edt_x_deleted_word := erase_character(length(current_line));endif;", f20, " erase_eol", eve$x_user_keys); define_key ("copy_text(':-)')", key_name (')', shift_key), " smile", eve$x_user_keys); define_key ("copy_text(':-}')", key_name ('}', shift_key), " grin", eve$x_user_keys); define_key ("copy_text(':-(')", key_name ('(', shift_key), " frown", eve$x_user_keys); ! Terminal must be /NOLINE_EDIT or /PASTHRU for these to work.... define_key ("wpe_line := erase_line", f6," erase_line",eve$x_user_keys); define_key ("copy_text (wpe_line); split_line;", key_name (f6, shift_key), " restore_line",eve$x_user_keys); ! DSearch Keys dsearch_eve_kp7_key := lookup_key (KP7, PROGRAM, eve$x_key_map_list); dsearch_eve_kp7_cmt := lookup_key (KP7, COMMENT, eve$x_key_map_list); define_key ("dsearch_kp7", KP7, dsearch_eve_kp7_cmt, eve$x_user_keys); dsearch_eve_e4_key := lookup_key (E4, PROGRAM, eve$x_key_map_list); dsearch_eve_e4_cmt := lookup_key (E4, COMMENT, eve$x_key_map_list); define_key ("dsearch_e4", E4, dsearch_eve_e4_cmt, eve$x_user_keys); dsearch_eve_gold_kp6_key := lookup_key (key_name(KP6, shift_key), PROGRAM, eve$x_key_map_list); dsearch_eve_gold_kp6_cmt := lookup_key (key_name(KP6, shift_key), COMMENT, eve$x_key_map_list); define_key ("dsearch_eve_gold_kp6", key_name (KP6, shift_key), dsearch_eve_gold_kp6_cmt, eve$x_user_keys); dsearch_eve_kp6_key := lookup_key (KP6, PROGRAM, eve$x_key_map_list); dsearch_eve_kp6_cmt := lookup_key (KP6, COMMENT, eve$x_key_map_list); define_key ("dsearch_eve_kp6", KP6, dsearch_eve_kp6_cmt, eve$x_user_keys); ! FIX BUFFERS TO ALWAYS BE IN INSERT MODE set (insert, NOTES$X_EVE_COMMAND_BUFFER); set (insert, NOTES$X_COMMAND_BUFFER); !================= TAILOR THE FOLLOWING =================== ! One statement to control which classes will be updated onekey_x_update_class := "/class=*"; ! Update all classes ! onekey_x_update_class := ""; ! Only update Current Class ! onekey_x_update_class := "/class=(also2)"; ! Update class named ALSO2 ! Or just Update Entry vax_notes_utility in Class main ! onekey_x_update_class := "/class=main vax_notes_utility"; ! Update at start of procedure. onekey_update; ! THIS STATEMENT IS MANDATORY ! SELECT ZERO OR ONE OF THE FOLLOWING TWO OPTIONS: !----- Remove ! from the following FIVE (5) statements to extract unread ! notes to a file. Edit the first statement to change the file name. ! onekey_x_outfile := "sys$login:extracts.txt"; ! onekey_xb_buffer := create_buffer ('onekey_xb'); ! onekey_x_extract_command := "extract/buffer/append/seen onekey_xb"; ! onekey_extract_new; ! write_file (onekey_xb_buffer, onekey_x_outfile); !----- Remove ! from the following TWO (2) statements to extract unread ! notes to your terminal - and capture with a LOG file using emulators. ! onekey_x_extract_command := "extract/seen tt:"; ! onekey_extract_new;