REBOL [
    Title: "Shortcut to event viewer"
    Purpose: {Reduce the fussing needed to bring up the Windows Event Viewer.}
]

;; [---------------------------------------------------------------------------]
;; [ This is a little helper written for people who sometimes are in a         ]
;; [ position to help with a little debugging but don't know how to,           ]
;; [ or remember how to, use the Windows Event Viewer.  All this script        ]
;; [ does is run the event viewer. Then, if a person locates an event          ]
;; [ of interest and double-clicks it, he can use the "copy" button to         ]
;; [ copy the event to the clipboard and paste it into the text area of        ]
;; [ this program, and send that text to a support person whose address        ]
;; [ is hard-coded into this program.                                          ]
;; [---------------------------------------------------------------------------]

;; -- This is the code that normally is in the user.r script.
;; -- Obviously you would change things for your own situation.
set-net [admin@mycompany.com "10.1.0.100" "" none none none admin@mycompany.com none] 
if (not none? system/view) [
    system/view/screen-face/options: none
] set-user-name "Mister Smith"

;; -- List of people to whom we email the event text
EMAIL-LIST: [
    admin@mycompany.com
]

EVENT-TEXT: ""

;; -- This works on Windows 10, but might not on other versions.
RUN-EVENT-VIEWER: does [
    call %/C/Windows/System32/eventvwr.exe
]

MAIL-EVENT: does [
    EVENT-TEXT: copy ""
    EVENT-TEXT: get-face MAIN-EVENT
    if equal? "" EVENT-TEXT [
        alert "No event text in text area"
        exit
    ]
    send/subject EMAIL-LIST EVENT-TEXT "Captured from event viewer"
    alert "Sent."
]

MAIN-WINDOW: layout [
    across
    banner "Capture Windows event"
    return
    text "Paste event text below and email it"
    return
    MAIN-EVENT: area 500x400 wrap
    return
    button "Quit" [quit]
    button "Event viewer" [RUN-EVENT-VIEWER]
    button "Clear text" [set-face MAIN-EVENT ""]
    button "Mail event" [MAIL-EVENT]
]

view center-face MAIN-WINDOW