REBOL [
    Title: "Subject line builder"
    Purpose: {An aid to building an email subject line using our new
    SLAM (Subject Line Action Markup) protocol.}
]

;; [---------------------------------------------------------------------------]
;; [ This is the first pass at an idea for a helper program to prepare a       ]
;; [ a subject line for email, using tags to help the receiver know what       ]
;; [ is expected of him, and perhaps to help him route the message using       ]
;; [ rules.  The output of this program is a line of text in the clipboard.    ]
;; [ This line of text could be typed very easily, but it can be a nuisance    ]
;; [ to have to remember to add tags every time one wants to send an email,    ]
;; [ so a little helper program might make that easier, and thus more likely   ]
;; [ to be done.                                                               ]
;; [---------------------------------------------------------------------------]

SUBJECT-LINE: ""

ACTIONTAGS: [
    ""
    ""
    ""
    ""
    ""
    ""
    ""
    ""
]

ADD-ACTION: does [
    SUBJECT-LINE: copy ""
    append SUBJECT-LINE rejoin [MAIN-SUBJECT/text " "]
    foreach TAG MAIN-ACTIONS/picked [
        append SUBJECT-LINE TAG
    ]
    write clipboard:// SUBJECT-LINE
    set-face MAIN-FINAL SUBJECT-LINE
]

MAIN-WINDOW: layout [
    across
    label 100 "Your subject" 
    MAIN-SUBJECT: field 550
    return
    label 100 "Final subject"
    MAIN-FINAL: info 550
    return
    MAIN-ACTIONS: text-list 200X300 data ACTIONTAGS
        [ADD-ACTION]
    text 450x300 wrap {Type your own part of the subject,
then use control-leftclick to select all relevant tags.
The final subject is what will be in the clipboard.
The clipboard changes every time you select a new set
of tags.}
    font [shadow: none size: 24 style: 'bold]
    return
    button "Close" [quit]
    button "Debug" [halt]
]

view center-face MAIN-WINDOW