DX Tutorial #6: Date/Time Widget - PART 2
Creating your first DX Widget Step-by-step! - PART 2
My goal is to make a set of tutorials for DekstopX. If you have ideas on what you would like to see, please email me at [email protected]
Time/Date & more - PART 2:
I continue the Time/Date widget here, if you have not seen part one, please read it first..
This is not my typical tutorial, this will be a STEP-BY-STEP Creation of a widget, not just some code.
DOWNLOAD THE ZIP FILE FOR THIS TUTORIAL FIRST!
DekstopX can use JavaScript or VBScript as its language, I am a LOT more familiar with VBScript then JS so that is what I use.
As always, I'm sure there are other, if not better ways to do this, but this is my way.
|
The Script: | |||||||||||||||||||||
| Right click on the Base object (somewhere where the TEXT objects are not, like the top green part, or bottom green part), and select Properties
From the General Tab in the BASE-Properties dialog select NEW next to Script. You will see a dialog like the one below | |||||||||||||||||||||
![]() |
This is the DekstopX Script Editor.
From here we will create our script to change the Text objects to show the CORRECT date/time/etc. We will also setup a "Timer" that will update the time and the date ever 30 seconds. | ||||||||||||||||||||
| We are going to modify the script above to look like this: (only the text in WHITE is important the YELLOW is to show you what is going on)
Click the "File" menu item, then "Save and Close editor", then click "OK" in the properties dialog box. That's it, it should be working. | |||||||||||||||||||||
![]() |
If you get a DX Scripting Error box, note the LINE Number its complaining about, and click the "Disable and Edit" button to go back into the script and see what is wrong.
Compare your code to the code above. Here are some typical problems. desktopx.Object("DayOfweek").text = WeekDayName(Weekday(now), False) Tell me what the problem is with this????? anyone??? oh... its the Dayofweek - its not right, it needs to be DayOfWeek (CAP W!) Some other problems are missed spaces, or added spaced. | ||||||||||||||||||||
![]() |
if you click on "Disable and Edit" your script is now turned OFF.
To turn if back on RIGHT click (in the green) on the BASE object and select "SCRIPT ENABLE" (see the checkmark that tells you its running, no check, not running). And see if you get any more errors. | ||||||||||||||||||||
|
Widget/Gadget Export: | ||
| The last step in the process is to create a WIDGET from the above items. (a widget takes the objects and makes them into an EXE file that requires DX to run). If you have DX Pro you could make this into a GADGET (a gadget does the same creation of an EXE file, but this one does NOT require DX to run). | ||
![]() |
Right click on the BASE object and select "EXPORT".
| |
![]() |
In the Export Objects Dialog note the following items:
(x) Selected and related, this will take every object that is has the SAME "widget" name as the one you selected. This is good if some items are not visible or if they might be off the screen. The other way to select the objects is from the RIGHT CLICK on the DX Icon in the system tray and select "LIST OBJECTS", from there you can "Highlight" all the objects and export them together. Export as a Widget: Select this if you want to export this as a widget that uses DX to run Export as a Gadget (PRO Version Only): Select this if you want to export this as a stand alone gadget. Select "NEXT" | |
![]() |
Widget name: the name you want to call the widget, I picked "DateWidget" you could call it whatever you want.
Author: Duh - your name Version: 1.xxx? Whatever you want, I usually start at 1.000 and every time I export it I add .001 to it. Website: your website [x] Application Icon: (ico file location). If you made an icon for this widget you can select one, if not use mine!! heheh ( ) Taskbar / Systray / None Pick where you want this program to show up, most people use the systray so you can right-click it and close it from there, I have never used the Taskbar, as its not designed to be a program like word, or IE, or whatever, its a widget/gadget. But its your call. Select "Next" | |
![]() |
Include...: You can include information about you or your widget here, functions, etc. It shows up in the about/more info dialog when the widget is running. Save Widget As: Where do you want the widget to be saved and what do you want it to be called. As you can see I keep all my widgets on my D drive under DekstopX/widgets, its your call here. Allow Multiple ...: This would allow you to run multiple copies of this widget, not something I have messed with, I would assume this is more for something like martin's notepad, but I'm not 100% sure. Select "Finish" | |
That should about do it. You have now made a new widget that can be run on any machine with DX. I hope this has helped you to get into DXing. It is a simple application of how DX works, and showed you how to create an object from an image, as well as text based objects. It also should give you some insight into how to create a basic script and a timer.
PLEASE let me know if you run into trouble on this, or if it worked and you were able to make this widget do its thing.
I assume no comments means no one is finding these useful. If this is the case, I can stop a lot easier then I can continue. This one tutorial alone has taken me around 3 hrs to type up and setup.
![]() |
Enjoy, RomanDA AKA: David A. Roman http://romanda.wincustomize.com http://www.romanda.org [email protected] |







