npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ctsy/win32ole

v0.0.3

Published

Asynchronous, non-blocking win32ole bindings

Downloads

51

Readme

NAME

node-win32ole - Windows COM bindings for node.js

win32ole makes accessibility from node.js to Excel, Word, Access, Outlook, InternetExplorer, WSH ( ActiveXObject / COM ) and so on. It does not need TypeLibrary.

USAGE

Install with npm install win32ole.

It works as... (version 0.1.x)

try{
  var win32ole = require('win32ole');
  // var xl = new ActiveXObject('Excel.Application'); // You may write it as:
  var xl = win32ole.client.Dispatch('Excel.Application');
  xl.Visible = true;
  var book = xl.Workbooks.Add();
  var sheet = book.Worksheets(1);
  try{
    sheet.Name = 'sheetnameA utf8';
    sheet.Cells(1, 2).Value = 'test utf8';
    var rg = sheet.Range(sheet.Cells(2, 2), sheet.Cells(4, 4));
    rg.RowHeight = 5.18;
    rg.ColumnWidth = 0.58;
    rg.Interior.ColorIndex = 6; // Yellow
    var result = book.SaveAs('testfileutf8.xls');
    console.log(result);
  }catch(e){
    console.log('(exception cached)\n' + e);
  }
  xl.ScreenUpdating = true;
  xl.Workbooks.Close();
  xl.Quit();
}catch(e){
  console.log('*** exception cached ***\n' + e);
}

There are 3 ways to make force Garbage Collection for node.js / v8 .

    1. use huge memory to run GC automatically ( causes abnormal termination )
    1. win32ole.force_gc_extension(1);
    1. win32ole.force_gc_internal(1);

see also examples/ole_args_test_client.js

Tutorial and Examples

Other built in functions

  • win32ole.version(void) // returns version string
  • win32ole.printACP(utf8string) // Utf8 to .ACP
  • win32ole.print(utf8string) // ASCII
  • win32ole.gettimeofday(struct timeval &tv, null) // now arg2 is not used
  • win32ole.sleep(long milliseconds, bool withmessage=false, bool with\n=false)
  • win32ole.force_gc_extension(long flag) // now flag is dummy
  • win32ole.force_gc_internal(long flag, string) // now flag is dummy

FEATURES

  • fix BUG: date
  • BUG: A few samples in [email protected] needs '._' ideom.
  • When you use unary operator '!' at the place that needs boolean CONDITION (for example 'while(!obj.status){...}') , you must write 'while(!obj.status._){...}' to complete v8::Object::ToBoolean() conversion. (NamedPropertyHandler will not be called because v8::Object::ToBoolean() is called directly for unary operator '!' instead of v8::Object::valueOf() in ParseUnaryExpression() v8/src/parser.cc .) Do you know how to fake it?
  • V8Variant::OLEGetAttr returns a copy of object, so it uses much memory. I want to fix it.
  • Now '._' ideom is obsoleted.
  • Remove 'node-proxy' from dependencies list.
  • Change default branch to dev0.1.0 .
  • BUG: Some samples in between [email protected] and [email protected] ( examples/maze_creator.js examples/maze_solver.js ) uses huge memory and many disposers will run by v8 GC when maze size is 20*30. I think that each encapsulated V8Variant (by node-proxy) may be big object. So I will try to use v8 accessor handlers ( SetCallAsFunctionHandler / SetNamedPropertyHandler / SetIndexedPropertyHandler ) instead of ( 'noSuchMethod' / 'noSuchGetter' / 'noSuchSetter' ) by node-proxy.
  • So much implements. (can not handle some COM VARIANT types, array etc.)
  • Bug fix. (throws exception when failed to Invoke(), and many test message.)
  • Implement accessors getter, setter and caller. (version 0.1.x) (Some V8Variants were advanced to 0.1.x .)

API

See the API documentation in the wiki.

BUILDING

This project uses VC++ 2008 Express (or later) and Python 2.6 (or later) . (When using Python 2.5, it needs multiprocessing 2.5 back port .) It needs neither ATL nor MFC.

Bulding also requires node-gyp to be installed. You can do this with npm:

npm install -g node-gyp

To obtain and build the bindings:

git clone git://github.com/idobatter/node-win32ole.git
cd node-win32ole
node-gyp configure
node-gyp build

You can also use npm to download and install them:

npm install win32ole

TESTS

mocha is required to run unit tests.

npm install -g mocha
nmake /a test

CONTRIBUTORS

ACKNOWLEDGEMENTS

Inspired Win32OLE

LICENSE

node-win32ole is BSD licensed.