VBScripting, but its not as hard as you'd think...
Friday, August 5, 2005 by CerebroJD | Discussion: DesktopX Tutorials
Welcome to Part 1 of the basics of DesktopX
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:
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:
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
DesktopX.Object("Test").Width = 300
'Called when the script is terminated
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!