home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
filemanager
/
director_1
/
!Director
/
Menus
/
Files
/
TreePick
(
.txt
)
< prev
Wrap
RISC OS BBC BASIC V Source
|
1995-06-23
|
2KB
|
91 lines
>TreePick
By Dave Lawrence 22Jun95
TreePick is a magic Dynamic Menu that allows you to do things like:
TreePick -type Sprite -dir Root:Backdrops -command "Backdrop -tile %0"
It (recursively) makes menus of files of the given type starting from
'dir'. When one is clicked on, the command is executed with the
filename substituted as expected.
$;" at line ";
buf 512
getargs
"OS_ReadArgs", "type/k,dir/k,command/k", in$, buf, 512
Get file type, look up type number, make sprite name
type$=
str0(!buf)
"OS_FSControl",31,type$
,,file_type
.type_spr$ = "small_"+
"000"+
~file_type,3)
Just get the directory
dir$=
str0(buf!4)
Get the command, rebuild command with %%s replacing %s, make command to pass to sub-directories
command$=
str0(buf!8)
sub$=""
i=1
command$
command$,i,1)="%" sub$+="%"
sub$+=
command$,i,1)
[sub$="Dynamic:/Director:Menus.Files.TreePick -type "+type$+" -command """""+sub$+""""""
!%menu=
swi_number("Director_Menu")
"+endmenu=
swi_number("Director_EndMenu")
#)option=
swi_number("Director_Option")
$+command=
swi_number("Director_Command")
%,subargs=
swi_number("OS_SubstituteArgs")
&%dash=
swi_number("Director_Dash")
Read canonicalised path name and take menu name from the current leaf
"OS_FSControl",37,dir$,buf,,,512
canon$=
str0(buf)
"DirectorParsePath "+canon$
menu,"<Director$CurrentLeaf> TreePick -temp"
"OS_GBPB",12,dir$,buf,1,i,128,0
,,,read,i
read=1
leaf$=
str0(buf+24)
path$=dir$+"."+leaf$
buf!16
buf!20 = file_type
7/
option, leaf$+" -sprite "+type_spr$
89
subargs, path$, buf, 512, command$,
command$
command, buf
:
<O
option, leaf$+" -sprite small_dir -sub "+
34+sub$+" -dir "+path$+
i=-1
*EndMenu
*Set Director$Menu TreePick
swi_number(swi$)
"OS_SWINumberFromString",,swi$
swi%
F =swi%
getargs
"OS_GetEnv"
quit=
A$,"-quit")
quit=0 quit=
A$,"-QUIT")
A$,quit+6)
A$," ")
A$,spc+1)
str0(A)
R A$=""
?A<>0
A$+=
U A+=1