1
2
3
4
5
6
7
8
9
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
############################################################################
#
# File: mover.icn
#
# Subject: Program to move files from one name to another
#
# Author: Ralph E. Griswold
#
# Date: January 29, 1997
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# Program to allow interactive moving (renaming) of files.
#
############################################################################
#
# Requires: UNIX
#
############################################################################
#
# Links: io, vsetup
#
############################################################################
link io
link vsetup
global names
global root
global vidgets
procedure main()
init()
GetEvents(root, , shortcuts)
end
procedure init()
vidgets := ui()
root := vidgets["root"]
names := vidgets["names"]
VSetItems(names, filelist())
end
procedure file_cb(vidget, value)
case value[1] of {
"quit @Q": exit()
}
end
procedure names_cb(vidget, value, x)
if /value then return # ignore unselect
if OpenDialog("Rename:", value) == "Cancel" then fail
if system("mv " || value || " " || dialog_value ||
" >/dev/null 2>/dev/null") ~= 0 then {
Notice("Renaming failed.")
fail
}
VSetItems(names, filelist())
return
end
procedure shortcuts()
end
#===<<vib:begin>>=== modify using vib; do not remove this marker line
procedure ui_atts()
return ["size=600,400", "bg=gray-white"]
end
procedure ui(win, cbk)
return vsetup(win, cbk,
[":Sizer:::0,0,600,400:",],
["file:Menu:pull::0,1,36,21:File",file_cb,
["move @M","quit @Q"]],
["line1:Line:::1,26,598,26:",],
["names:List:w::26,48,557,335:",names_cb],
)
end
#===<<vib:end>>=== end of section maintained by vib
|