APSF //- Add NSOG ratings to user-defined object field //- Requires the NSOG_Ratings.txt file available from: //- //- //- Will add the rating to User Field 1. If you want to use another //- field, change the UserField constant to 1, 2, 3, or 4. //- //- V1.1 (10 June 2007). Handles empty lines in the ratings file. //- V1.2 (11 March 2007). Deletes entries already existing in the user field. //- V1.3 (19 Feb 2009). Does not delete existing entries. Replaces entries of form "*n" with "n*". dim f as APTextFile, id(-1), rating(-1), s(-1),rs,existing as string, i,idx as integer const UserField = 1 const NoRating = "" const NSOGColumnHeading = "NSOG" // Open the NSOG_Ratings.txt file print "Select the ""NSOG_Ratings.txt"" file" f=ReadTextFile if f=nil then return // Read the file into id() and rating() while not f.EOF s=Split(f.ReadLine,chr(9)) if ubound(s)=1 then id.Append s(0) rating.Append s(1) end if wend f.Close UserHeading(UserField)=NSOGColumnHeading for i=1 to nObjects idx=id.IndexOf(Obj(i).ID) if idx<0 then idx=id.IndexOf(Obj(i).Name) if idx>=0 then rs=rating(idx) else rs=NoRating existing=Obj(i).User(UserField) if left(existing,1)="*" then existing=mid(existing,2)+"*" if existing="" then existing=rs Obj(i).User(UserField)=existing next bleep