Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Red [
- Title: "Find specific values in OS PATH"
- Author: "Arie van Wingerden"
- Version: 1.0
- Date: "2017-07-25"
- Needs: 'view
- ]
- osdelim: ":"
- if system/build/config/os = 'windows [
- osdelim: ";"
- ]
- list: split get-env "path" osdelim
- process: function [arg] [
- result: make block! 20
- if empty? arg [
- repeat i length? list [append result rejoin [pad/left i 4 " " list/:i]]
- i_t/text: "Now displaying all components of PATH variable"
- return result
- ]
- arg: lowercase arg
- i: 0
- foreach elem list [
- if find elem arg [
- i: i + 1
- append result rejoin [pad/left i 4 " " elem]
- ]
- ]
- either empty? result [
- i_t/text: rejoin[{No match found for string "} arg {" in the PATH variable}]
- ] [
- i_t/text: rejoin[{Now displaying components of PATH variable containing string "} arg {"}]
- ]
- result
- ]
- view [
- title "Find specific values in OS PATH"
- below
- q_t: text 800x15 "Enter search string:"
- a_t: field 800 focus on-enter [r_t/data: process a_t/text]
- across
- button "Search" [r_t/data: process a_t/text]
- button "Clear search" [a_t/data: "" r_t/data: process ""]
- button "Quit" [quit]
- return
- below
- i_t: text "Results" 800x15
- r_t: text-list 800x400 font-name "Courier new" []
- do [process "" r_t/data: process a_t/text]
- ]
- quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement