Weather Script Component

Posted by Julien on July 23rd, 2009

Hey all!

For the past few days, I’ve been working on a weather script component. It takes the form of an independent .wsc script file that you reference in your widget script (setting up license info and registering callbacks), calling a few methods and getting weather/location/alert data in the form of a script object with several properties.

Using this new script means rewriting a lot of the existing weather objects script, only keeping the UI handling in the widget scripts and delegating all the weather stuff to the component. It’s not a short term solution for authors that need to update their widgets in the next few days, but I think it’s the easier and more maintainable solution in the long run, as it would finally do away with the duplicated and slightly tweaked weather code in all weather widgets.

The plan is to support several widget providers in the same script, in a mostly transparent way. Right now, I’m planning to have the following providers (in this order):

  • wunderground
  • weatherbug
  • weather.com
  • METAR (their xml doesn’t seem too nice to parse and their text only data looks like it’s getting right out of an old mainframe)
  • accuweather

Using the script

I’ve tried to make the API as simple as possible, hiding most of the complexity in the script component.

To start using the weather component, you need to create a new instance of the script and register callbacks. Those are functions that will be called when new weather data is available.

Set WeatherController = GetObject("script:" & LIB_FOLDER & "Weather.wsc")

WeatherController.RegisterCallbacks GetRef("OnLocations"), _
                                    GetRef("OnWeather"), _
                                    GetRef("OnAlerts"), _
                                    GetRef("OnForecast"), _
                                    GetRef("OnCameras"), _
                                    GetRef("OnError")

Set WeatherController = GetObject("script:" & LIB_FOLDER & "Weather.wsc") 

WeatherController.RegisterCallbacks GetRef("OnLocations"), _
                                    GetRef("OnWeather"), _
                                    GetRef("OnAlerts"), _
                                    GetRef("OnForecast"), _
                                    GetRef("OnCameras"), _
                                    GetRef("OnError")

You can then get a list of supported providers to let the user choose the one he wants, of simply hardcode the provider you want. If the provider requires a license key, you can also set it at this time, as well as the unit system to use.

WeatherController.SetProvider "WUnderground"

' Default is True
WeatherController.UseMetricSystem = True

' This will be ignored by the WUnderground provider as it does not use a license key
WeatherController.SetLicense "my_id", "my_key"

Contributing

Once the API is stable, I’ll update this post and if you want to help me add support for the other weather site, let me know!

If you want to use the script and there is some functionality that seems to be missing, post here or PM me and we’ll see if it can be added.

Download

I’m still working on the script and the API is still in flux, but you can get a look at it here.

Extended System Control plugin for DesktopX

Posted by Julien on June 22nd, 2009

image

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)
  • Added instance information (merged from DxInstance)

1.0 Build 205:

  • First test version

DXInstance: command line & single instance plugin for DesktopX

Posted by Julien on June 17th, 2009

This is a very small plugin for DesktopX that exposes command line information in your scripts, allowing you to act on certain parameters. It also adds a new callback that is called when another instance is started and gives you its command line arguments.

Use

  • associate a gadget to a custom file type and be able to do custom processing when called with the file path as an argument.
  • make the "Tasks" category of the jump list in Windows 7 usable (they are shortcuts and supposed to be available even if the application is not running, so they need to be shortcuts to the single exe, not the extracted one).
  • handle any other custom command line arguments like a normal application.

Documentation

Remember to select “Allow multiple instances of the application to run” when exporting your gadget!

Here are the new functions/callbacks available to your scripts:

Instance.CommandLine

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

Instance.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)

Instance.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.

Instance_OnNewInstance(commandLineArgs)

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

Download

This plugin functionality is now part of the DXSystemEx plugin. You can get more information in this blog post.

 

Note: This plugin will not work with single-exe gadgets (or widgets)! Due to the way simple deployment gadget’s command line is handled, adding arguments will result in the gadget not even starting (it’s treating almost any command line argument as a path…). I sent a bug report/request to Stardock, but in the meantime, you will have to use custom deployment. I have a binary patch available for DXAppCustom.bin that fixes the command line parsing and allows gadgets to get the original command line (but disables ObjectBar-related code as it’s kind of a hack), so it’s definitely fixable. Let’s hope the next version of DX will have a fix.

DXTaskbar7: a DesktopX plugin to access Windows 7 taskbar extensions

Posted by Julien on June 12th, 2009

DXTaskbar7 - Preview

With Windows 7 a few months away, it was time to bring some of the new features to DesktopX. One of the things gadgets could really benefit from is the new extended taskbar. It has a few new options such as jump lists, tasks, thumbnails toolbars, icon overlays, progress bars and thumbnails.

DXTaskbar7 is a new plugin for DesktopX that allows you to access all those new features from your DesktopX scripts.

How to help

Download the DXTaskbar7 package and start creating gadgets &widgets!

What to look for

  • Tab handling problems: tabs not appearing, tab name and icon not properly updated
  • Toolbar: icon corruption
  • crashes or memory leaks

DeliveryTracker-Win7What is broken/not working properly

  • ActiveX controls are not drawn on the tab preview (this is a problem with DesktopX)
  • This is a DEBUG build, so it’s going to be slower than normal

Links

Documentation

Tabs management

TabHwnd

Get the handle for that tab (to be used in ConfigureTab).

SetTabsIcon(image)

Set a global icon for all the tabs.

  • image: path to a 16×16 image file

ConfigureTab(name, insertAfter)

Setup the tab name and position.

  • name: title of the tab
  • insertAfter: handle of the tab after which the configured tab should be inserted. Use 0 to insert after the last tab

SetTabActive()

Set the tab as active and show it in the tab list.

RemoveTab()

Remove the tab from the list.

Taskbar_OnCloseTab()

This function will be called when the user closes a tab in the list.

 

ThumbBar

SetupButton(id, image, tooltip, flags)

Setup a new tab button.

  • id: internal id (to be passed in the Taskbar_OnButtonClicked callback when the button is clicked)
  • image: path to a 16×16 image file
  • tooltip: the tooltip to shown on mouse-over
  • flags: a list of flags (see DXTaskbarDefines.vbs)

UpdateButton(id, image, tooltip, flags)

Update an existing tab button (only after buttons have been added).

  • id: internal id (to be passed in the Taskbar_OnButtonClicked callback when the button is clicked)
  • image: path to a 16×16 image file
  • tooltip: the tooltip to shown on mouse-over
  • flags: a list of flags (see DXTaskbarDefines.vbs)

AddButtons()

Add the list of buttons to the tab. 
A maximum of 7 buttons can be added at one time. After the buttons have been added, you cannot setup new ones. Use the UpdateButton function to modify existing buttons.

Taskbar_OnButtonClicked(id)

Called when the user clicks on a thumbbar button.

  • id: the button id used in SetupButton and UpdateButton

 

Overlay

SetOverlayIcon(image, description)

Applies an overlay to a taskbar button to indicate application status or a notification to the user.

  • image: path to a 16×16 image file
  • description: an alternative text version, for accessibility purposes

 

Progress

SetProgressState(flag)

Sets the type and state of the progress indicator displayed on a taskbar button.

  • flag: a progress flag (see DXTaskbarDefines.vbs)

SetProgressValue(completed, total)

Displays or updates a progress bar hosted in a taskbar button to show the specific percentage completed of the full operation.

  • completed: number of steps completed
  • total: total number of steps

 

Tasks and destinations

AddUserTask(name, path, arguments, icon, iconIndex, workingFolder)

Add a new user tasks (typically static links)

  • name: name of the task
  • path: path to the program to execute
  • arguments: arguments to the program
  • icon: path to .ico file to use as an icon
  • iconIndex: index of the icon to use in the .ico file (typically 0 if you only have 1 icon type)
  • workingFolder: working folder when executing the program

AddSeparator(category)

Add a separator

  • category: the category to add a separator to. To add a separator to the tasks, use “Tasks” as the category.

CommitList()

Declares that the Jump List is complete and ready for display

AbortList()

Discontinues a Jump List building session without committing any changes

 

Changelog

1.0 Build 231

  • Implemented Tasks

1.0 Build 205:

  • Added parameter checking in most functions
  • Fix for Vista and XP: all functions calls are ignored on those systems but are still available to scripts, so you should not get any script error

1.0 Build 198:

  • First test version

Download

You can download it on Wincustomize or from here.

Animator Script Component 1.1

Posted by Julien on May 12th, 2009

imageA small update for the Animator Component is now available. Changes from the internal version have been merged and a new method to remove all animations related to a specific object has been added.

The Animator Sample now has checkboxes to enable/disable a specific animation and the requested script “export” has been added. You can now tweak your object animation and have a ready to use script copied to the clipboard.

Download it from Wincustomize.

DXCanvas 2.0

Posted by Julien on May 12th, 2009

image I released an update for DXCanvas yesterday. This new version is in sync with the latest Canvas specifications. Error handling has been overhauled and is now closer to the spec (some things still aren’t the same as we are not running inside a browser and thus do not have access to a real DOM tree).

The Canvas Controller widget has received a lot of updates and can now run the Canvas test suite and generate a test report. We now pass 92.1% of the tests.

The source code has also been moved to a public repository on Google Code.

Download

You can get DXCanvas from here or from Wincustomize.

Changelog

2.0 Build 174:

  • Sync with the latest version of the Canvas specifications
  • Added new createImageDataFrom function to create an new ImageData instance using an existing one dimensions
  • Exceptions now return the correct DOMException error code
  • Completed documentation of IDL interface
  • Updated Canvas Controller with a pin to desktop icon
  • Integrated test suite into Canvas Controller (allows to run all tests at once and generate a report)
  • Updated test suite generator to parse the XML generated by Canvas Controller
  • Fixed Canvas Controller dialog drag during long operations
  • Fixed crash on exit when BETA was expired   
  • Fixed handling of negative width&height values by drawImage
  • Fixed handling of nonfinite arguments by drawImage
  • Fixed pattern leak in drawImage
  • canvas.rect() now handles NaN and Infinity correctly
  • pattern.addColorStop() now handles NaN and Infinity correctly   
  • Tweaked text drawing on paths   
  • Updated box blur algorithm to use precomputed values (slightly faster)
  • Moved support libs to a subfolder of project   
  • Moved source code from private repository to Google Code
  • Update Cairo (HEAD), Pixman (0.15.2), Pango (1.24.2), Glib (2.20.1)

DockletX

Posted by Julien on February 23rd, 2009

DockletX-Preview DockletX is a plugin for DesktopX that allows you to run ObjectDock docklets on your Desktop.

It implements the ObjectDock Docklet host interface and can load pretty much any docklets built for ObjectDock.

A few things are not implemented at this time:

  • Attention animations (such as glow or bounce)
  • Export (running as a gadget is not tested and might not be working properly)

 

Right now, only ObjectDock docklets are supported, but support for Y’z Dock and maybe AveDesk desklets is planned.

 

Download here.

.Net 2.0 support for ObjectDock

Posted by Julien on February 23rd, 2009

Runtime SDK-PreviewIt’s been available for some time from Wincustomize but I never did any big announcement. The old .Net  docklet for ObjectDock was compiled with .Net 1.0 and thus wasn’t working on newer version of the Framework. It also had problems on Vista with plugin registration which didn’t work with UAC on.

The new version is compiled with .Net 2.0 and should run correctly on Vista. I recently published a small update with support for ContextMenuStrip for docklet context menus, a check for older versions of the SDK so that docklets can specify a minimum supported SDK version and a workaround for the broken OnDropFiles in ObjectDock. There is also two new Host methods exposed (DoClickAnimation and RemoveSelf).

Download

The .Net 2.0 runtime docklet is available from Wincustomize and you can download it here.

Animator Script Component for DesktopX

Posted by Julien on February 1st, 2009

Preview I have this animation script I wrote 2 years ago for a widget (that I never finished), and I recently got back to work on a package tracking widget that is going to use some part of it. Still 70% of the script is never going to be used and I don’t want to throw it away, especially if it can help other people.

I’ve noticed a lot of questions on how to animate groups of objects, and everybody seems to write semi-custom code over and over. My script takes the form of a Script Component (an external script file you reference in your DesktopX script), which means it can be reused without cut&pasting dozens of lines of code every time.

Let me give you an example. In the script below Animator is the main object (already initialized, 3 lines of code, not of interest here). The last argument of each XXXAnim.Init methods is a callback that you can use to call a function when the animation is done. It’s especially interesting if you need to coordinate several complex animations. I’ve added variables so you can understand what each Init call does, but in practice the script would be a little bit simpler.

[sourcecode language='vb']

opacity = 75
length_fade = 1500
delay_fade = 500
toX = 300
toY = 300
length_move = 5000
delay_move  = 0
 
Set fadeAnim = CreateObject(“DXScriptLibrary.FadeAnimation”)
Set moveAnim = CreateObject(“DXScriptLibrary.MoveAnimation”)
 
fadeAnim.Init DesktopX.Object(“My_Object_Layer”), opacity, length_fade, delay_fade, Animator.EaseNone, “”
moveAnim.Init DesktopX.Object(“My_Object_Layer”), toX, toY, length_move, delay_move, Animator.EaseIn, “”
 
Animator.Add Array(fadeAnim, moveAnim)
Animator.Start

[/sourcecode]

So, what this code does is prepare 2 animations with different length and start time, give them to the animator component and then start the animations. The Animator object will automatically manage the animations, starting each one after the delay (and of course fade will apply to all child objects). You can also add a new animation while the previous ones are playing, it will be handled transparently, adjusting delays and total animation length.

As a bonus, you can specify the easing type. In the example, the object will start to move slowly and speed up as it moves through the animation.

There are 4 different animation objects (Fade, Move, Rotate, Resize) and 5 types of easing (EaseIn, EaseOut, EaseInOut, EaseOutElasticBig, BackOut). Everything is in separate components with minimal dependencies, so adding new stuff is relatively easy should you wish to so (new easing types for example)

Download from here.

Nightmares – a dynamic dream testing utility

Posted by Julien on August 31st, 2008

Nightmares (Build 1.0.173) - Dynamic dream testing utilityNightmares is a small application created to test dynamic dreams. It runs them in a window,
allowing you to debug them easily or to record a preview video.

You can set the window size (default is 800×600), chose an output file and FourCC code for the output video.

It currently only runs unprotected dreams: the dreams that come with DeskScapes will work, but any dynamic dream that you bought won’t.

See the readme file for command line switches.

Download test build here.

Update: Added preliminary support for protected Dreams (you will have to activate them first through DeskScapes).