********* * * This definition works on files that are produced by the * the AmigaDOS LIST command. It will EDIT the file listed * on the current cursor line if it's a file and will * DIRECTORY it if it's a directory. * * Trick Searches backwards for the string 'Directory "' to * find the full path for the selected file. Then sets * ENVIRONMENT 9 to that value. If the path ends in a * directory name which is not terminated by a slash (/) * then inserts a slash. * * Note if the 'Directory "' string is not found then the * file is assumed to be in the current directory. ie. * no path * * Then if the word following the selected filename is * 'Dir' then sets ENVIRONMENT 8 to 'dir' otherwise sets * it to 'edit'. * * Then executes a line derived from ENVIRONMENTs 8 and 9 * and the selected file name. * ********* DEF s-f4 = [store mark] [unmark] DEF s-f4 + [store cursor] DEF s-f4 + [if] [locate] 'Directory "' 'c-' [right 11] DEF s-f4 + [if char in] '="' * no directory name DEF s-f4 + [execute] 'set envir 9 \'\'' * clear environment variable DEF s-f4 + [else] DEF s-f4 + [mark char] * otherwise, copy dir name DEF s-f4 + [end char] '-"' [left] DEF s-f4 + [if char in] '-:/' * if last char in name is not : DEF s-f4 + [right] [insert mode] '/' * then append / DEF s-f4 + [left] DEF s-f4 + [end if] DEF s-f4 + [mark char] DEF s-f4 + [command cursor] [delete line] DEF s-f4 + 'set envir 9 \'' [import mark] * copy name to command line DEF s-f4 + [end line] '\'' DEF s-f4 + [execute] * set env 9 to dir name DEF s-f4 + [end if] DEF s-f4 + [else] * dir name not found DEF s-f4 + [execute] 'set envir 9 \'\'' * make it blank DEF s-f4 + [end if] DEF s-f4 + [data cursor] DEF s-f4 + [recall cursor] [begin line] [unmark] DEF s-f4 + [mark char] [end word] [left] [mark char] DEF s-f4 + [tab word] DEF s-f4 + [if string is] 'Dir' * dir on current line DEF s-f4 + [execute] 'set env 8 \'dir \'' * env 8 is dir command DEF s-f4 + [else] DEF s-f4 + [execute] 'set env 8 \'edit \'' * otherwise, it's a file, ie. edit command DEF s-f4 + [end if] DEF s-f4 + [command cursor] [delete line] DEF s-f4 + [envir 8] [envir 9] [import mark] * execute the combination of DEF s-f4 + [data cursor] * command, dir, and file name DEF s-f4 + [recall mark] [forget mark] DEF s-f4 + [recall cursor] [forget cursor] DEF s-f4 + [down] DEF s-f4 + [execute]