Red Programming

Red programming language         This page was last updated:   02/05/2019
I've been looking at this language and I have to say that it IS the future. It puts all of the over bloated resource hungry programming environments to shame.
Red is a single exe, less than one meg in size and needs no dependencies. Red is definitely the way programming should be .... See my Red Apps.
Very similar and inspired by the excellent 'Rebol' scripting language, Red seems to deliver everything a developer needs. You write one script and it runs on/compiles to every platform .... An App developers dream. Though still in its early stages of development, I would say it is already a powerful programming tool. I love it. 
I must congratulate the brilliant 'Nenad Rakocevic' and his devoted team of developers. The amount of work and the dedication needed to get Red to where it is now is awesome.  I must also convey the highest regard and respect to these programming guru's .... 

Get the Red Language
Go to the Red site: and download the last stable build.
The site has plenty of instructions and tips.  

I use Windows, so will show how to get started in Windows .... So:  'Create a new folder' call it 'Redthings'  .... now copy the red-063.exe to your 'Redthings' folder. there are a few ways to interpret and/or compile Red scripts .... but for now all you need is a text editor .... Any text editor will do, but lets make things easy .... If you go to:  and move down to 'Try Ride for Windows' then click on 'you can download it here ' .... then unzip into your 'Redthings' folder and away you go. 

Alternatively you could try my simple 'Red' editor with built in interpret and compile options, No setup needed, just unzip and go ....  Simple, No Nonsense .... Write, Interpret and Compile ..... Get it here: 

Check out the examples below and See my Red  'Beginners Reference Guide' for more.

Also typing 'what' at the Red console prompt will give you a list of all Functions.

You can cut and past these examples into your editor:

;example 1:
Red [needs: 'view]
view [ text "Hello World !"]

;example 2:
Red [ Title: "my program"  needs: 'view]
view [ text "Its a great big world !"  
            button "Quit" [quit]   ]

;example 3:
Red [needs: 'view]
view [backdrop yellow  t: text  yellow "Hello World !" 
 button "Click" [t/text: "Red is good !" ] 

;example 4:
Red [needs: 'view]
view [title "Save my notes"
    t: text ""
    a: area 
    button "Save" [save %notes.dat a/text    t/text: "Saved"]

;example 5:
Red [needs: 'view]
view [title "Load my notes"
    t: text ""
    a: area 
    button "Load" [a/text: load %notes.dat   t/text: "Load"]

;example 6:
Red [title: "Draw Lines" needs: 'view ]
view [ 
    base black 500x300 draw[ pen yellow line 0x150 500x150  
                             pen yellow line 250x0 250x300 
                             pen red line 0x0 500x300 
                             pen red line 0x300 500x0  ] 

;example 7:
Red [ needs: 'view ]
view [title "field test"
      t: text font-color purple "" 
      name: field 
      button "<-- Enter Something and Click" [t/text: name/text]

;example 8:
Red [title: "simple animation"  needs: 'view]
view/no-wait [backdrop cyan size 460x450  t: text font-size 16 font-color red cyan "Hello"]
loop 100 [
    t/offset: t/offset + 4x0   ;;;; move across
    loop 1 [do-events/no-wait wait 0.03]   ;;;; control the speed  
    t/offset: t/offset + 0x4   ;;;; move down

;example 9
;;;; See my   'red programmers Guide'   for more help. 
Red [ title: "Time" needs: 'view]                                       
tim: append form  "Time: " now/time        ;;<-- set tim variable with time
;; stay on top and just show the close button ;;
flags: clear []
       append flags 'modal
       append flags 'popup                          ;;<-- I think popup only works for Windows
;;;;;;;;;;;;;; open the main view ;;;;;;;;;;;;;;;;;;
view/flags [ title "Red Time"
       tim: text font-size 14 font-color red tim
       rate 1 on-time [tim/text: append form  "Time: " now/time]
       ]flags                                                   ;;<--  end main view
You'll need  Red ver: 0.6.1. or later to try this one.

You can get the .exe ready compiled here:Red Apps
download Red version 0.6.2 or later from here:

;example 10
Red [needs: 'view]
view [title "Drop-List"
    t: text "Choose and click ->"
    drop-list data ["You" "Me" "Us" "Them"] 
    [t/text: pick face/data face/selected]
      ]  ;;<--end view

;example 11
Red [needs: 'view]
view [ backdrop brown
    Title "Tab-Panel Example"
    tab-panel 200x100 [
        "Tab 1 " [at 30x30 text font-size 16 font-color red "Panel 1 ...."]
        "Tab 2 " [at 30x30 text font-size 16 font-color blue "Panel 2 ...."]
        "Tab 3 " [at 30x30 text font-size 16 font-color green "Panel 3 ...."]

;example 12
Red [Title: "Draw test" needs: 'view ]
;; circle
 view [base 200x200 draw [pen yellow circle 100x100 40]]
;; square
 view [base 200x200 draw [pen red box 60x60 140x140]] 
;; triangle
 view [base 200x200 draw [pen blue triangle 60x110 140x110 100x50]]
;; polygon 
 view [base 200x200 draw [pen cyan polygon 100x60 120x120  60x140]]
;; box with fill-pen 
 view [base 200x200 draw [fill-pen red box 60x60 140x140]] 
;; circle with fill-pen
 view [base 200x200 draw [fill-pen yellow circle 100x100 40]] 
;; triangle with fill-pen 
 view [base 200x200 draw [fill-pen blue triangle 60x110 140x110 100x50]]
;; line with line-width set to 10
 view [base 200x200 draw [line-width 10 pen blue line 40x100 150x120]]

;example 14
Red [ needs: 'view ]
mm: layout [title "MyMenus" a: area cyan 200x200]
mm/menu: [
    "File" [ "Load" load --- "Save" sv --- "Save As" svas --- "Quit" qt ]
    "Tools" [ "Text Size" txtsz  ]
    "Help" [ "Some Help" hlp ]
mm/actors: make object! [
    on-menu: func [face [object!] event [event!]][ 
    switch event/picked [load [print "load"  a/text: "Load !!!!"]
                                    sv [print "save" a/text:  "Save !!!!"]
                                    svas [print "save as" a/text:  "Save As !!!!"] 
                                    qt [quit  ]            
                                    txtsz [print "Tools tab !"  a/text: "Tools tab !!!!"] 
                                    hlp [print "help tab !"  a/text: "Help tab !!!!"]
                                    ] ] ]        
view mm

;example 15
Red [needs: 'view
         title: "fonts"
view [below
      text italic "Hello"
      text bold "Hello"
      text font-color purple underline "Hello"
      text yellow "Hello"
      text font-color red "Hello"
      text font-size 16 "Hello"
      text font-name "comic sans ms" font-size 14 italic "Hello"
      text italic bold font-color green font-size 16 "Hello"

;example 16
;;;; See my   'red programmers Guide'   for more help. 
Red [needs: 'view]
view [title "Text-List"
    t: text "Click on a month ->"
    text-list 100x100 data[
        "January" "February" "March" "April"
        "May" "June" "July" "August" "September"
        "October" "November" "December"] 
    [t/text: pick face/data face/selected]
      ]  ;;<--end view

;example 17
;; display a 'slider' and a 'progress' and use 'on-change' to update progress data.
Red [ needs: 'view]
      view [title "slider, progress bar"
        slider 100x20 data 10% on-change [p/data: face/data]
        p: progress 100x20 10%        

;example 18
Red [ needs: 'view]
      t: "Hello World !"      
view [size 280x100  title "to binary! / to string!"
      g: text 250x50 t
      button "Binary" [b: to binary! t  g/data: b print b]
      button "String" [b: to string! t  g/text: b print b]

;example 19
Red [ needs: 'view]
;;;; get a keypress ;;;;
view/options [ t: text "hit 'space', 'x', or 'q' keys !"][
        actors: object [on-key: func [key event] [
        if event/key = #"x" [t/text: "'x' key pressed."]
        if event/key = #"q" [t/text:  "'q' key pressed."]
        if event/key = #" " [t/text: "'space bar'pressed."] 
         ]  ]  ]

;example 20
;;;; a bit more in this one, See my   'red programmers Guide'   for more help. 

 Red [needs: 'view]
    view [
    style txt: text                                                     
    group-box "My Group Box" 1  [origin 40x40        
         txt "Name" name: field 200
         txt "Address1" addrs1: field 200 
         txt "Address2" addrs2: field 200
    button "save" [save %mygroupbox.txt reduce [name/text addrs1/text addrs2/text ] t/text: "*Saved*"] 
    button "load" [attempt [set [nm ad1 ad2]  load %mygroupbox.txt]  
         attempt [name/text: nm] 
         attempt [addrs1/text: ad1]  
         attempt [addrs2/text: ad2]  
         t/text: " *Loaded* "] 
         t: text font-size 16 font-color red "                "

;example 21
Red [needs: 'view]
view [title "Panels"  size 460x450
panel red [size 100x100 below text red "Panel one" check red  txt: text red ""]
panel blue [size 100x100 below text blue "Panel two" radio blue]
panel yellow [size 100x100 below text yellow "Panel three" text yellow font-size 18 "Hello"]
panel brown [size 100x100 below text brown "Panel four" 
                            button "do something" [txt/text: "Did Something"]]
at 200x20 panel cyan [size 200x400 below text cyan "Panel five" field area 
                            t: text "Some text here."    drop-down progress 40% slider 
                           button "3 Second Quit" [t/text: "Quit in 3 secs ...." wait 3 quit]]

;example 22  
;;;; An image viewer - make sure you have some image files in the folder.
Red [needs: 'view]
folder: read %.
count: 0
foreach file folder [ 
    foreach ext [".jpg" ".gif" ".png" ".bmp"] [ 
        if find file ext [
        i: load file
        view/no-wait/options [title "Image Viewer" below    
        t: text font-size 12 "Click or Tap image>>"
        image i [unview]
                      ]   [actors: object [on-close: func [face event][quit]]]
        count: count + 1  
        t/text: append form "Click or Tap image> " count  
if count = 0 [view [text "No image files found !"]]


;example 23
Red [needs: 'view]
;; stay on top and just show the close button ;;
flags: clear []
       append flags 'modal
       append flags 'popup 
view/flags [backdrop purple
     title "MyCalculator"
     f: field brown 190x40 font-size 20 font-color white "" return 
     style b: button font-size 20 italic font-color red 40x40 
     [append f/text face/text]
     b "1"  b "2"  b "3"  b " + "  return 
     b "4"  b "5"  b "6"  b " - "  return 
     b "7"  b "8"  b "9"  b " * "  return 
     b "0"  b "."  b " / "  b "=" 
     [attempt [ansr: form do f/text append clear f/text ansr]] 

;example 24
;;Maximize/Resize a view
Red [needs: 'view]
view/flags [size 400x300 title "resize and max" text "Hello"] 'resize

;example 25
;; needs 'red-062.exe' or later.
Red [needs: 'view]
view [below h1 "Hello" h2 "Hello" h3 "Hello" h4 "Hello" h5 "Hello"]

;example 26
;; Sets focus to a face. If used on more than one face, only the last one will get focus.
;; in this example 'area' has focus.
Red [needs: 'view]
view [ area focus 200x200   f: field  80x25 ]

;example 27
Red [Needs: 'View]
view/flags [backdrop black size 400x80 
f: h1 blue font-color red "Red Programming !!" on-down [quit]      ;; click on text to quit
rate 1 on-time [either f/text = "" [ f/text: "Red Programming !!"] [f/text: "" ]  ] 
] 'no-title

;example 28
Red [needs: 'view]
 view [
base 500x500 draw [
pen off      ;; <-- get rid of border
fill-pen diamond 250x250 0 400 red green blue yellow purple cyan silver orange box 0x0 500x500

;example 29
Red [needs: 'view]
 view [
base 500x500 draw [
pen off      ;; <-- get rid of border
fill-pen radial 250x250 0 400 red green blue yellow purple cyan silver orange box 0x0 500x500

;example 30
;;;;A usable tiny Red editor and Interpreter in less than 10 lines of script
Red [needs: 'view author: Alan Brack]
view/flags  [title "Tiny Red Editor/Interpreter" below  t: text  "My Editor"  200x30  a: area 500x400  {Red [ ] 
          view/flags  [text "Hello World" ]'modal }   text ""  across
          button "Save" [if sf: request-file/save  [unless suffix? sf [append sf]  
          write sf a/text  t/text: "Saved." ] ]
          button "Load" [if Lf: request-file [a/text: read Lf  t/text: "Loaded."  ] ]
          button "Run" [ do a/text  t/text:  "Try some different code" ]
          button "Clear" [a/text: ""   t/text: "Try some more Red code" ]   ] 'modal

See my  Red Apps  for a far more advanced Red editor.

;example 31
;; you'll need the latest automated build to use 'set-focus'.
Red [needs: 'view]
view [below a: area focus 100x100  f: field  80x25 
          button "field"  [set-focus f  f/color: orange a/color: white] 
          button "area"  [set-focus a  a/color: orange f/color: white] 

;example 32
;; six triangles.
Red [needs: 'view]
view [title "Six Triangles" 
base 400x300 blue 
draw [pen red fill-pen yellow triangle 266x150 190x120 140x138 
fill-pen yellow triangle 214x220 140x138 145x174 
fill-pen yellow triangle 259x186 215x180 214x220 
fill-pen yellow triangle 259x186 266x150 215x180 
fill-pen yellow triangle 214x220 215x180 140x138 
fill-pen yellow triangle 266x150 140x138 215x180 ]  

;example 33
Red [needs: 'view   title: "A Mouse Click Thing"] 
t: 0
random/seed now/time   ;;;; seed the random generator 
v: View/no-wait/flags [ title "**** Click on it ****" backdrop red below  h1 font-size 18 "Click Me !!" on-down [unview view/flags [h1 "Success !!"]'modal ] 
rate 2 on-time [x: random 1400  y: random 800  oset: as-pair x y  v/offset: oset  t: t + 1  if t > 20 [unview view/flags [h1 "Failed !!" ]'modal ]]
] ['modal 'no-buttons]     ;;;; end of main view 
v/offset: 20x1000  
;;;; you could change 'rate 2'  to  'rate 1'  if you cant catch it.

;example 34
;;;;An alarm clock - I called  'user32.dll,MessageBeep'  to produce the alarm sound, I tested it on PC, ;;;;laptop and tablet with Win 7, Win 8.1, Win 10. without any problems.
Red [ title: "Alarm Clock" Author: "Alan B" needs: 'view]     
h2: -1  m2: -1                        
tim: append form  "Time: " now/time        ;;<-- set tim variable with time

;;;;;;;;;;;;;; open the main view ;;;;;;;;;;;;;;;;;;
view/flags [ title "Red Alarm Clock"
       tim: h3 font-color red tim
       rate 1 on-time [tim/text: append form  "Time: " now/time t: now/time 
if t/hour = h2 [ if t/minute = m2 [call "start/min rundll32 user32.dll,MessageBeep"]] ]  return
       text "------------------------------------" return  h4 font-color blue "Alarm ...."  ist: h4 italic font-color red bold ""  return
h: text 100x25 "Select hour ->"
text-list 45x25 data ["01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" 
"13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "00"] 
[h/text: pick face/data face/selected h2: to-integer h/text if h2 > -1 [ if m2 > -1 [ist/text: "  *SET*" ] ] ] return  ;;;;<--  select hour and to-integer it.
m: text 100x20 "Select minutes ->"
text-list 45x20 data ["00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" 
"15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" 
"35" "36" "37" "38" "39" "40"  "41" "42" "43" "44" "45" "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59"]
[m/text: pick face/data face/selected m2: to-integer m/text  if m2 > -1 [if h2 > -1 [ist/text: "  *SET*" ] ] ]     ;;;; <-- select minute and integer it.
return  button "Stop/Reset" 180x20 [ if h2 > -1 [if m2 > -1 [h2: -1  m2: -1 h/text: "Select hour ->"  m/text: "Select minutes ->" ist/text: ""]] ]  
]['modal 'popup]                                     ;;<--  end main view

;example 35
;;;;A foreach thing .... try it and you'll get it !.
;;;;See my example 22 for more foreach.
Red [needs: 'view]
foreach info ["Us"  "Them"  "Me"  "You"] [
View [ backdrop khaki  h1 info ]                                           ;;<-- display result in a view

;example 36
;;;; unview
;;;; multiple views
Red [needs: 'view]
v1: view/no-wait [backdrop orange size 300x300 h5 "Hello"] v2: view/no-wait [backdrop green size 250x200 h5 "World"] v2/offset: 700x450 v3: view/no-wait [backdrop yellow         button "unview/only v1" [unview/only v1]
        button "unview/only v2" [unview/only v2]         button "unview/all" [unview/all] return         text "An unview thing ! " ] v3/offset: 800x500 ;;;;;;;;;;

;example 37
;;;; a very basic parse example
;;;; see my beginners guide or my links page for more
Red [needs: 'view] myString: "Red is my favorite programming language" view [title "A very basic parse example" backdrop linen below h4 font-color red myString 450 button "parse1" [parse myString [thru "programm" change "ing" "ers" ] ] button "parse2" [parse myString [to "programm" change "programm" "Cod"] ] button "Parse3" [parse myString [to "my" change "my" "OUR"] ] ]

;example 38
;; disabled - enabled - hidden - visible
Red [needs: 'view] view [backdrop purple t: h5 font-color red hidden "Hello !" b: button disabled "quit" [quit] button "enab/disab" [b/enabled?: complement b/enabled?] button "vis/hid" [t/visible?: complement t/visible? ] ]

;example 39
;; It's a beep thing !
;; piano will struggle with a less powerful system
;; the idea is to demonstrate 'on-down' and 'call' and not to be a serious piano app
;; click if using a mouse or tap screen if using a tablet
Red [needs: 'view title: Piano author: Alan B.] view/flags [ backdrop khaki title "Red Piano"
return button "Do" 50x150
    on-down [call "start/min powershell [console]::beep(290,250) " n/text: "C"] button "Ra" 50x150
    on-down [call "start/min powershell [console]::beep(330,250) " n/text: "D"] button "Me" 50x150
    on-down [call "start/min powershell [console]::beep(360,250) " n/text: "E"] button "Fa" 50x150
    on-down [call "start/min powershell [console]::beep(390,250) " n/text: "F"] button "So" 50x150
    on-down [call "start/min powershell [console]::beep(440,250) " n/text: "G"] button "La" 50x150
    on-down [call "start/min powershell [console]::beep(480,250) " n/text: "A"] button "Te" 50x150
    on-down [call "start/min powershell [console]::beep(530,250) " n/text: "B"] button "Do" 50x150
    on-down [call "start/min powershell [console]::beep(580,250) " n/text: "c"] return return h4 italic font-color blue "Note played = " n: h4 yellow font-color red "" 30x30 return h4 " ---------------------------------------------------" ]['modal 'no-min]

;example 40
;; tab focus from face to face
Red [needs: 'view] ;;;; get tab keypress to move focus ;;;; e: 0 view/options [
                f1: field on-down [e: 0] focus return                 f2: field on-down [e: 1] return                 f3: field on-down [e: 2] return                 f4: field on-down [e: 3] return                 h5 "Hit 'tab' key !" ] [ actors: object [on-key: func [key event] [     if event/key = (tab) [e: e + 1                                   if e = 1 [set-focus f2]                                  if e = 2 [set-focus f3]                                   if e = 3 [set-focus f4]                                   if e = 4 [e: 0 set-focus f1 ] ] ] ] ]

;example 41
;;using 'loose', 'on-up', 'offset' and 'mold' ;;And boundaries, there's always boundaries. Red [needs: view] view [title "Drag/Drop" size 300x200 b: box red "Drag/Drop" loose on-up [ if b/offset/x > 220 [print "X right side boundary" b/offset/x: 220] if b/offset/x < 0 [print "X left boundary" b/offset/x: 1] if b/offset/y > 120 [print "Y bottom boundary" b/offset/y: 120] if b/offset/y < 0 [print "Y top boundary" b/offset/y: 1] b/text: mold b/offset print b/offset ] ]

;example 42
;;using on-close can be useful
;;See my Red beginners guide for more on 'unview'
Red [needs: view] view [ size 300x200 title "Close from the title bar" on-close [view [ h5 "You just closed a window" ] ] h5 font-color red "Close, Unview and Quit" return text "Using on-close gives control when using a close from the title bar" 200x30 return text "Using unview will terminate back to the Red console" 200x30 return text "Using quit will terminate program completely" 200x30 return button "Click to unview" [unview] button "Click to quit" [quit] ]

;example 43
;;The rich-text box
Red[needs: 'view] view [ title "My Rich Text box" rich-text 400x100 data [ i b "This" /b font 18 red " is a " /font blue "rich text box" /i ] ]

;;More on rich-text here:

;example 44
;;using map! with 'put' 'extend' and 'select'
Red [needs: 'view] m: make map! ["Jenny" 36 "Sandra" 40 "Summer" 22 "Maddy" 25] t: to-string m print m view/flags [ title "My Map" backdrop brown t: text t 100x130 at 200x230 age: text "" return button "Extend (add Neil and Louise to map)" [ extend m ["Neil" 45 "Louise" 38 ] t/text: to-string m print "-----------" print m ] return button "Put (add Alan to the map)" [ put m "Alan" 50 print "-----------" print m t/text: to-string m ] return button "Select (print Sandras age)" [ a: to-string select m "Sandra" age/text: rejoin ["Age: " a ] print "------------" print a] return button "Put (change Sandras age)" [ put m "Sandra" 35 print "------------" print m t/text: to-string m age/text: "Age changed !" ] ] ['modal 'no-min]

;example 45
;;;; creates checksums - gets the hash and size of files/zips etc.
Red [needs: 'view author: "Alan Brack"] view/flags [title "My checksum getter" backdrop linen do [if not cs: request-file [ quit] ] ;;;; get a dialog box ttl: text "" 500x30 return h: text font-size 14 font-color red "" return t2: text "" 450x70 return sz: text "Size: " 350 return ;;;;;;;;;;;; MD5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; button "MD5" [t: to-hash checksum cs 'MD5 s: size? cs ;;;; get checksum & file size h/text: "MD5" ttl/text: rejoin ["File: " to-string cs ] ;;;; display hash used & the file t2/text: to-string t ;;;; display checksum sz/text: rejoin ["Size: " to-string s] ] ;;;; display size ;;;;;;;;;;;;; SHA256 ;;;;;;;;;;;;;;;;;;;;;;; button "SHA256" [t: to-hash checksum cs 'SHA256 s: size? cs h/text: "SHA256" ttl/text: rejoin ["File: " to-string cs ] t2/text: to-string t sz/text: rejoin ["Size: " to-string s] ] ;;;;;;;;;;;;; save ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; return button font-color red "Save to text file" [if not sf: request-file/save [ quit ] ;; get save dialog box unless suffix? sf [append sf %.txt] write/lines sf reduce [ttl/text " " t2/text " " sz/text ] ] ][ 'no-min]

;;;; My script with  SHA1, SHA256, CRC32 and TCP also included is on my 'Red Scripts Page'

;example 46
;; Had a lot of questions about sizing an image and keeping its aspect ratio, so here's the answer....
;;So we have already set the height based on our screen size and centred the image, now we need to
;; re-size it keeping the aspect ratio .... 'new height * original width / original height = the new width'
;; I've changed the example to centre, and adjust image size keeping aspect ratio,  based on screen size.
;;;; a slideshow.... it displays all images in the default folder. ;;;; displays bmp, jpg, png, and gif images. Red [needs: 'view author: Alan Brack date: 02/11/2018] r: 0:0:4 cnt: 0 cnt2: 0 scrn: system/view/screens ;; <-- get the screen size. folder: read %. random/seed now/time ;;;; main slideshow ;;;; forever [ foreach file random folder [ foreach ext [".jpg" ".gif" ".png" ".bmp"] [ if find file ext [ ran: random linen purple yellow linen red blue white black i: load file pos: scrn/1/size - i/size / 2 ;; <-- load and centre image
orig: i/size                  ;; <-- original size of image
img:  orig                          ;; <-- get the image size and keep orig
rszy: scrn/1/size     img/y:  rszy/y - 10   ;;<-- re-size the height of image
;;;;;;;;;;;; adjust width to keep aspect aspect ratio based on new height ;;;;;;;;;;;;;;;;
wdth: img/y * orig/x / orig/y    img/x: wdth    ;; <--  new height * original width / original height
pos: scrn/1/size - img / 2    ;; <-- centre image
cnt: cnt + 1 view/flags [size scrn/1/size backdrop ran at pos image i img [quit] rate 0:0:3 on-time [unview] ;; <-- display image and set timer ] ['modal 'no-border] ;; <-- end of view block ] ;; <-- end of if find block ] ;; <-- end foreach ext block ] ;; <- end of foreach file block ;;;;;; this bit detects for no images in the folder ;;;;;; ;;;;;; very important as we are in a forever loop ;;;;; cnt2: cnt2 + 1 if cnt2 > cnt [view/flags [on-close [quit] title "Warning !" h1 font-color red "No image files in this folder" return button "Quit" [quit] ] ['modal 'popup] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
] ;; <-- end of forever block

;;;; A far more advanced version is on my 'example red scripts' page.

;example 47
;; on-over  and  on-down
Red [needs:'view author: Alan Brack date: 02/05/2019] view [ t: area 100x100 red on-down [print "Ok you clicked it !" t/text: "OK !"]
on-over [print "It's Over !" t/text: "Over !"]

or see my 'Red Beginners Guide, here'  including plenty more examples.

If you need help, you are welcome to email me and I will try to help.

free visitor counter