[REBOL] Re: Simple newbie questions
From: arolls:bigpond:au at: 30-May-2001 17:31
Hi Jamie,
have a look at this:
rebol [
Title: "Jamie's Rename"
File: %jamie-rename.r
Date: 1-Jun-2001
Version: 1.0.0
Needs: [view]
Author: "Anton Rolls"
Language: 'English
Purpose: {}
ToDo: {
-
}
History: [
1.0.0 [30-May-2001 {First version} "Anton"]
]
Notes: {}
]
path: %./ ; initial path is current directory
files: sort read path
view lay: layout [
backdrop effect [gradient 60.0.150 60.10.60]
file-list: text-list data files [
; this is the action when we click an item in the text-list
print ["picked" file-list/picked]
find-f/text: either empty? file-list/picked [
copy "" ; user maybe used ctrl-click to unpick everything
][
last file-list/picked ; get the last item clicked on
]
show find-f
]
;desired function is to cause the text-list to update
;with the contents of the new path.
across
label 53 "Path"
path-f: field 139 form path [
print "path change"
either error? err: try [
; try this
files: sort read path: to-file path-f/text
][
; we had an error
path-f/text: copy ""
file-list/data: copy []
][
; everything went ok
path-f/data: path
file-list/lines: sort read path
]
show [path-f file-list]
]
return
label "Find" 53
find-f: field 139
return
label "Replace"
replace-f: field 139
return
button 200 "Rename (simulated)" [
; simulate the rename
print rejoin ["rename %" find-f/text " %" replace-f/text]
;this is the real thing
;;rename to-file find-f/text to-file replace-f/text
]
]