Scripting Documentation

Started by RJP74, June 29, 2013, 06:25:58 PM

Previous topic - Next topic

RJP74

In the Wiki the link for Application Object goes to a page that reads "You've followed a link to a topic that doesn't exist yet. "
So as an interim measure I wrote a script that lists the properties of "Application" etc.
It doesn't list the detailed parameters required but it is a start to know the names of the available properties.

The results are too big for this page and can be seen in the attached text file.

The basic code I used looks like this:

Code (javascript) Select

var output = Application.Output();
output.clear(); // clean output from old text
output.writeln("HippoEDIT version: " + Application.Version);
output.writeln("");

var results = [];
var newLine = "\r\n";

function objectEnumerate(givenObject) {
var properties = [];
for (var x in givenObject) {
properties.push(x);
}
properties.sort();
var objPropsLen = properties.length;
for (i = 0; i < objPropsLen; i++) {
var prop = properties[i];
results.push(prop);
}
}

objectEnumerate(Application);
output.writeln(results.join(newLine));


alex

Yes, the link is pointing to nowhere :) That is from one side because nobody has asked, and I was extending API continuously and from another side has no time for adding that.
I am planning soon (maybe next week) to generate wiki pages with API from type library of hippoedit.exe. Than you will get it with parameters and some description.

But for now, to check actual API you can use something like OleView, and open type library from hippoedit.exe or two *.idl files I am adding here, which are based for generating type library.

And thanks for code, I have added it to Scripting Plugin (already uploaded), as a fast way to getting actual object/method list. Check for corresponding entry in Scripting Menu.

Updated code is like this:
Code (javascript) Select
var output = Application.Output();
output.clear(); // clean output from old text
output.writeln("HippoEDIT version: " + Application.Version);
output.writeln("");

var reservedNames = {
"AddRef":               true,
"GetMemberName":        true,
"GetMemberProperties":  true,
"GetNameSpaceParent":   true,
"GetNextDispID":        true,
"GetTypeInfo":          true,
"GetTypeInfoCount":     true,
"Invoke":               true,
"GetIDsOfNames":        true,
"DeleteMemberByName":   true,
"DeleteMemberByDispID": true,
"GetDispID":            true,
"QueryInterface":       true,
"Release":              true,
"RemoteInvokeEx":       true
};

function objectEnumerate(givenObject) {
var properties = [];
for (var x in givenObject) {
if ( !(x in reservedNames) )
properties.push(x);
}
properties.sort();
return properties;
}

function dumpObject(name, givenObject) {
var newLine = "\r\n";
if ( givenObject != null ) {
output.writeln(newLine + name + newLine + "  " + objectEnumerate(givenObject).join(newLine + "  "));
}
}

dumpObject("Application", Application);
dumpObject("WScript", WScript);
dumpObject("Settings", Settings);
dumpObject("Document", ActiveDocument);
dumpObject("View", ActiveView);
dumpObject("Syntax", ActiveDocument.Syntax);
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

RJP74

Using Application as the base Named Object, I have added definitions of all related Named Objects to the wiki. They are defined here:
http://wiki.hippoedit.com/scripting/api/start