Extended System Control plugin

System-level/UI/Misc stuff scripting plugin

http://www.templier.info/downloads/DXSystemEx.zip

Update: Version 1.0 has been released. Get it from here.

A new week, a new plugin O:)

The plan for this plugin is to include all system-related functionality that isn’t already available in the DesktopX System namespace.

Download

You can download a test version here (set to expire on 10/5/2009).

If you have ideas for stuff to add to this plugin, feel free to post them on the DesktopX 4.x request thread.

Plugin Information

Mouse wheel

  • SystemEx_OnMouseWheel(rotation)
  • SystemEx_OnMButtonDown(x, y)
  • SystemEx_OnMButtonUp(x, y, dragged)

Monitor information

  • Monitors
  • NumberOfMonitors
  • GetMonitor(index)

MonitorInfo object:

  • IsPrimary
  • Left
  • Top
  • Bottom
  • Right

Volume

  • Volume
  • Mute
  • PeakValue (read-only)
  • SystemEx_OnVolumeEvent(volume)
  • SystemEx_OnMuteEvent(isMuted)

Instance

  • CommandLine
  • CommandLineArgs
  • IsFirstInstance
  • SystemEx_OnNewInstance(commandLineArgs)

Misc

  • VerifySignature(path, signature, type)

 

Documentation

Mouse wheel

SystemEx_OnMouseWheel(rotation)

When the mouse is over the object and the mousewheel is used, the SystemExOnMouseWheel
function will be called with the wheel rotation passed as a parameter.

The wheel rotation will be in number of lines.

Default value: 3
Default value for page scrolling: 10

A positive value indicates that the wheel was rotated forward, away from the user;
a negative value indicates that the wheel was rotated backward, toward the user.

SystemEx_OnMButtonDown(x, y) & SystemEx_OnMButtonUp(x, y, dragged)

When you middle click on your object, the SystemEx_OnMButtonDown function will be
called. When you release the button, theSystemEx_OnMButtonUp function will be called.

Both functions will have the mouse coordinates relative to your object passed as
parameters.

 

Monitor Information

This one was asked by Zubaz to better handle multi-monitor systems. As it turns out, the virtual screen coordinates are not nearly enough to be able to position objects on multi-monitor systems. WMI is exposing monitor information, but it does not seems to work reliably (it only gives information for the first monitor on my system for example).

 SystemEx.Monitors

Gets an array of MonitorInfo objects

SystemEx.GetMonitor(index)

Returns the MonitorInfo for the given screen

SystemEx.NumberOfMonitors

Gets the number of monitors on the machine

 

Volume Information

SystemEx_OnVolumeEvent(volume)

When the user change the master volume through the volume mixer or another application
your object callback is called. The volume parameter will contain the current master
volume.

XP Compatibility: never called.

SystemEx_OnMuteEvent(isMuted)

If the volume is muted, your object callback is called.
isMuted will be True if the volume has been muted, false otherwise.

XP Compatibility: never called.

SystemEx.Volume

Sets or gets the master volume.

Usage: 
SystemEx.Volume = <volume>
<volume> = SystemEx.Volume

<volume> should/will be between 0 and 100. Any value outside these bounds will be capped.

SystemEx.Mute

Mute or un-mute the audio stream

Usage:
SystemEx.Mute = True
isMuted = SystemEx.Mute

Mute can take two values: True and False.
If Mute is True the audio stream is muted, otherwise it is not muted.

SystemEx.PeakValue

This is a read-only property. It allows you to get the peak level value for the
currently playing sample.

Usage: 
level = SystemEx.PeakValue
level will be between 0 and 100.

XP Compatibility: might not work with some cards, in which case it will always  returns 100.
It reads from the waveout device, so it won't work when reading from a CD for example.

 

Instance Information

SystemEx.CommandLine

Get the full command line (including the path to the executable and DesktopX-specific arguments)

SystemEx.CommandLineArgs

Get an array of command line arguments.
Command line arguments have been cleaned up to remove DesktopX-specific arguments (in the case of single-exe gadgets)

SystemEx.IsFirstInstance

Will be True if this is the first instance to run, False otherwise.
It is preferable to check for it at startup and close the gadget accordingly,
as only the first instance will receive a callback message when a new instance is started.

SystemEx_OnNewInstance(commandLineArgs)

Gets called when another instance is started. The command line arguments are passed in an array.

 

Misc Information

SystemEx.VerifySignature(path, signature, type)
Check the signature of the file pointed to by path.

The only type of signature supported at this time is SIGNATURE_SHA1

 

Changelog

1.0 Build 228:

  • Renamed to DXSystemEX (plugin namespace is now SystemEx)
  • Added SHA1 signature check
  • Added MouseWheel and Middle button click callbacks (merged from DXMouseWheel)
  • Added Master volume control / Mute / Peak (merged from DXVolumeControl)

1.0 Build 205:

  • First test version
15,707 views 21 replies
Reply #1 Top

You friggin' rock.  :)

Reply #2 Top

You friggin' rock.

I concur.

This is really cool! One thing, in the example object included, the DXSysControl_Update object gives an error on line 12; it's calling the wrong script object.

Also, I get the error message box: Error #2147319779. I'm assuming this is because I don't have a secondary monitor?

In any case, this will serve as a pretty powerful plugin for DX--you've just made DX mulit-monitor compatible. Thanks, Littleboy!:thumbsup:

Reply #3 Top

Yeah, I included a broken version of the widget :S . Please redownload the zip file, it should be fixed now. I also made a quick change to the plugin and it might have fixed the loading error (that's the strange error number). If not, let me know.

It should work with any number of monitors, so if you only have one monitor and still get the error, it's definitely a problem with the plugin.

If you look at the script, you'll also notice that I use the existing System_OnScreenChange to refresh the status. The plugin should react to that same event and recompute the monitor information.

Reply #4 Top

Clicked on the same link above, got the same widget with the script error.

Reply #5 Top

Grrrrrrr, this time it should be the new one (there is a directory with the gadget in the new zip)

Reply #6 Top

 No script error this time, but I still get the loading error. And now it doesn't show any information.

Reply #7 Top

Is that the gadget or loading the dxpack? It's working on my Win7 main computer, in my XP VM and on a fresh install of Vista RTM in another VM. So maybe I fcked up something else in the dxpack (again). Can you try using the gadget (in the SysControl folder) and see if it works better.

There is a possibility the dxpack isn't installing the plugin properly, especially on Vista. Try copying the dll manually to the DesktopX\SDPlugins folder, this might fix the error.

Reply #8 Top

The gadget works on Win7 (one monitor) but fails on vista64 (as does the dxpack).  It does throw the same error though.

The build this mornign worked better . . it at least returned results (even if I got the error).

Will try again with Vista 32.

Gadget works fine in Vista 32 (with one monitor)

Reply #9 Top

It's the same for the gadget, too. Each time I downloaded, I copied the dll to the SD Plugin folder before running the dxpack or gadget. (I also deleted any prior versions.) I've also tried deleting the dll from the SDPlugin folder and just running the gadget or dxpack--no go.

I'm on Vista SP1.

I looked at the script for both the new version and old one and the only difference is line three, where the text is set to blank. On a closer look I also see that the procedure is exited when I get the loading error, meaning it doesn't retreive any information and it shouldn't have with the previous version, either, yet I still had information on the display object.

This led me to wonder if the first version had the same problem as well, only I didn't notice because the script didn't clear the text that was already present. So, I altered the script in the old version to match the new one, and sure enough the old version didn't actually retreive the information either.

I commented out the "Exit Sub" to see what information it could retreive, error notwithstanding, and it only displayed "Primary Monitor: Yes"

I'm guessing the information I was seeing in the older version was leftover from your computer?;P   It did puzzle me why there was secondary monitor information, when I had no secondary monitor, but we have the same primary monitor information.

So it seems, for me, only the IsPrimary property works.

Reply #10 Top

The build this mornign worked better . . it at least returned results (even if I got the error).

You did not get any results, that was leftovers from my computer ;P Being just a quick test object, its script is pretty bad.

sViz: Thanks for all the tests!

The "Primary: Yes" is not actually working, it's just a boolean test that happens to be True, but it's not calling the plugin in that case.

You are seeing the same stuff I did when trying to make that Screens property work properly, except that it did ended up working for me! Pretty much everything else in the plugin is either straighforward code or stuff I used in previous plugins.

Can you try replacing the UpdateInfo sub by this one:

Code: vbscript
  1. Sub UpdateInfo()
  2.  Dim info, i
  3.  info = ""
  4.  
  5.  For i = 0 To SysControl.NumberOfScreens - 1
  6.   Dim screen
  7.   Set screen = SysControl.GetScreen(i)
  8.   ' Primary screen
  9.   info = info &amp; "Primary: "
  10.   If (screen.IsPrimary = True) Then
  11.    info = info &amp; "Yes" &amp; vbNewLine
  12.   Else
  13.    info = info &amp; "No" &amp; vbNewLine
  14.   End If
  15.  
  16.   ' Position
  17.   info = info &amp; "Coordinates: (" &amp; screen.Left &amp; ", " &amp; screen.Top &amp; ") - (" &amp; screen.Right &amp; ", " &amp; screen.Bottom &amp; ")" &amp; vbNewLine
  18.   
  19.   ' Dimensions
  20.   info = info &amp; "Dimensions: " &amp; screen.Width &amp; "x" &amp; screen.Height &amp; vbNewLine
  21.   
  22.   info = info &amp; vbNewLine
  23.   
  24.   
  25.  Next
  26.  
  27.  ' Update text
  28.  DesktopX.Object("DXSysControl_Info").Text = info
  29. End Sub

If it's working, then it's the new code to return an array of objects that is at fault. If not, I need to have a closer look at the rest of the plugin, because everything else should be working fine.

Right now, we have the following working:

  • Win 7 x64 (and is it x86 you are running Zubaz?)
  • Vista 32
  • XP

Vista 64 is a no go. And it's the only VM I haven't build yet (lucky me!). Anybody seeing different results?

Reply #11 Top

It gives me a script error. Line 20: null. That's this one: For i = 0 To SysControl.NumberOfScreens - 1

I also tried just calling some of the properties by themselves.

For instance:

Set screen = SysControl.GetScreen(0)
 g = screen.IsPrimary
 msgbox g

Got null every time.

 

Forgot to mention I'm on 32-bit

Reply #12 Top

Mmmhh, doesn't make sense. Are you and Zubaz using Avast! AV or running with UAC off? Those null errors is something I remember happening with DXCanvas.

Does any of my other plugins work?

Reply #13 Top

X|   Totally forgot about the UAC thing. I always have my UAC turned off.  Turned it back on and now everything works--coordinates, dimensions, and the whole shebang. Your DXCanvas also works when UAC is turned on.

'Tis a bit of a drawback having to use UAC, as I can't stand the blasted thing, but the good news is the plugin works! |-)

Reply #14 Top

I only have one monitor on my non-Vista64 bit machines.  :)

And th Vista64 machine is the one I run with UAC off.  Just my luck, eh?

Reply #15 Top

New build is available (compiled in release mode with no expiration). The UAC problem should hopefully be history.

Time to recompile all my scripting plugins :(O and update the DX docs/SDK.

Reply #16 Top

All is well with Vista 64 with UAC on!

http://www.screencast.com/users/zubaz/folders/Jing/media/f38f29f5-517b-4e68-9783-29d65a2ceda8

Reply #17 Top

All is well with Vista 64 with UAC on!

Good! Can somebody confirm that it's also working with UAC turned off (preferably running the plugin for the first time so there is no leftover from a previous run).

Reply #18 Top

Good! Can somebody confirm that it's also working with UAC turned off
Sorry . . I meant off.  ;)

Reply #19 Top

Works for me with UAC on and off. :thumbsup:

Reply #20 Top

I've made a new build available. Not a lot of "new" stuff available (apart from VerifySignature), but I've merged 3 of my other plugins into this one, as they were more or less related.

The MouseWheel API has changed somewhat (you no longer get the wheel delta, but the number of lines to scroll, using the Windows configuration to determine the number of lines to scroll per wheel delta).

You also get a dragged value with the SystemEx_OnMButtonUp callback, but the dragging code is not enabled yet, as it does not seem to be working properly (ie. the object will not move when dragging with the middle button).

Reply #21 Top

Version 1.0 has been released. You can get it from Wincustomize or from the old link (the zip has been updated since the last build, so make sure to redownload).