We strongly recommend that you write your own custom functions as an rul file. You only need to # include them for later use, and you can also accumulate the functions you write at ordinary times, it is also convenient to manage this. Your rul files will become larger and larger over time, and your accumulation will become more and more! It also saves time to open the previous project when writing code and find it, which is troublesome and difficult to maintain!Next, I will give my usual method. Write all the functions you normally write to a coustfunction. URL. The content of this file is as follows: /*************************************** ****************** * * File name: coustfunction. url * Author :***** * Completion date: * Description: User-Defined Function file (This file contains two user-defined functions: 1-traversal directory * 2-Traverse User-Defined files) * 3-remove the read-only and hidden attributes of the specified file * 4-end the system process * Modification record: * Data Structure: * Note: * **************************************** *****************/ /*----------------------------------------------------------------- Name: findcoustfile Function: gets the size and date of the custom file under the specified directory and outputs it to findcoustfile. Snap. Input parameter: 1 specifies the directory to be searched 2. Specify the file type to be searched. Wildcards are supported, for example :*.*;
Output parameter: The searched result is written to findcoustfile. Snap in the current directory. /*---------------------------------------------------------------*/
Export prototype findcoustfile (byref string, byref string ); Function findcoustfile (svdir, svfile)
List listid; Number nlinenumber; Number count; String svresult; Number nvfilehandle; Number nvresult; String svdata; Number nvitem; String TMP; String svtime; Begin
Listid = listcreate (stringlist ); Listgetfirstitem (listid, nvitem );
While (findallfiles (svdir, svfile, svresult, continue) = 0)
Getfileinfo (svresult, file_size, nvresult, svdata ); Getfileinfo (svresult, file_date, nvresult, svdata ); Getfileinfo (svresult, file_time, nvresult, svtime ); Numtostr (TMP, nvresult ); Svresult = svresult + "" + TMP + "|" + svdata + "//" + svtime; Listgetnextitem (listid, nvitem ); Listaddstring (listid, svresult, after ); Endwhile; Listgetfirststring (listid, svresult );
Openfilemode (file_mode_append ); Createfile (nvfilehandle, targetdir, "findcoustfile. Snap ");
Nlinenumber = 0; If (fileinsertline (targetdir ^ "findcoustfile. Snap", svresult, nlinenumber, after) <0) then Abort; Endif;
Count = listcount (listid );
For nlinenumber = 1 to count-1
Listgetnextstring (listid, svresult ); Fileinsertline (targetdir ^ "findcoustfile. Snap", svresult, nlinenumber, after );
Endfor; Listdestroy (listid ); End; For your own use, you only need # Include "coustfunction. url" Then you can directly call your own functions! |