{*******************************************************} { } { Pascal Script Source File } { Run by RemObjects Pascal Script in CnWizards } { } { Generated by CnPack IDE Wizards } { } {*******************************************************} program SQLToString; uses Windows, SysUtils, Classes, CnWizIdeUtils; function DupeString(const AText: string; ACount: Integer): string; var i: Integer; begin i := ACount; while i > 0 do begin Result := Result + AText; i := i - 1; end; end; var Lines: TStringList; sTemp: string; i, FirstPos: Integer; IsDelphi: Boolean; begin //IsDelphi := false; //IsDelphi := Compiler <> cnBCB6; IsDelphi := WizOptions.CompilerID <> 'CB6'; //WriteLn(WizOptions.CompilerID); //IsDelphi := Pos('Delphi', Application.MainForm.Caption) > 0; Lines := TStringList.Create; try if IdeGetEditorSelectedLines(Lines) and (Lines.Count > 0) then begin i := 1; sTemp := Lines[0]; while (sTemp[i] = ' ') do i := i + 1; FirstPos := i; for i := 0 to Lines.Count - 1 do begin sTemp := Lines[i]; sTemp := Copy(sTemp, FirstPos, Length(sTemp)); if IsDelphi then sTemp := QuotedStr(sTemp + ' ') else begin sTemp := StringReplace(sTemp, '"', '\"', [rfReplaceAll]); sTemp := '"' + sTemp + ' \r\n"'; end; if IsDelphi and (i <> Lines.Count - 1) then sTemp := sTemp + ' +'; Lines[i] := DupeString(' ', FirstPos - 1) + sTemp; end; IdeSetEditorSelectedLines(Lines); end; finally Lines.Free; end; end.