DXInstance: command line & single instance plugin for DesktopX


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.

,