file2list

Presents a directory for the user to select and open a file into a memory list.

Syntax

list file2list(server,file-path,file-suffix)
int     server
string  file-path,file-suffix

Description

These parameters are used to display the appropriate files for the user who can then open one of them.

server

integer that represents the server's operating system.

file-path

path to the directory with the files of interest.

file-suffix

suffix for file names of interest.

Example

file2list(), edit_text(), and list_file( enables the user to open, edit, and save files. These tools are most useful to chemists and biologists who need to manipulate hit lists of chemical structures. The following code could be used to edit a list of structures. Note that the server and path are specified in cis.ini and assigned to global variables in the main trigger. The initialization file for the following menu item trigger would look like this

 server 1                      /* for unix */
 user_dir /usr2/trim/mcgreevy  /* McGreevy's directory */

 {
 char suffix[3];
 list old_list;
 list new_list;

 old_list= file2list(G.server_os,G.user_dir,"wrn");
                    /* returns 'hit list' of WR Structure Numbers */
 if (list_rows(old_list))          /* list empty if user hit cancel    */
   new_list= edit_text(old_list,0,0,70,20,7,true);     /* edit list */

 if (char_list_cmp(old_list,new_list)){ /* true old list changed */
   new_list= distinct_field(new_list,0); /* remove duplicates */
            /* and blank rows */
   suffix= substr(G.fname,instr(G.fname,".")+1,2);
   G.fname= filename(G.fname);   /* give filename box to user       */
   if (G.fname)                  /* user entered fname & not cancel */
     list_save(new_list,G.user_dir,suffix);
   }                                      /* end char_list_cmp() */
 escape(input);
 }


Updated 19 May 1999. Copyright DataAspects Corp. 1998-1999