1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-28 20:12:16 -05:00

Extensions: Removed mask on ScriptText and added function GetSelectedText.

This commit is contained in:
John P (Dgby714) 2011-01-12 20:14:38 -05:00
parent d75f7d55cf
commit 5eff9e1c6f
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_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_InputQuery,'function InputQuery(const ACaption, APrompt : String; var Value : String) : Boolean;');
AddFunction(@ext_ScriptText,'function ScriptText: string;'); AddFunction(@ext_ScriptText,'function ScriptText: string;');
AddFunction(@ext_GetSelectedText, 'function GetSelectedText: string;');
AddFunction(@ext_OpenScript,'procedure OpenScript(Name, Data: string; Run: boolean);'); AddFunction(@ext_OpenScript,'procedure OpenScript(Name, Data: string; Run: boolean);');
AddFunction(@ext_OpenScriptEx,'procedure OpenScriptEx(FileName: string; Run: boolean);'); AddFunction(@ext_OpenScriptEx,'procedure OpenScriptEx(FileName: string; Run: boolean);');
AddRegisteredPTRVariable('Settings','TMMLSettingsSandbox'); AddRegisteredPTRVariable('Settings','TMMLSettingsSandbox');

View File

@ -126,7 +126,23 @@ end;
function ext_ScriptText: string; function ext_ScriptText: string;
begin begin
Result := SimbaForm.CurrScript.SynEdit.Lines.Text; 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; end;
procedure ext_OpenScript(vName, Data: string; Run: boolean); procedure ext_OpenScript(vName, Data: string; Run: boolean);