| << May >> | ||||||
| S | M | T | W | T | F | S |
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 | |
The Franken-Scriptor Lives!
20/12/2006
Well after a fair bit of hacking and QA I've got the script engine in Scribe running some non-trivial scripts. In test11 you'll be able to create scripts and have them hang off the tools menu of the main window. Just put a ".script" file in "./Scripts" under Scribe.exe and it'll get inserted in the Tools menu. Inside the script you need to define a "Main" function in LGI script (see i.Mage's help for documentation) which will get run when you select the menu item that corrasponds to the script.
I'm initially converting the existing bottom 3 "utility" style commands on Tools menu to script to test the system. So far the first one looks like this:
And that works fine. It's a little rough around the edges but it works as advertised. I had to fix a few things in the script engine and also add some more functions and fields in to the objects.
I hope to convert the other 2 tools into script before I release test11. Sometime after the release I'll document the language and commands here. As the old scripting plugin is deprecated, I may as well use that page from something useful.
Comments:
Well after a fair bit of hacking and QA I've got the script engine in Scribe running some non-trivial scripts. In test11 you'll be able to create scripts and have them hang off the tools menu of the main window. Just put a ".script" file in "./Scripts" under Scribe.exe and it'll get inserted in the Tools menu. Inside the script you need to define a "Main" function in LGI script (see i.Mage's help for documentation) which will get run when you select the menu item that corrasponds to the script.
I'm initially converting the existing bottom 3 "utility" style commands on Tools menu to script to test the system. So far the first one looks like this:
//
// Deletes all the attachments in the current folder after asking the user.
//
// MenuText = Delete all attachments in current folder
// MenuStrRef = 1266
//
function Main(App)
{
Folder = App.CurrentFolder;
Print("Folder='" + Folder.Path + "'\n");
if (Folder)
{
if (Folder.Type == 0xAAFF0001)
{
Load(Folder);
Bytes = 0;
Count = 0;
Len = Folder.Length;
for (i=0; i<Len; i++)
{
t = Folder.Item[i];
if (t)
{
Attachments = t.Attachments;
for (n=0; n<Attachments; n++)
{
a = t.Attachment[n];
if (a)
{
Bytes += a.Length;
Count++;
}
}
}
}
if (MsgBox( App,
"Do you want to delete " + Bytes + " bytes in " + Count + " attachments?",
Name,
4) == 6)
{
for (i=0; i<Len; i++)
{
t = Folder.Item[i];
if (t)
{
Attachments = t.Attachments;
for (n=0; n<Attachments; n++)
{
a = t.Attachment[n];
Delete(a);
}
}
}
}
}
else
{
MsgBox(App, "Folder doesn't contain mail.", "Delete Attachments");
}
}
else
{
MsgBox(App, "No current folder?", "Delete Attachments");
}
}
And that works fine. It's a little rough around the edges but it works as advertised. I had to fix a few things in the script engine and also add some more functions and fields in to the objects.
I hope to convert the other 2 tools into script before I release test11. Sometime after the release I'll document the language and commands here. As the old scripting plugin is deprecated, I may as well use that page from something useful.
Comments:
| fret 21/12/2006 6:00am |
Ok, so I didn't provide any default scripts in the Test11 build, but you can create your own "Scripts" subfolder and paste this script above into a text file calles "DeleteAttachments.script" and it'll show up in the Tools menu. |
| mhf 21/12/2006 11:31am |
Yes, works fine. Looking forward to some more examples and am looking through the scripting API |
