How create a Shortcut on DX (advanced)
from
WinCustomize Forums
How create a Shortcut on DX (advanced)
A Special thanks goes to sVis for her awesome help to make it a lot of more clear
This tutorial will show you how create an advanced shortcut in DesktopX.
It will have more options than the basic DesktopX shortcut object. I'll show you how to create the object and script. You'll need a little knowledge of scripting and DesktopX. To make it, I have read RomanDA's tutorials which you can find here:
RomanDA articles
You should, at each step of this tutorial, see the picture for more information.
Create the Object
First right click on DesktopX Builder systray icon and select "create object"...
Summary Information
Then, in the object's properties in the "Summary" tab, enter the author name (guess it's you). Set the width to 50 and height to "follow aspect ratio". This is so that all the pictures of your shortcut will only be 50px). Finally, set the object ID.
Add a Custom file
No no, it's not finished yet. Now you need to add the main picture of your object.
Go to "custom files" in the "Summary" tab and then click "add".
Browse for your picture. Here it's the earth. ''('''Note:''' Remember the full name of the image file, you'll need it in future.)''
Here it's "Blue + Black Internet 1.png"
Add States
Now, you'll add some states. In the "States" tab, click on add.
Then, select "mouse away", "mouse over", " mouse down", and "Nothing". To make the "Nothing" state simply edit the name of the state.
In these states, change the appearance to the same picture that you embedded earlier. ("Blue + Black Internet 1.png") It can be found in the drop down menu.
Then, add some effects in the "color" tab. Here I set the brightness to 50 on "mouse over" and 30 on "mouse down", same for the contrast.
Apply and save. In case of an error you should keep a good copy of the object.
Create the Script
First go to Object Properties and in the "General" tab click on "new" script.
The first part of the script are the OnScriptEnter, OnScriptExit functions.
These will be called on when the widget first runs and when the widget closes. This script will call other functions for saving and loading user settings explained later.
Right Click Menu
This script for the right click menu will allow the user to choose an image for the shortcut's icon, and the ability to choose between a file, folder or url as the shortcut's target.
You can see the entire right-click menu code above. I'll explain some of the parts.
Case 1 is the part of the code that changes the picture of the shortcut on all object states: "mouse away", "mouse over", and "mouse down". ''('''Note:''' "nothing" state will be for another function)''
"System.FileOpenDialog" will open a dialog window to choose the file. "Select a Picture...." will be the title of the dialog window. "Pictures: jpg,bmp,png|*.jpg;*.bmp;*.png" will allow the user to browse for those types of files only.
In Case 2,3, and 4, the first line will recall the main settings of the object in error case. Object.States("Nothing").picture="Blue + Black Internet 1.png"
then the target is as set on left click
target = Object.States("Nothing").picture
and there it's the "target = object.command"
So to explain once you'll set a target the address of this one will be copy
on the "Nothing" state and in this three case as object.command too
Case 2 will open the file dialog:
A Special thanks goes to sVis for her awesome help to make it a lot of more clear
This tutorial will show you how create an advanced shortcut in DesktopX.
It will have more options than the basic DesktopX shortcut object. I'll show you how to create the object and script. You'll need a little knowledge of scripting and DesktopX. To make it, I have read RomanDA's tutorials which you can find here:
RomanDA articles
You should, at each step of this tutorial, see the picture for more information.
Create the Object
First right click on DesktopX Builder systray icon and select "create object"...
Summary Information
Then, in the object's properties in the "Summary" tab, enter the author name (guess it's you). Set the width to 50 and height to "follow aspect ratio". This is so that all the pictures of your shortcut will only be 50px). Finally, set the object ID.
Add a Custom file
No no, it's not finished yet. Now you need to add the main picture of your object.
Go to "custom files" in the "Summary" tab and then click "add".
Browse for your picture. Here it's the earth. ''('''Note:''' Remember the full name of the image file, you'll need it in future.)''
Here it's "Blue + Black Internet 1.png"
Add States
Now, you'll add some states. In the "States" tab, click on add.
Then, select "mouse away", "mouse over", " mouse down", and "Nothing". To make the "Nothing" state simply edit the name of the state.
In these states, change the appearance to the same picture that you embedded earlier. ("Blue + Black Internet 1.png") It can be found in the drop down menu.
Then, add some effects in the "color" tab. Here I set the brightness to 50 on "mouse over" and 30 on "mouse down", same for the contrast.
Apply and save. In case of an error you should keep a good copy of the object.
Create the Script
First go to Object Properties and in the "General" tab click on "new" script.
The first part of the script are the OnScriptEnter, OnScriptExit functions.
These will be called on when the widget first runs and when the widget closes. This script will call other functions for saving and loading user settings explained later.
| SCRIPT CODE | |
Right Click Menu
This script for the right click menu will allow the user to choose an image for the shortcut's icon, and the ability to choose between a file, folder or url as the shortcut's target.
| SCRIPT CODE | |
|
|
You can see the entire right-click menu code above. I'll explain some of the parts.
Case 1 is the part of the code that changes the picture of the shortcut on all object states: "mouse away", "mouse over", and "mouse down". ''('''Note:''' "nothing" state will be for another function)''
"System.FileOpenDialog" will open a dialog window to choose the file. "Select a Picture...." will be the title of the dialog window. "Pictures: jpg,bmp,png|*.jpg;*.bmp;*.png" will allow the user to browse for those types of files only.
In Case 2,3, and 4, the first line will recall the main settings of the object in error case. Object.States("Nothing").picture="Blue + Black Internet 1.png"
then the target is as set on left click
target = Object.States("Nothing").picture
and there it's the "target = object.command"
So to explain once you'll set a target the address of this one will be copy
on the "Nothing" state and in this three case as object.command too
Case 2 will open the file dialog:
















