Author Topic: Scripting Documentation  (Read 1843 times)

Offline RJP74

  • Registered User
  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Scripting Documentation
« on: June 29, 2013, 05:25:58 pm »
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
  1. var output = Application.Output();
  2. output.clear(); // clean output from old text
  3. output.writeln("HippoEDIT version: " + Application.Version);
  4. output.writeln("");
  5.  
  6. var results = [];
  7. var newLine = "\r\n";
  8.  
  9. function objectEnumerate(givenObject) {
  10.         var properties = [];
  11.         for (var x in givenObject) {
  12.                 properties.push(x);
  13.         }
  14.         properties.sort();
  15.         var objPropsLen = properties.length;
  16.         for (i = 0; i < objPropsLen; i++) {
  17.                 var prop = properties[i];
  18.                  results.push(prop);
  19.         }
  20. }
  21.  
  22. objectEnumerate(Application);
  23. output.writeln(results.join(newLine));
  24.  
« Last Edit: June 30, 2013, 12:42:49 am by alex »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2161
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Scripting Documentation
« Reply #1 on: June 30, 2013, 12:42:24 am »
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
  1.         var output = Application.Output();
  2.         output.clear(); // clean output from old text
  3.         output.writeln("HippoEDIT version: " + Application.Version);
  4.         output.writeln("");
  5.        
  6.         var reservedNames = {
  7.                 "AddRef":               true,
  8.                 "GetMemberName":        true,
  9.                 "GetMemberProperties":  true,
  10.                 "GetNameSpaceParent":   true,
  11.                 "GetNextDispID":        true,
  12.                 "GetTypeInfo":          true,
  13.                 "GetTypeInfoCount":     true,
  14.                 "Invoke":               true,
  15.                 "GetIDsOfNames":        true,
  16.                 "DeleteMemberByName":   true,
  17.                 "DeleteMemberByDispID": true,
  18.                 "GetDispID":            true,
  19.                 "QueryInterface":       true,
  20.                 "Release":              true,
  21.                 "RemoteInvokeEx":       true
  22.         };
  23.  
  24.         function objectEnumerate(givenObject) {
  25.                 var properties = [];
  26.                 for (var x in givenObject) {
  27.                         if ( !(x in reservedNames) )
  28.                                 properties.push(x);
  29.                 }
  30.                 properties.sort();
  31.                 return properties;
  32.         }
  33.        
  34.         function dumpObject(name, givenObject) {
  35.                 var newLine = "\r\n";
  36.                 if ( givenObject != null ) {
  37.                         output.writeln(newLine + name + newLine + "  " + objectEnumerate(givenObject).join(newLine + "  "));
  38.                 }
  39.         }
  40.        
  41.         dumpObject("Application", Application);
  42.         dumpObject("WScript", WScript);
  43.         dumpObject("Settings", Settings);
  44.         dumpObject("Document", ActiveDocument);
  45.         dumpObject("View", ActiveView);
  46.         dumpObject("Syntax", ActiveDocument.Syntax);
  47.  

Offline RJP74

  • Registered User
  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Scripting Documentation - now added to the wiki
« Reply #2 on: July 07, 2013, 03:09:16 pm »
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

 

Related Topics

  Subject / Started by Replies Last post
18 Replies
7882 Views
Last post June 17, 2016, 11:09:59 pm
by alex
2 Replies
4569 Views
Last post October 07, 2009, 01:50:53 pm
by alex
28 Replies
8293 Views
Last post September 11, 2011, 04:23:33 am
by alex
3 Replies
2303 Views
Last post November 30, 2011, 12:20:59 am
by alex
4 Replies
1968 Views
Last post January 23, 2012, 07:43:33 pm
by kassiop