Now a blog about my Android adventure
VBScripting, but its not as hard as you'd think...
Published on August 5, 2005 By CerebroJD In DesktopX Tutorials

Welcome to Part 1 of the basics of DesktopX

by CerebroJD

First thing I want to convey to you about this, is that its NOT HARD to learn. Everything that we cover will be in tiny steps designed to get you working in DesktopX in as little time as possible. I hope I can keep things clear and straightforward. Please, comment once you have read through it and let me know if you need any sort of clarification!


When you first create a new DesktopX object, you are presented with its Properties dialog, from which you can edit all sorts of settings. Actually, everything about the object, including its location, transparency, and shadows. Of course, its not limited to that; Each object is nearly infinitely configurable, with hundreds of extra bits hiding all over the place.

The first thing we're going to do is generate the default script, but before we do that, we're going to give this default object a name. Look under the Summary tab in the Properties dialog for the attribute marked Object ID. For the purposes of this writeup, I'm going to use the name "Test". Once that is done, go to the General tab, look near the Script section, and hit New. A new box should show up:

This box is your generic script editing box for DesktopX. Using just the properties box, you can make pretty objects, but its in here that the true power of DX is unleashed. Using VBScript, you can manipulate not only this object that you are working on, but also other objects. You can perfom mathmatical calculations, make timers, etc. However, we're not gonna start off that complicated... yet. We'll get there though.

As you can see, there is already a default script in the script editor. Currently, it does nothing besides call two empty subs. A sub is a block of code that executes when its told to. Like an automatic function, since it doesnt need explicetly called in the script. The two that are in there by default are very straight forward. The green comments also indicate the purpose of each sub. We'll just make a note of that right now: An apostrophe will make everything that comes after it on that line invisible to the script parser, allowing you to comment your work.

Ok, in the script editor, we're going to begin our work withing the confines of the first sub. This one is designed to run right when you first apply the changes, so we'll see the stuff we put into the code take effect immediately after we apply them. Now to begin coding.

Recall now that the object we are working in is named "Test". We called it that way back at the beginning, remember? In order to get the script talking with that object, we've got to enter in some code, and we're gonna do it right between the top and bottom bits of that first sub:

DesktopX.Object("Test")

Once you have that in, you need to have some kind of attribute on it to modify. We'll do something basic, like width. Easy enough:

DesktopX.Object("Test").Width

Now, finally, the attribute must be set to equal something, and we'll just use something basic:

DesktopX.Object("Test").Width = 300

Ok, so that block of code is going to stretch the width of the object to 300 pixels wide as soon as the script is applied. Check it out by exiting the script editor, then hitting apply. In theory, you should get something just like this:

Final code, start to finish:

'Called when the script is executed
Sub Object_OnScriptEnter
DesktopX.Object("Test").Width = 300
End Sub

'Called when the script is terminated
Sub Object_OnScriptExit

End Sub

More to come soon!

Comments
on Aug 05, 2005
Great start! Short, simple, and very understandable. I'd say keep going as you are.
on Aug 05, 2005
yes, even i can follow this......
on Aug 09, 2005
Eeeeeexcellent! Thanks for this. I think I could figure out this scripting stuff, I just need someone to walk me through it like this.
on Aug 09, 2005
Excellent tutorial..

I can manage simple objects but I really need very short step by step instruction..too much info and I get confused. This was a great start ..
on Oct 12, 2005
I like it.
But it looks like the images are gone?
What happened.
on Dec 29, 2005
Finally a scripting tutorial that goes my speed with my understanding - please keep this up. I have some objects that I want to add scripting to, and I think this is right up my ally.

Thanks - Einy
on Dec 30, 2005
Good good! darquiel: Since the images are hosted on my site, me moving things around sometimes affects image availability. Also, server downage can prove to be annoying.
on Nov 14, 2007
very nice tutorial,
it helped me a lot
on Nov 14, 2007
I agree with Einstein. This is my speed and would love to see more simple tutorials like this. I can follow along and it makes sense to me. Please give us more.