local fh = file.open(arg(1), "r") local Str, Counter, Temp, ThumbSuffix, AddBefore, AddAfter, ThumbSubDir local INIfile = "d:\Utils\PowerPro\scripts\ini\HTMLImageWithThumb.ini" local BigImage, i SetString Quote " if(fh > 0) do for(not(file.eof(fh))) Str = file.readstring(fh) if(Str != 0) Counter = Counter + 1 endfor else messagebox("ok error", "File not opened", "FILE plugin error") quit endif v = vec.create(Counter) if(v == 0) do messagebox("ok error", "Vector not created", "VEC plugin error") quit endif if(ini.check_exists(INIfile, "Configuration", "ImagePath") != 3) do ImagePath = "" else ImagePath = ini.get(INIfile, "Configuration", "ImagePath") endif if(ini.check_exists(INIfile, "Configuration", "ThumbSuffix") != 3) do ThumbSuffix = "_t" else ThumbSuffix = ini.get(INIfile, "Configuration", "ThumbSuffix") endif if(ini.check_exists(INIfile, "Configuration", "AddBefore") != 3) do AddBefore = "" else AddBefore = ini.get(INIfile, "Configuration", "AddBefore") endif if(ini.check_exists(INIfile, "Configuration", "AddAfter") != 3) do AddAfter = "" else AddAfter = ini.get(INIfile, "Configuration", "AddAfter") endif if(ini.check_exists(INIfile, "Configuration", "ThumbSubDir") != 3) do ThumbSubDir = "" else ThumbSubDir = ini.get(INIfile, "Configuration", "ThumbSubDir") endif if(ImagePath == "%T") do ImagePath = arg(2) local Len = length(ImagePath) local Char local Slash = -1 if(ini.check_exists(INIfile, "Configuration", "PathDepth") != 3) do Temp = "Key 'PathDepth' does not exist in section 'Configuration' of file '" Temp = Temp ++ INIfile ++ "'" messagebox ("ok error", Temp, "INI plugin error #1") quit all endif local Depth = ini.get(INIfile, "Configuration", "PathDepth") for(local i = Len; i > 0; i = i - 1) Char = select(ImagePath, i, i) if(Char == "\") do Slash = Slash + 1 if(Slash == Depth) do ImagePath = select(ImagePath, i + 1, Len) break endif endif endfor ImagePath = replacechars(ImagePath, "\/") endif local SmallImage file.restart(fh) for(i = 0; i < Counter; i = i + 1) BigImage = file.name(file.readstring(fh)) SmallImage = BigImage ++ ThumbSuffix ++ ".jpg" if(ImagePath != "") do BigImage = ImagePath ++ BigImage endif v[i] = "" ++ AddAfter endfor file.close(fh) Str = vec.makelines(v) clip.set(Str) vec.destroy(v) vec.unload