scripting color
hue shift
Saturday, June 14, 2008 by PuterDudeJim | Discussion: DesktopX Tutorials

'Called when L-click is released
Function Object_OnLButtonUp(x, y, dragged)
If Not dragged Then
'Store the current hue in variable
hueshift = Object.hue
'If current hue is equal to or greater than 255
'reset to 0
If hueshift => 255 Then
hueshift = 0
'If hue is not yet 255, keep adding
Else
hueshift = hueshift + 7
End If
'Set the object hue
object.hue = hueshift
End If
End Function
Reply #2 Sunday, June 15, 2008 8:02 AM
Function Object_OnLButtonUp(x, y, dragged)
If Not dragged Then
Dim objects
objects = Array("name1","name2","name3","name4","name5") '<== enter the names of your objects here
'Store the current hue in variable
hueshift = Object.hue
'If current hue is equal to or greater than 255
'reset to 0
If hueshift => 255 Then
hueshift = 0
'If hue is not yet 255, keep adding
Else
hueshift = hueshift + 7
End If
'Set the object hue
For Each item In objects
desktopx.object(item).states("").hue = hueshift
'or use this if you need change hue for current state only
'desktopx.object(item).hue = hueshift
Next
Set objects = nothing '<== clear memory
End If
End Function
Best Regards.

Reply #3 Sunday, June 15, 2008 10:19 AM
I should have thought about Array, way better and easier.
ArileenDesign was sure he needed to rewrite all his codes...
Reply #4 Sunday, June 15, 2008 10:27 AM

Same as Vlad's but, without array, etc.
- Function Object_OnLButtonUp(x, y, dragged)
- If Not dragged Then
- 'Store the current hue in variable
- hueshift = Object.hue
- 'If current hue is equal to or greater than 255
- 'reset to 0
- If hueshift => 255 Then
- hueshift = 0
- 'If hue is not yet 255, keep adding
- Else
- hueshift = hueshift + 7
- End If
- ' Set the Object Hue
- For Each Item In DesktopX.GroupObjects("grpMyObjects")
- Item.states("").hue = hueshift
- 'or use this if you need change hue for current state only
- 'Item.hue = hueshift
- Next
- Set objects = nothing '<== clear memory
- End If
- End Function
Reply #5 Sunday, June 15, 2008 7:00 PM
Reply #6 Sunday, June 15, 2008 7:45 PM
This will work if all objects have the same sound.
- ' Declare Boolean Variable & Set
- Dim blnMute : blnMute = False
- ' Declare & Set Sound File
- Dim oSndFile : oSndFile = "C:\mysoundfile.wav"
- Function Object_OnLButtonUp(x, y, dragged)
- If Not dragged Then
- For Each Item In DesktopX.GroupObjects("grpMyObjects")
- If blnMute=False Then
- Ext=Right(oSndFile ,3)
- ' Verify correct extension
- If Ext="wav" Or Ext="WAV" Or Ext="mp3" Or Ext="MP3" Or Ext="Mp3" Then
- Item.Sound=oSndFile
- Else
- msgbox "Not a Valid Sound File"
- End If
- ElseIf blnMute=True Then
- Item.Sound=""
- End If
- Next
- End If
- End Function
Reply #7 Sunday, June 15, 2008 9:20 PM
This will work if all objects have the same sound.
4 different sets of sounds. Does this script go in the button to toggle the sounds? I assume that the C:\mysoundfile.wav needs to be changed to the name of the wav file?
Reply #8 Monday, June 16, 2008 12:00 AM
This should do the job.
- ' Declare Boolean
- Dim blnMute
- Function Object_OnLButtonUp(x, y, dragged)
- If Not dragged Then
- If blnMute=False Then
- ' Turn on Sounds
- blnMute=True
- DesktopX.Object("object1").Sound="C:\mysoundfile.wav"
- ' If you use custom files then you just need to enter the name
- DesktopX.Object("object2").Sound="mysoundfile.wav"
- ' Use this for a specific state sound
- DesktopX.Object("object3").States("Mouse down").Sound= "somesound.wav"
- DesktopX.Object("object4").Sound=
- ElseIf blnMute=True Then
- ' Disable Sounds
- blnMute=False
- DesktopX.Object("object1").Sound=""
- DesktopX.Object("object2").Sound=""
- ' Use this for a specific state sound
- DesktopX.Object("object3").States("Mouse down").Sound=""
- DesktopX.Object("object4").Sound=""
- End If
- End If
- End Function
Reply #9 Monday, June 16, 2008 3:49 PM
' Declare Boolean
Dim blnMute
Function Object_OnLButtonUp(x, y, dragged)
If Not dragged Then
If blnMute=False Then
' Turn on Sounds
blnMute=True
DesktopX.Object("object1").Sound="Windows Restore.wav"
' If you use custom files then you just need to enter the name
DesktopX.Object("object2").Sound="Windows Battery Low.wav"
' Use this for a specific state sound
DesktopX.Object("object3").States("Mouse down").Sound= "Windows Critical Stop.wav"
DesktopX.Object("object4").Sound="Windows Logon Sound.wav"
DesktopX.Object("object5").Sound="Windows Minimize.wav"
ElseIf blnMute=True Then
' Disable Sounds
blnMute=False
DesktopX.Object("object1").Sound=""
DesktopX.Object("object2").Sound=""
' Use this for a specific state sound
DesktopX.Object("object3").States("Mouse down").Sound=""
DesktopX.Object("object4").Sound=""
DesktopX.Object("object5").Sound=""
End If
End Function
Reply #10 Monday, June 16, 2008 4:14 PM
' If you use custom files then you just need to enter the name
DesktopX.Object("object2").Sound="Windows Battery Low.wav"
' Use this for a specific state sound
DesktopX.Object("object3").States("Mouse down").Sound= "Windows Critical Stop.wav"
DesktopX.Object("object4").Sound="Windows Logon Sound.wav"
DesktopX.Object("object5").Sound="Windows Minimize.wav"
Hmmm... I see that you tried to play 5 sounds simultaneously.

What the error message have you received?
Reply #11 Monday, June 16, 2008 9:14 PM
Error = Object required: 'DesktopX.Object(...)'
Line: 9
Code:
(not available)
Reply #12 Monday, June 16, 2008 9:15 PM
What the error message have you received?

Edit: PS you also didn't close off all the If Statements; so, add another "End If" on a line above the End Function
Reply #14 Monday, June 16, 2008 9:42 PM
Actually, if you just want to turn the object sounds on/off then object.volume might be better. Was looking and hoping for an object.mute namespace but, it's actually just object.volume=0
Reply #15 Monday, June 16, 2008 9:48 PM
The first set of buttons have the same parent object. The second set of buttons share a different parent object, etc.
Reply #16 Monday, June 16, 2008 9:58 PM
This should work
- ' Declare Boolean
- Dim blnMute
- Function Object_OnLButtonUp(x, y, dragged)
- If Not dragged Then
- If blnMute=False Then' Turn on Sounds
- blnMute=True
- DesktopX.Object("object1").Volume=100
- DesktopX.Object("object2").Volume=100
- DesktopX.Object("object3").Volume= 100
- DesktopX.Object("object4").Volume=100
- DesktopX.Object("object5").Volume=100
- ElseIf blnMute=True Then' Disable Sounds
- blnMute=False
- DesktopX.Object("object1").Volume=0
- DesktopX.Object("object2").Volume=0
- DesktopX.Object("object3").Volume=0
- DesktopX.Object("object4").Volume=0
- DesktopX.Object("object5").Volume=0
- End If
- End If
- End Function
Reply #17 Monday, June 16, 2008 10:07 PM
' Declare Boolean
Dim blnMute
Function Object_OnLButtonUp(x, y, dragged)
If Not dragged Then
If blnMute=False Then' Turn on Sounds
blnMute=True
DesktopX.Object("Windows Restore.wav").Volume=100
DesktopX.Object("Windows Battery Low.wav").Volume=100
DesktopX.Object("Windows Critical Stop.wav").Volume= 100
DesktopX.Object("Windows Logon Sound.wav").Volume=100
DesktopX.Object("Windows Minimize.wav").Volume=100
ElseIf blnMute=True Then' Disable Sounds
blnMute=False
DesktopX.Object("Windows Restore.wav").Volume=0
DesktopX.Object("Windows Battery Low.wav").Volume=0
DesktopX.Object("Windows Critical Stop.wav").Volume=0
DesktopX.Object("Windows Logon Sound.wav").Volume=0
DesktopX.Object("Windows Minimize.wav").Volume=0
End If
End If
End Function
Got this:
Object required: 'DesktopX.Object(...)'
Line: 7
Code:
(not available)

Reply #19 Monday, June 16, 2008 11:16 PM
You need to put the object names in the quotation marks not the sound files. You can just add those through the DesktopX Gui like you normally would.
Reply #20 Tuesday, June 17, 2008 12:32 AM
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!
Reply #1 Sunday, June 15, 2008 6:31 AM
Simply add any other elements like ObjectName3 before the last End If:
yeah i know when you have a theme it begins to be really crazy.