DesktopX: External scripts

Preview of DesktopX 3.2

Wednesday, June 14, 2006 by Frogboy | Discussion: DesktopX Tutorials

3.2 Preview Guide

Our story so far...

DesktopX was the first program (for PC or Mac) that enabled end-users to easily create desktop objects that could be combined together to form mini-programs commonly referred to as widgets (or gadgets) or used to design an entire desktop environment.

Over the past few years, widgets and gadgets have become very popular with Microsoft, Yahoo, Google, and others all getting into the act.  In power, no other platform can deliver what DesktopX can do.  With that power, however, comes complexity.  Stardock has continued to focus on ways to make it easier for developers and artists to fully harness the power of DesktopX.

Another important event is the coming of Microsoft gadgets.  Microsoft's gadget concept is very similar to what DesktopX can do.  Stardock's long-term goal is to enable users to export their DesktopX creations as Microsoft gadgets.  The powerful development tools and underlying DesktopX technology (called DirectGUI) will be able to be used to create Windows sidebar gadgets and more.

The first step in that path is DesktopX 3.2 which has two main new features:

  1. Windows Vista compatibility.  Content made with DesktopX 3.2 will work on Windows Vista.
  2. Scripts can now be externally located making it much easier for content makers to create their own library of scripts.

A new development environment

Most end users won't really notice the difference between 3.1 and 3.2.  What they will notice is an increased variety in the types of scripts and hopefully, more content from desktop, gadget, and widget creators since the process of creating "Stuff" is streamlined.

For this example, I am going to make a dictionary widget. Please note I am not an artist. I'm a software developer so the graphics in this will be painful.

Example: Dictionary widget

One of the advantages DesktopX has over other "widget" enablers is that it provides a GUI for most of the common, tedious work.  You don't, for instance, have to (though you can if you want) define images and objects using some text editor.  In DesktopX, it's all GUI driven.  Try to create a dictionary widget as easily in any other platform.

Step #1: Background window

From the DesktopX Helper toolbox, I press "Create object". Then I go to its properties and press the change appearance button which opens a dialog asking me to provide the image. I provide the image.

Step #2: Provide the text input box

The user has to have something to type their word they're looking up into. So I go through the same object creation procedure as before except for this:

I press "New" on script which opens up the script editor box. Then I choose ActiveX control. Then I choose DesktopX edit control. (I agree, we should have really common controls not require the user to go through this but this also exposes users to all the possibilities -- your computer is full of objects already. DesktopX lets you make use of them easily on your desktop).

Then just exit the dialog.  Now, HOLD DOWN THE CONTROL KEY when you click on that object and you can resize it. 

Step #3: Create the text output area

Now we need the area to output the definition. So go through the same object creation method as before (you can also create a new object from the DesktopX system tray item). One change though:

On the "States" page change the appearance from Image to Text.

Now, you can get pretty smug because you can visually change all the text settings from this GUI rather than mucking with it in some ASCII text editor.  Get it the color and size you want first.  And thinking ahead here, you will want to make sure it word wraps. So go to the summary page and set its width in pixels. I'm going to set it to 400.

Anyone who's made widgets or gadgets knows how annoying it can be to do this in script.  By contrast, the total time taken so far is about 30 seconds to create this widget (other than making the tutorial).  Did I mention our goal for Windows Vista is to allow creations to go onto the Windows Sidebar?

Step #4: Write the script

This is where we part ways with really casual users. If you're not a developer, this part may be confusing.

The first thing we need to do is give these objects some names so that they can talk to each other. On the summary page is the ObjectID. Name your objects something you can remember (like Dictionary_Text) on the object we just created.

I'm going to write two scripts. The first script is a tiny one that I'll attach to the edit field.

Here's my script:

Sub Control_OnKeyPress(AsciiValue)
 If AsciiValue = 13 Then
     DesktopX.ScriptObject("Dictionary_Text").LookItUp
 End If
End Sub

All I'm doing is looking for Ascii value 13 (which is the enter key basically) to be pressed and then  I'm going to call "LookItUp" in my text object which will grab the contents and send it to dictionary.com.  I am going to name the entry field object "Dictionary_EntryField" so that I can refer to it.

The second script is more complicated and here is where DesktopX 3.2 starts to shine -- dynamic scripts.  I'm going to write the script in Visual Studio.  Special thanks to Sranshaft who made a dictionary object that I could use as the basis of this.

The one annoying thing I ran into that we're trying to think of a more convenient solution is that when you change your script in Visual Studio, you have to go to the object that is using it, right click on it, and toggle "script enable" back and forth in order for it to update what's there.  If anyone has any preferences on how we essentially "reload" the script to be "recompiled" on the fly, let us know.

Anyway, so I took Sranshaft's dictionary script and modified it.  It's not very long. In fact, most of it is just replacing the junk in the response with blank characters (i.e. getting rid of the HTML characters).

Step #5: Connect the script to the object.

Now I need to go back to my text object and connect the script:

I wrote my script over in my "c:\projects\dxdev\scripts\dictionaryscript.vbs". 

So why do it this way? Why have your scripts be external to the object? In DesktopX 3.1, you couldn't. The idea was to have scripts be totally integrated into the object.  The problem with that is re-usability. It's a lot easier for developers to have a library of scripts that they make that they can then just refer to.  Over time, depending on feedback and interest, we can make this even easier to do.  The other reason to do this is to prevent catastrophic loss.  For instance, while I was modifying this script and testing the output, I got a huge overflow that brought down DesktopX.  No problem, I just restarted DesktopX and it remembered my last state. But there's a dialog that pops up asking if you want to erase everything (in the event you get yourself into an endless loop or something). If I had answered that incorrectly, I would have lost my work.  But with external scripts, I don't lose all my work, the scripts are still there on my hard drive, easy to find.

External scripts also benefit for users who use real-time data protection programs like KeepSafe which will create revisions of your creations so that if you really screw something up, you can go back to a previous version (and if you don't have KeepSafe already installed, quit reading this and go get it RIGHT NOW).

Step #6: Clean up and finish

Now it's just a matter of taking the 3 objects I created and putting them together.

This just means dragging the 3 objects around on screen until you've positioned them the way you want and then grouping them. Don't forget to hold the CTRL key down when you are moving the ActiveX control.

I just drag select the objects, right click and choose "group".

And then voila.

Step 7: Export it to a widget.

DesktopX 3.2 widgets are .EXEs. So as long as you have DesktopX installed, you can use them like any EXE.  Using Keyboard LaunchPad I then assign them a hot key so that when I need something like currency conversion or dictionary lookup or whatever, I just hit a hot key to bring it up.

To export as a widget just select all the objects, right click, and choose Export as widget which will take the user through the steps of assigning it an icon and the file name.

And voila.

We're still working out some of the kinks such as how to handle external scripts when it comes time to package them. Do we allow users who import widgets that use external scripts to see them? Could this be used as a way for people to protect their code? Hence, why DesktopX 3.2 is still in beta. But you can see where we're going.

DesktopX 3.2 is in beta. If you have Object Desktop, DesktopX is one of the programs that comes with it (along with WindowBlinds, IconPackager, Keyboard LaunchPad, etc.).

First Previous Page 2 of 2 Next Last
Randahl
Reply #21 Thursday, June 15, 2006 5:30 PM
Thanks Thomassen! I'm happy that got cleared up!
As for features, you all have made great comments on things that should be added, but I think the main issue, IMHO, (alongside the ones made above) , has always been then internal editor's interface! If that was tweaked to hold the suggestions stated above, as well as maybe the syntax colouring of objEdit, along with a more graphical "button" led user controls I don't think there would be the need to use an external editor.
Either that or just make it so that you can shoose your "default" editor to open when you click on the "new"/"edit" button in the properties dialogue with either a standard template similar to the one already given or the file you're editing?
PS. Roman, I feel your pain! It's one of the reason's I've stopped developing atm! That, and I'm moving again!
thomassen
Reply #22 Thursday, June 15, 2006 7:14 PM
Shadow Lord: no that doesn't sound hars. Dunno why it disappeared. Could have been a hickup.
As for the changelog: From SDC you get easy access to changelogs of all the apps. I reckon the reason why their website isn't updated with the latest version number is that SDC is the main method of obtaining the apps and it will always display the latest versions. That saves them from updating the website constantly.
Regarding "And as I said one of the major reasons I don't buy their programs is the corporate attitude."; who sells a product without a corporate attitude? I've found Stardock to be one of the most friendly corporation to deal with. You get to talk directly to the developers.


Back on topic:
I think that if the script editor got a facelift with the features mentioned in this post it'd benefit everyone, not just the developers. The easier it is to develop the more people will adopt it. That could encourage new creations which will lead to more people buying the client version of DX. DX got so much raw power which we've actually seen very few examples of being used. Clocks, weather, rss, calenders are piece of cake for DX. But making something more complex than that and the development tools in DX doesn't scale well when it comes to terms of usability. As mentioned, it's hard to locate that function or method in the thousands of lines. Same with the object lister, just a flat list of all the object which you have to scroll up and down to find just that object you are looking for. Then you have the script-eating problem which has haunted DX lately which really discourages people to undertake larger projects without following a strict backup-scheme.
DesktopX is one of my favorite apps. I've got loads of projects I've started and played around with, but unfortunately due to very time-consuming studies I haven't had time to get any of them to the point of completion. Now that I'm coming to the end of my studies I hope to get around to play around a little before job and real life calls again. I can resist new features of DX at the moment as it's quite extensive already. But I'd appreciate some refinements.
Skarny
Reply #23 Sunday, June 18, 2006 6:52 AM
An option to turn off/on all scripts. You could right click on dx icon in taskbar, select 'stop all scripts'
and also 'start all scripts' no conditions on it, if they are already started, restart them, if some are started and some not, still, start all, stop all. This would be useful I think.
lilstarfish
Reply #24 Tuesday, June 27, 2006 10:00 PM
Will the 3.2 version of DesktopX Professional finally
make it possible to configure the About screen to match
the created application?

Sorry, but the DesktopX advertising gotta go from the About-popup
if people are expected to use it for professional creations.
thomassen
Reply #25 Thursday, June 29, 2006 7:20 PM
lilstarfish: you could make a script that catches the right-click menu and the sys-tray menu and provide your own which will point the About command to your own about screen.
lilstarfish
Reply #26 Friday, June 30, 2006 6:25 PM
Thanks thomassen for the suggestion.

Unfortunately I'm not a programmer, I'm a graphic designer and
scripting is not my forte.

My goal for buying DesktopX Professional was to be able
to make mockups of specialized applications and GUIs
for clients, using the Gadget format
as the perfect solution.

With the current About box function it looks like I will not
be able to reach that goal.

Most other graphic applications that use different licensing
options have information in the "free" versions that tell the users
that the generated output is created with a certain application.
This information is of course no longer there when the output
is generated by the "professional" version.

Also compare to the Yahoo Widgets Engine(ex Konfabulator) that
lets you make really good looking About boxes that make the
application design look very professional, nice animated
resizing windows etc. etc.

But of course, the Yahoo Widget Engine is not an option
for me either due to the fact that it must be "installed"
for any applications to run.

Again, the About box is my biggest gripe about the
current DesktopX. Another concern is the way DesktopX
extracts all graphics and stuff that make up a Gadget
to the users temp directory making it a snap for
any user to take anything.
CerebroJD
Reply #27 Thursday, July 6, 2006 2:14 AM
Whoah, it does that? o_0

Loving the external scripts! Editing in ObjectEdit at the moment until I get visual studio .net installed again, but so far I'm really enjoying it! I would suggest having a 'refresh script' entry on the context menu, above the 'Script Enabled' button, in order to save some clicks. Is the 'Script Enabled' command accessible via script? If so, I'll just write an object to toggle the scripts on and off in a set of objects.

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01