Advertisement
ArievW

Untitled

Jul 26th, 2017
2,510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
REBOL 1.13 KB | None | 0 0
  1. Red [
  2.     Title:      "Find specific values in OS PATH"
  3.     Author:     "Arie van Wingerden"
  4.     Version:    1.0
  5.     Date:           "2017-07-25"
  6.     Needs:      'view
  7. ]
  8.  
  9. list: split get-env "path" ";"
  10.  
  11. process: function [arg] [
  12.     result: []
  13.     i: 0
  14.     if arg = "" [
  15.         foreach elem list [
  16.             i: i + 1
  17.             append result rejoin [pad/left i 4 "  " elem]
  18.         ]
  19.         return result
  20.     ]
  21.     arg: lowercase arg
  22.     foreach elem list [
  23.         if find elem arg = none [
  24.             continue
  25.         ]
  26.         i: i + 1
  27.         append result rejoin [pad/left i 4 "  " elem]
  28.     ]
  29.     return result
  30. ]
  31.  
  32. view/options [
  33.     title "Find specific values in OS PATH"
  34.     below
  35.   q_t: text "Enter search string:"
  36.   a_t: field 700
  37.   text "Results:"
  38.   r_t: text-list 700x400 font-name "Courier new" []
  39.   across
  40.   button "Search" [r_t/data: process a_t/text]
  41.   button "Quit" [quit]
  42. ] [
  43.   actors: make object!  [on-key:    func [face [object!] event [event!]] [
  44.                                                                     print ["Face/type:" face/type event]
  45.                                                                         { Commented out
  46.                                                                     if xevent/key = 'enter [
  47.                                                                             r_t/data: process a_t/text
  48.                                                                     ]
  49.                                                                     }
  50.                                                                 ]
  51.                                                 ]
  52. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement