Skip to content

Instantly share code, notes, and snippets.

@mikeyaunish
Last active June 22, 2025 15:50
Show Gist options
  • Select an option

  • Save mikeyaunish/4b842d0e54f52b3fd160668b0fa941b4 to your computer and use it in GitHub Desktop.

Select an option

Save mikeyaunish/4b842d0e54f52b3fd160668b0fa941b4 to your computer and use it in GitHub Desktop.
Red Online Search Tool
Red [
Title: "red-online-search-tool.red"
Needs: View
Comment: "Generated with Direct Code"
Date: 22-JUN-2025
]
do setup: [
num-of-search-fields: 6
run-search: does [
ndx: 1
loop num-of-search-fields [
status: get ( to-path reduce [ to-word rejoin [ "search-" ndx ] 'data ])
if status [
field-code: get (to-path reduce [to-word rejoin [ "search-" ndx ] 'extra 'search-format ])
full-url: rejoin reduce field-code
browse to-url full-url
]
ndx: ndx + 1
]
]
set-all-checks: function [
status [logic!]
/extern num-of-search-fields
][
ndx: 1
loop num-of-search-fields [
set (to-path reduce [ to-word rejoin ["search-" ndx ] 'data ]) status
ndx: ndx + 1
]
]
git-languages: [
"English" {%5Een%5C}
"Chinese" {%5Ezh-hans%5C}
"French" {%5Efr%5C}
"Czech" {%5Ecs%5C}
"Japanese" {%5Eja%5C}
]
]
;Direct Code VID Code source marker - DO NOT MODIFY THIS LINE OR THE NEXT LINE!
red-online-search-tool-layout: [
title "Red Online Search Tool"
style search-check: check font-size 14
style label: base "Label Text:" 77x25 230.230.230 font-color 0.0.0 right
style saved-field: Field hint "Enter search term here" 80x23
extra [
save-name: ""
save-filename: copy %""
]
on-create [
if face/extra/save-name <> "" [
face/extra/save-filename: to-file rejoin [ system/options/path face/extra/save-name ".data"]
if exists? face/extra/save-filename [
face/text: read face/extra/save-filename
]
]
]
on-change [
if face/extra/save-name <> "" [
write face/extra/save-filename face/text
]
]
style check-saved: check font-size 14
extra [
save-name: ""
save-filename: copy %""
search-format: copy ""
]
on-create [
if face/extra/save-name <> "" [
face/extra/save-filename: to-file rejoin [ system/options/path face/extra/save-name ".data"]
if exists? face/extra/save-filename [
face/data: either (load face/extra/save-filename) = 'false [ false ] [ true ]
]
]
]
on-change [
if face/extra/save-name <> "" [
save face/extra/save-filename face/data
]
]
space 2x2
group-box1: group-box "GitHub Search" 389x171 [
space 2x2
text1: text "(Requires GitHub login to work well)" font-size 12
return
search-1: check-saved "Red Documents"
with [
extra/search-format: [ {https://github.com/search?q=repo%3Ared%2Fdocs+path%3A%2F} git-language {%2F%2F+} search-field/text { &type=code} ]
extra/save-name: "search-1"
]
return
search-2: check-saved {ALL "*.red" source code}
with [
extra/search-format: [{https://github.com/search?q=} search-field/text {+path%3A*.red+language%3ARed+&type=code}]
extra/save-name: "search-2"
]
return
search-3: check-saved {Red GISTs}
with [
extra/search-format: [{https://gist.github.com/search?q=} search-field/text {+language%3ARed}]
extra/save-name: "search-6"
]
return
label1: label "Language:" 77x23 font-size 11
drop-down1: drop-down
data ["English" "Chinese" "French" "Czech" "Japanese"]
extra [ save-filename: %ROST-language.data ]
select 1
on-create [
either exists? face/extra/save-filename [
face/selected: index? find face/data load face/extra/save-filename
][
save face/extra/save-filename pick face/data face/selected
]
git-language: select git-languages face/text
]
on-change [
git-language: select git-languages face/text
save face/extra/save-filename pick face/data face/selected
]
]
return
group-box2: group-box "Google Search" 389x113 [
space 2x2
search-4: check-saved "www.red-lang.org"
with [
extra/search-format: [ {https://www.google.ca/search?q=} search-field/text {+site%3Ahttps%3A%2F%2Fwww.red-lang.org%2F} ]
extra/save-name: "search-3"
]
return
search-5: check-saved "www.Helpin.red"
with [
extra/search-format: [{https://www.google.ca/search?q=} search-field/text {+site%3Ahttps%3A%2F%2Fhelpin.red%2F}]
extra/save-name: "search-4"
]
return
search-6: check-saved "www.red-by-example.org"
with [
extra/search-format: [{https://www.google.ca/search?q=} search-field/text {+site%3A+www.red-by-example.org} ]
extra/save-name: "search-5"
]
]
return
toggle1: toggle "Select ALL Sources" 389x23 on-change [
either face/data [
face/text: "ALL Sources Selected"
set-all-checks true
] [
face/text: "NO Sources Selected"
set-all-checks false
]
]
return
label-1: text "Search:" right bold font-size 14
search-field: saved-field font-size 14 306x30 focus
hint "Enter search term here"
with [
extra/save-name: "search-field"]
on-create [
if face/extra/save-name <> "" [
face/extra/save-filename: to-file rejoin [system/options/path face/extra/save-name ".data"]
if exists? face/extra/save-filename [
face/text: read face/extra/save-filename
]
]
]
on-enter [write-clipboard face/text
run-search
]
return
button1: button "Search" 389x23 [ run-search ]
]
;Direct Code Show Window source marker - DO NOT MODIFY THIS LINE OR THE NEXT LINE!
do show-window: [
view red-online-search-tool-layout
]
@mikeyaunish
Copy link
Author

Simple tool displays search results in your browser.

@mikeyaunish
Copy link
Author

Updated version to work correctly with Github searches.
Allows choice of language (for github only).
Will set the clipboard to the search term so that you can narrow down the search on the web page once it it displayed.

@mikeyaunish
Copy link
Author

17-Mar-2024 update

  • Make all checks and fields save their values automatically
  • Modify Github instruction

@mikeyaunish
Copy link
Author

22-Jun-2025 update

  • Reorganize search groups with group-box
  • Add Red GISTs to searches

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment