1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-21 08:45:06 -05:00

Merge branch 'ScriptText' of https://github.com/Dgby714/Simba into Dgby714-ScriptText

This commit is contained in:
Merlijn Wajer 2011-01-15 10:46:25 +01:00
commit 29082f6a9f
2 changed files with 18 additions and 1 deletions

View File

@ -192,6 +192,7 @@ begin
AddFunction(@ext_MessageDlg,'function MessageDlg(const aCaption, aMsg: string; DlgType: TMsgDlgType;Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;');
AddFunction(@ext_InputQuery,'function InputQuery(const ACaption, APrompt : String; var Value : String) : Boolean;');
AddFunction(@ext_ScriptText,'function ScriptText: string;');
AddFunction(@ext_GetSelectedText, 'function GetSelectedText: string;');
AddFunction(@ext_OpenScript,'procedure OpenScript(Name, Data: string; Run: boolean);');
AddFunction(@ext_OpenScriptEx,'procedure OpenScriptEx(FileName: string; Run: boolean);');
AddRegisteredPTRVariable('Settings','TMMLSettingsSandbox');

View File

@ -126,7 +126,23 @@ end;
function ext_ScriptText: string;
begin
Result := SimbaForm.CurrScript.SynEdit.Lines.Text;
Result := ReplaceRegExpr('([N|n][A|a][M|m][E|e]|[P|p][A|a][S|s]{2}|[P|p][I|i][N|n])\s*\:\=\s*\''.*?\'';', Result, '$1 := ''*********'';', True);
end;
function ext_GetSelectedText: string;
var
I: integer;
begin
with SimbaForm.CurrScript.SynEdit do
begin
if (not (BlockBegin.Y = BlockEnd.Y)) then
begin
Result := Copy(Lines[BlockBegin.Y - 1], BlockBegin.X, Length(Lines[BlockBegin.Y - 1])) + MEOL;
for I := BlockBegin.Y + 1 to BlockEnd.Y - 1 do
Result := Result + Lines[I - 1] + MEOL;
Result := Result + Copy(Lines[BlockEnd.Y - 1], 1, BlockEnd.X - 1);
end else
Result := Copy(Lines[BlockBegin.Y - 1], BlockBegin.X, BlockEnd.X - BlockBegin.X);
end;
end;
procedure ext_OpenScript(vName, Data: string; Run: boolean);