I'm very exited!!!
from
WinCustomize Forums
Hello to everyone...i know this will sound really stupid to the ones who know...but i think the rest will like this...
I managed to make an Opacity Changer slider object for DesktopX,something to control the opacity of other objects.
This is useful for anyone who'd like to have a semitransparent skin on the desktop at times...
Before the coding you need to do the followig:
a.Make a backround for your slider (Optional). Set its attributes to locked.
b.Make the graduated climax graphic for your slider. Group this with your backround above and set it to lock movement.It must be 100 pixels wide since Opacity is counted from 0-100.
c.Make the actual glider. Place it somewhere on the desktop,group it with the rest above,but don't set it to be a child of the backround. Also take a note of its x coordinate. For me it was 450.Also set it to locked.
d.Make a text object.Lock it.
e.Set for all objects to Disabled (both Horizontal and Vertical) in Adjust Position if screen size changes.
f.Set a unique Object ID for the above objects and set them all to have the backround object as the parent. Set them also to be Child Objects,except the actual glider.
Explaining the way the slider works:
- It takes the left side of the glider as the first starting point and with some code it makes it to function in a specific scale as a handle of a specific function.
So here is the code i used with explanatory comments in brackets.
Code for the objects that are going to be transparent - For all objects you want their transparency to be changed:
'Called when the script is executed
Sub Object_OnScriptEnter
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
End Sub
Code for the transparency glider:
'Called when the script is executed
Sub Object_OnScriptEnter
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
End Sub
Sub Object_OnDrag(x,y,newX,newY) (The state at which you set that the object will run the script due to the fact it will be dragged for some distance)
Object.top = Object.Top (To set that the object will be On Top)
number = newX - 450 (The mathematical act for the number the slider shows,the text indicator of opacity percentage,this will be the text you created above.)
If newX<450 Then
Object.left=450
number = 0
End If (With this script you say that if your object is lower than the left side of the object the system will move it to the exact position you need it to be. Also it sets the numeric indicator to 0 for 0% opacity.)
If newX>550 Then
Object.left=550
number = 100
End If (With this script you say that if your object is above than the further left point the object is supposed to go then the system will move it to the exact position you need it to be. For opacity this needs to be 100 above the previous bit of the script. For hue this function must be 255 and likewise for brightness. Also this part of the code sets the numeric indicator to 100 for 100% opacity.)
(Basically with the two above scripts we've set that the glider will be on a specific X-Coordinate axis and it will be on an ammoung of 100 pixels.This is why the objects need to be locked and also not to change positions if screen size changes).
desktopx.ScriptObject("Opacity_Figure").object.text = number (This line is responsible for transmitting info on the numeric indicator.The word in "" is the Object ID of the numeric indicator).
desktopx.ScriptObject("Sound Panel").object.Opacity = number (In this line we say which objects are supposed to do something.In this case we set that the object in brackets "" is supposed to change its opacity according to the number,the text indicator.)
End Sub
I hope this is somewhat helpful for everybody who is into scripting for Desktop X.
Below is the code with no explanatory comments for copy-paste if you need it.
Code:
'Called when the script is executed
Sub Object_OnScriptEnter
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
End Sub
Sub Object_OnDrag(x,y,newX,newY)
Object.top = Object.Top
number = newX - 450
If newX<450 Then
Object.left=450
number = 0
End If
If newX>550 Then
Object.left=550
number = 100
End If
desktopx.ScriptObject("Opacity_Figure").object.text = number
desktopx.ScriptObject("Sound Panel").object.Opacity = number
End Sub
Enjoy you all and have a really happy day.
I managed to make an Opacity Changer slider object for DesktopX,something to control the opacity of other objects.
This is useful for anyone who'd like to have a semitransparent skin on the desktop at times...
Before the coding you need to do the followig:
a.Make a backround for your slider (Optional). Set its attributes to locked.
b.Make the graduated climax graphic for your slider. Group this with your backround above and set it to lock movement.It must be 100 pixels wide since Opacity is counted from 0-100.
c.Make the actual glider. Place it somewhere on the desktop,group it with the rest above,but don't set it to be a child of the backround. Also take a note of its x coordinate. For me it was 450.Also set it to locked.
d.Make a text object.Lock it.
e.Set for all objects to Disabled (both Horizontal and Vertical) in Adjust Position if screen size changes.
f.Set a unique Object ID for the above objects and set them all to have the backround object as the parent. Set them also to be Child Objects,except the actual glider.
Explaining the way the slider works:
- It takes the left side of the glider as the first starting point and with some code it makes it to function in a specific scale as a handle of a specific function.
So here is the code i used with explanatory comments in brackets.
Code for the objects that are going to be transparent - For all objects you want their transparency to be changed:
'Called when the script is executed
Sub Object_OnScriptEnter
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
End Sub
Code for the transparency glider:
'Called when the script is executed
Sub Object_OnScriptEnter
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
End Sub
Sub Object_OnDrag(x,y,newX,newY) (The state at which you set that the object will run the script due to the fact it will be dragged for some distance)
Object.top = Object.Top (To set that the object will be On Top)
number = newX - 450 (The mathematical act for the number the slider shows,the text indicator of opacity percentage,this will be the text you created above.)
If newX<450 Then
Object.left=450
number = 0
End If (With this script you say that if your object is lower than the left side of the object the system will move it to the exact position you need it to be. Also it sets the numeric indicator to 0 for 0% opacity.)
If newX>550 Then
Object.left=550
number = 100
End If (With this script you say that if your object is above than the further left point the object is supposed to go then the system will move it to the exact position you need it to be. For opacity this needs to be 100 above the previous bit of the script. For hue this function must be 255 and likewise for brightness. Also this part of the code sets the numeric indicator to 100 for 100% opacity.)
(Basically with the two above scripts we've set that the glider will be on a specific X-Coordinate axis and it will be on an ammoung of 100 pixels.This is why the objects need to be locked and also not to change positions if screen size changes).
desktopx.ScriptObject("Opacity_Figure").object.text = number (This line is responsible for transmitting info on the numeric indicator.The word in "" is the Object ID of the numeric indicator).
desktopx.ScriptObject("Sound Panel").object.Opacity = number (In this line we say which objects are supposed to do something.In this case we set that the object in brackets "" is supposed to change its opacity according to the number,the text indicator.)
End Sub
I hope this is somewhat helpful for everybody who is into scripting for Desktop X.
Below is the code with no explanatory comments for copy-paste if you need it.
Code:
'Called when the script is executed
Sub Object_OnScriptEnter
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
End Sub
Sub Object_OnDrag(x,y,newX,newY)
Object.top = Object.Top
number = newX - 450
If newX<450 Then
Object.left=450
number = 0
End If
If newX>550 Then
Object.left=550
number = 100
End If
desktopx.ScriptObject("Opacity_Figure").object.text = number
desktopx.ScriptObject("Sound Panel").object.Opacity = number
End Sub
Enjoy you all and have a really happy day.