{ Replace paths } unit UserScript; var oldPath: string; newPath: string; function Initialize: integer; begin oldPath := 'DX\MiniArmorsCollection'; newPath := 'TESVPlus\Clothes\GweldaUNP'; end; function Process(e: IInterface): integer; var s: string; i: integer; found: integer; editedPath: string; begin Result := 0; // only string fields can contain filenames i := DefType(e); if (i = dtString) or (i = dtLenString) then begin s := GetEditValue(e); if SameText(Copy(s, Length(s) - 3, 4), '.nif') or SameText(Copy(s, Length(s) - 3, 4), '.dds') or SameText(Copy(s, Length(s) - 3, 4), '.tri') then begin found := Pos(oldPath, s); if found > 0 then begin editedPath := newPath + Copy(s, Length(oldPath) + 1, Length(s) - Length(oldPath)); AddMessage(s + ' --> ' + editedPath); SetEditValue(e, editedPath); end; end; end; // recursively process all child elements for i := 0 to ElementCount(e) - 1 do Process(ElementByIndex(e, i)); end; function Finalize: integer; begin AddMessage('Done'); end; end.