// text register 10 holds the directory path - ie c:\letters // text register 11 holds the filespec - ie *.doc // numeric register #10 holds the "included subdirectories ?" flag : 0=no 1=yes // text register 20 holds current directory path ie c:\letters // text register 21 holds current filename ie moremoney.doc // text register 22 holds the whole path and filename of current file ie c:\letters\moremoney.doc // numeric register #30 holds starting buffer # // numeric register #31 holds buffer # of temp buffer for dir listing // initialize registers #30=buf_num // save current buffer # #31=buf_free // find a free buffer to hold dir listing #10=0 // set include subdirectories flag to no // get user input get_input(10,"Enter Directory Path = ",nocr+statline) // get directory path get_input(11,"Enter FileSpec = ",nocr+statline) // get filespec if(reg_size(11)==0) {reg_set(11,"*.htm")} // if no filespec, assume *.* #10=get_num("Include Subdirectories ? 0=no 1=yes : ") // ask about subdirectories // get directory listing buf_switch(#31) // switch to temp buffer buf_empty(ok) // empty it file_save_as("c:\dirlist.tmp",nomsg+ok) // give it a filename to enable auto-buffering reg_set(30,@10) // set t-reg 30 to directory path reg_set(30,"\",append) // add a \ reg_set(30,@11,append) // add the filespec in t-reg 11 if(#10==1) {reg_set(30," -s",append)} // add the -s if subdirectory flag is set out_ins() // re-direct output to temp buffer directory(@30,suppress+count,1) // dump dir, one column, no subdir or hidden names out_ins(clear) // turn off output re-direct begin_of_file() // goto start of buffer repeat(all) { // repeat loop 1 // get directory path search("Directory ",advance+noerr) // search for word Directory if(return_value==0) {break} // didn't find it, exit repeat loop 1 block_begin(cur_pos) // set block begin to current position block_end(eol_pos) // set block end to end of line postion reg_copy_block(20,block_begin,block_end) // shove directory path into t-reg 20 repeat(all) { // repeat loop 2 // get a filename goto_line(cur_line+1) // goto start of next line match("|F") // match letter or digit if(return_value<>0) { // if no filename on current line, do break // exit repeat loop 2 } // end of if block_begin(cur_pos) // set block begin to current position block_end(eol_pos) // set block end to end-of-line postion reg_copy_block(21,block_begin,block_end) // shove filename into t-reg 21 reg_set(22,@20) // set t-reg 22 to current dir path reg_set(22,"\",append) // add a \ reg_set(22,@21,append) // add current filename buf_switch(#30) // switch back to original buffer //-------------------------------------------------------------------------- // start of user's code to process filename in t-reg 22 // do not alter text or numeric registers in the range of 10 to 39 buf_empty(ok) file_open(@22) goto_pos(0) repeat(all) { search(&",noerr) block_end(cur_pos+1) #51=cur_pos #52=0 goto_pos(#50) search_block("height=",block_begin,block_end,noerr) if(return_value==1) {#52=#52+1} goto_pos(#50) search_block("width=",block_begin,block_end,noerr) if(return_value==1) {#52=#52+1} if(#52==2) {break} goto_pos(#50) search_block(&SRC="&,block_begin,block_end,advance+noerr) #53=cur_pos search(&"&,noerr) #54=cur_pos block_begin(#53) block_end(#54) reg_copy_block(40,block_begin,block_end) buf_switch(33) buf_empty #55=0 reg_set(42,@20) reg_set(42,"\",append) reg_set(42,@40,append) file_open(@42,browse) reg_set(41,file_ext) if(reg_compare(41,".jpg")==0) { goto_pos(163) #40=cur_char*256 // multiple the height high byte by 256 goto_pos(164) #40=#40+cur_char // add the low byte goto_pos(165) #41=cur_char*256 // multiple the width high byte by 256 goto_pos(166) #41=#41+cur_char // add the low byte #55=1 } if(reg_compare(41,".gif")==0) { goto_pos(7) #41=cur_char*256 // multiple the width high byte by 256 goto_pos(6) #41=#41+cur_char // add the low byte goto_pos(9) #40=cur_char*256 // multiple the height high byte by 256 goto_pos(8) #40=#40+cur_char // add the low byte #55=1 } buf_empty(ok) if(#55==0) {break} num_ins(#40,left+nocr) #56=cur_pos begin_of_file() block_begin(cur_pos) block_end(#56) reg_copy_block(50,block_begin,block_end) // height buf_empty(ok) num_ins(#41,left+nocr) #56=cur_pos begin_of_file() block_begin(cur_pos) block_end(#56) reg_copy_block(51,block_begin,block_end) //width buf_empty(ok) reg_empty(52) reg_set(52,& HEIGHT="&) reg_set(52,@50,append) reg_set(52,&" WIDTH="&,append) reg_set(52,@51,append) reg_set(52,&" &,append) buf_switch(#30) goto_pos(#54+1) reg_ins(52) } // end of repeat file_save(nomsg) // end of user's code //-------------------------------------------------------------------------- buf_switch(#31) // switch back to temp buffer } // end of repeat loop 2 } // end of repeat loop 1 // macro shutdown buf_switch(#31) // switch to temp buffer buf_quit(ok) // kill it buf_switch(#30) // goto original buffer file_delete("c:\dirlist.tmp",ok+noerr) // delete temp file block_begin(clear) // clear any stray block markers update() // update screen - end of macro