1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-30 21:02:16 -05:00

Extensions: Changed OpenScript(Ex) to allow running of the script.

This commit is contained in:
John P (Dgby714) 2010-12-25 04:00:37 -05:00
parent 4f861ffb5d
commit b36866921e
2 changed files with 10 additions and 4 deletions

View File

@ -192,8 +192,8 @@ 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_OpenScript,'procedure OpenScript(Name, Data: string);'); AddFunction(@ext_OpenScript,'procedure OpenScript(Name, Data: string; Run: boolean);');
AddFunction(@ext_OpenScriptEx,'procedure OpenScriptEx(FileName: string);'); AddFunction(@ext_OpenScriptEx,'procedure OpenScriptEx(FileName: string; Run: boolean);');
AddRegisteredPTRVariable('Settings','TMMLSettingsSandbox'); AddRegisteredPTRVariable('Settings','TMMLSettingsSandbox');
AddFunction(@ext_GetPageEx,'function GetPageEx(const URL, PostData, MimeType: string): string;'); AddFunction(@ext_GetPageEx,'function GetPageEx(const URL, PostData, MimeType: string): string;');
AddFunction(@ext_GetJSONValue,'function GetJSONValue(const Data, Value: string): string;'); AddFunction(@ext_GetJSONValue,'function GetJSONValue(const Data, Value: string): string;');

View File

@ -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); 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; end;
procedure ext_OpenScript(Name, Data: string); procedure ext_OpenScript(Name, Data: string; Run: boolean);
begin begin
if (Name = '') then if (Name = '') then
Name := 'Untitled'; Name := 'Untitled';
@ -145,9 +145,12 @@ begin
RefreshTab(); RefreshTab();
UpdateTitle(); UpdateTitle();
end; end;
if (Run) then
SimbaForm.RunScript();
end; end;
procedure ext_OpenScriptEx(FileName: string); procedure ext_OpenScriptEx(FileName: string; Run: boolean);
begin begin
FileName := SetDirSeparators(FileName); FileName := SetDirSeparators(FileName);
with SimbaForm do with SimbaForm do
@ -164,6 +167,9 @@ begin
RefreshTab(); RefreshTab();
UpdateTitle(); UpdateTitle();
end; end;
if (Run) then
SimbaForm.RunScript();
end; end;
function ext_GetPageEx(const URL, PostData, MimeType: string): string; function ext_GetPageEx(const URL, PostData, MimeType: string): string;