' ------------------------------------------------------------------------------------ ' SaveAndLoadKw.vbs ' - Save the keywords to a text file ' - Create a new album ' - Add the keywords by reading back the generated text file ' ------------------------------------------------------------------------------------ Option Explicit app.ClearTrace Const ForReading = 1, ForWriting = 2 dim alb, i, n, kw, alb2, s set alb = app.GetCurrentAlbum n = alb.nbKeyword app.Trace "This album has " & n & " keywords" Dim fso, f, m Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile( "Keywords.txt", ForWriting, True) app.Trace "Saving the keywords in a text file" for i=0 to n-1 set kw = alb.getKeyword(i) f.WriteLine kw.sName app.Trace chr(9) & kw.sName next f.Close app.Trace "Creating a new empty album..." set alb2 = app.NewAlbum app.Trace "Adding the keywords to the new album..." Set f = fso.OpenTextFile( "Keywords.txt", ForReading) Do While f.AtEndOfStream <> True s = f.ReadLine set kw = alb2.addKeyword( s ) app.Trace chr(9) & s Loop f.Close app.Trace "Done !"