PDA

View Full Version : WMI and Unread mail LUA scripts



MMcM
November 8th, 2006, 12:37 PM
I am finally getting around to cleaning up the DVDSpy example GMLs to not be minimally-changed copies of the Girder 3 ones.

I have split out some of the longer, more or less generic, scripts from big script nodes into separate .lua files.

The WMI script for getting CPU usage and disk space to display. I've tried to combine the features of the old one, such as special formatters, with those of Mike C's WMI script in the downloads area, such as multiple / remote connections and more object-orientation.
The Unread mail script, either via SHGetUnreadMailCount's registry settings or Outlook automation. I didn't see any new additions to the win package to do this.
The old JScript weather handling I am, of course, just removing in favor of the support now built in.


I am thinking of keeping this couple of new scripts within the DVDSpy installation, targetted to the luascripts folder. But I'm eager to hear of any better distribution idea that anyone has.

So far, I've also noticed a couple things.

Expansion of variables in square brackets does not invoke a __tostring meta-method on a table. It just inserts Table literally.
The win package does not have a replacement for the old registry functions that can enumerate subkeys or values. There is no really convenient automation server for this, either; WshShell only does the same simple value read / write. I had to use WMI's StdRegProv. I didn't have time to package up a generic Lua registry wrapper, but it might be nice to.

Rob H
November 8th, 2006, 01:05 PM
The win package does not have a replacement for the old registry functions that can enumerate subkeys or values. There is no really convenient automation server for this, either; WshShell only does the same simple value read / write. I had to use WMI's StdRegProv. I didn't have time to package up a generic Lua registry wrapper, but it might be nice to.


doesn't the registry object do this with the :ListKeys() and :ListValues() methods?

MMcM
November 8th, 2006, 02:13 PM
I thought I might be missing something. Where is the registry object? I did look around.

Rob H
November 8th, 2006, 02:35 PM
Take a look in help under Lua library reference\win\Registry

MMcM
November 8th, 2006, 08:59 PM
D'oh! The reference manual was the first place I checked, but I managed to miss it completely. Then I got stuck in the Variable Display in the R's. Anyway, thanks for straightening me out.

I am using the CPU usage function documented close by in place of WMI for the simple default, saving WMI for the more advanced file server LCD display that shows number of remote users and disk space usage.

Promixis
November 9th, 2006, 02:28 PM
MMcM,

under luascript/classes is a WMI class that is easy to use versus some of the other older stuff.

I know someone has been doing Outlook stuff via its COM object but haven't looked at it myself.

MMcM
November 9th, 2006, 04:10 PM
The script in luascript\Classes looks like a succcessor to the one in the downloads area. It says, "For internal promixis use only", but I guess that doesn't mean anything in particular.

The more I think about it, the less it makes sense to duplicate this functionality that's already shipping with the base product.

Most of the differences between this version and the DVDSpy version are minor / stylistic and don't affect capabilities given to the user of the plug-in.

Connects using the ConnectServer() method rather than building complicated monikers.
Exposes methods to add new refreshing objects from their path / query.
Uses more complex paths to get the single _Total object rather than finding it each time.
Packages Refresh / Format / setglobal into a single method.


I'll just make the sample instantiate or extend the class and do the formatting separately, using the refobj's already established. Does that sound okay?

Promixis
November 9th, 2006, 04:48 PM
Sounds resonable.

MMcM
November 10th, 2006, 07:19 PM
Is the Lua version of DVDData.vbs, mentioned here (http://www.promixis.com/forums/showpost.php?p=33016&postcount=7), part of any G4 distribution? It's another thing it would be good not to duplicate.

Promixis
November 19th, 2006, 01:33 PM
Mike,

I have not moved the DVD metadata retreival to G4.

MMcM
November 22nd, 2006, 12:34 AM
Okay, in that case I have included in DVDSpy's samples a replacement using luacom and threads instead of VBScript in a process.

Promixis
November 22nd, 2006, 09:07 AM
Okay, in that case I have included in DVDSpy's samples a replacement using luacom and threads instead of VBScript in a process.


Great. Thanks.