mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-24 10:12:20 -05:00
Extensions: OpenScriptEx, Open a new script from filename.
This commit is contained in:
parent
7dc15679e7
commit
0ab4a35ec9
@ -193,6 +193,7 @@ begin
|
|||||||
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);');
|
||||||
|
AddFunction(@ext_OpenScriptEx,'procedure OpenScriptEx(FileName: string);');
|
||||||
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;');
|
||||||
|
@ -133,11 +133,37 @@ procedure ext_OpenScript(Name, Data: string);
|
|||||||
begin
|
begin
|
||||||
if (Name = '') then
|
if (Name = '') then
|
||||||
Name := 'Untitled';
|
Name := 'Untitled';
|
||||||
SimbaForm.AddTab;
|
|
||||||
SimbaForm.CurrScript.SynEdit.Lines.Text := Data;
|
with SimbaForm do
|
||||||
SimbaForm.CurrScript.ScriptName := Name;
|
begin
|
||||||
SimbaForm.RefreshTab;
|
AddTab();
|
||||||
SimbaForm.UpdateTitle;
|
with CurrScript do
|
||||||
|
begin
|
||||||
|
SynEdit.Lines.Text := Data;
|
||||||
|
ScriptName := Name;
|
||||||
|
end;
|
||||||
|
RefreshTab();
|
||||||
|
UpdateTitle();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ext_OpenScriptEx(FileName: string);
|
||||||
|
begin
|
||||||
|
FileName := SetDirSeparators(FileName);
|
||||||
|
with SimbaForm do
|
||||||
|
begin
|
||||||
|
AddTab();
|
||||||
|
with CurrScript do
|
||||||
|
begin
|
||||||
|
SynEdit.Lines.LoadFromFile(FileName);
|
||||||
|
StartText := SynEdit.Lines.Text;
|
||||||
|
ScriptName := ExtractFileNameOnly(FileName);
|
||||||
|
ScriptFile := FileName;
|
||||||
|
ScriptChanged := False;
|
||||||
|
end;
|
||||||
|
RefreshTab();
|
||||||
|
UpdateTitle();
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ext_GetPageEx(const URL, PostData, MimeType: string): string;
|
function ext_GetPageEx(const URL, PostData, MimeType: string): string;
|
||||||
|
Loading…
Reference in New Issue
Block a user