From b36866921e7124d84b3da7d7343d9cbc631d980d Mon Sep 17 00:00:00 2001 From: "John P (Dgby714)" Date: Sat, 25 Dec 2010 04:00:37 -0500 Subject: [PATCH] Extensions: Changed OpenScript(Ex) to allow running of the script. --- Projects/Simba/psextension.pas | 4 ++-- Units/MMLAddon/PSInc/Wrappers/extensions.inc | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Projects/Simba/psextension.pas b/Projects/Simba/psextension.pas index d09a6dd..f8c83d5 100644 --- a/Projects/Simba/psextension.pas +++ b/Projects/Simba/psextension.pas @@ -192,8 +192,8 @@ 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_OpenScript,'procedure OpenScript(Name, Data: string);'); - AddFunction(@ext_OpenScriptEx,'procedure OpenScriptEx(FileName: string);'); + AddFunction(@ext_OpenScript,'procedure OpenScript(Name, Data: string; Run: boolean);'); + AddFunction(@ext_OpenScriptEx,'procedure OpenScriptEx(FileName: string; Run: boolean);'); AddRegisteredPTRVariable('Settings','TMMLSettingsSandbox'); AddFunction(@ext_GetPageEx,'function GetPageEx(const URL, PostData, MimeType: string): string;'); AddFunction(@ext_GetJSONValue,'function GetJSONValue(const Data, Value: string): string;'); diff --git a/Units/MMLAddon/PSInc/Wrappers/extensions.inc b/Units/MMLAddon/PSInc/Wrappers/extensions.inc index ab1ba48..3e236d4 100644 --- a/Units/MMLAddon/PSInc/Wrappers/extensions.inc +++ b/Units/MMLAddon/PSInc/Wrappers/extensions.inc @@ -129,7 +129,7 @@ begin 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; -procedure ext_OpenScript(Name, Data: string); +procedure ext_OpenScript(Name, Data: string; Run: boolean); begin if (Name = '') then Name := 'Untitled'; @@ -145,9 +145,12 @@ begin RefreshTab(); UpdateTitle(); end; + + if (Run) then + SimbaForm.RunScript(); end; -procedure ext_OpenScriptEx(FileName: string); +procedure ext_OpenScriptEx(FileName: string; Run: boolean); begin FileName := SetDirSeparators(FileName); with SimbaForm do @@ -164,6 +167,9 @@ begin RefreshTab(); UpdateTitle(); end; + + if (Run) then + SimbaForm.RunScript(); end; function ext_GetPageEx(const URL, PostData, MimeType: string): string;