Auto changing color

Sunday, June 22, 2008 by superman | Discussion: DesktopX Tutorials

Here is script by Peterdudejm for scripting color

'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

What i want to auto change the color slowly... without clicking it.....
Thanks in advance
First Previous Page 1 of 2 Next Last
Bichur
Reply #1 Sunday, June 22, 2008 11:55 AM
you'll probably have to revise the script to include a timer instead of clicking
superman
Reply #2 Sunday, June 22, 2008 12:16 PM
C'mon i don't know it. This script is by Peterdudejm.
I never learnt vbscript.
So please revise it and post it. Thank you
Bichur
Reply #3 Sunday, June 22, 2008 1:09 PM
though for websites, these can get you started:

http://w3schools.com/vbscript/vbscript_intro.asp

http://w3schools.com/vbscript/vbscript_ref_functions.asp




have you considered just using an animation that changes colors?




I never learnt vbscript.
So please revise it and post it. Thank you


please, I can't even spell bvscritp
Wizard1956
Reply #4 Sunday, June 22, 2008 1:20 PM
This script is by Peterdudejm.


So please revise it and post it.


I don't know about that first guy you mentioned. You might want to PM a DX author. And isn't there a DX site?
SirSmiley
Reply #5 Sunday, June 22, 2008 1:28 PM
Code: vbscript
  1. Dim Speed,Duration
  2. Speed=100 ' This is the time in milliseconds between changing colors
  3. Duration=2000 ' This is the time in milliseconds before ending the automatic color changing
  4. 'Called when L-click is released
  5. Function Object_OnLButtonUp(x, y, dragged)
  6. If Not dragged Then
  7. Object.SetTimer 1, Speed
  8. Object.SetTimer 2, Duration
  9. End If
  10. End Function
  11. Sub Object_OnTimer1
  12. 'Store the current hue in variable
  13. hueshift = Object.hue
  14. 'If current hue is equal to or greater than 255
  15. 'reset to 0
  16. If hueshift => 255 Then
  17. hueshift = 0
  18. 'If hue is not yet 255, keep adding
  19. Else
  20. hueshift = hueshift + 7
  21. End If
  22. 'Set the object hue
  23. object.hue = hueshift
  24. End Sub
  25. Sub Object_OnTimer2
  26. Object.KillTimer 1
  27. Object.KillTimer 2
  28. ' Uncomment Next line if you want to reset color when done
  29. 'Object.hue=0
  30. End Sub
superman
Reply #6 Sunday, June 22, 2008 1:31 PM
So for one script i will have to learn whole book @ w3schools.
I don't even read my textbooks!
Ok, i won't ask bvscript to u.
I wonder!
Any great coder there!
Just revise that code dear!
And bring me my beer!
Bichur
Reply #7 Sunday, June 22, 2008 2:41 PM
Any great coder there!
Just revise that code dear!
And bring me my beer!


real world test:


put demands in one hand
crap in the other

slap your hands together and see which you get
ZubaZ
Reply #8 Sunday, June 22, 2008 7:11 PM
Learning is always better than just getting.
superman
Reply #9 Sunday, June 22, 2008 7:56 PM
Thank you SirSmiley
I praise you highly
For you are the real coder
My heart would ever aspire

Thanks for your boon
I'll check the code soon
And tell you if it works
And if my widget spurts
superman
Reply #10 Sunday, June 22, 2008 9:29 PM
Dim Speed,DurationSpeed=10........
.......................................................
Uncomment Next line if you want to reset color when done'Object.hue=0End Sub


It did work but i want to change the color automatically once it starts....
That is, i clicked the widget, it starts and keeps changing the color and changing and changing and....

What it did was, i ran it, then it need to be clicked to change the color once clicked it changed for few seconds.... i don't want this...

I want to change the color automatically since the widget starts till it runs....

Sorry but i don't know vbscript...

Thank you very much for the previous script and thank u very much for the next one......
ZubaZ
Reply #11 Sunday, June 22, 2008 9:33 PM
Roses are red
Violets are blue

Some poems are needed
but these aren't.

 
CarGuy1
Reply #12 Sunday, June 22, 2008 9:54 PM
please, I can't even spell bvscritp


put demands in one hand
crap in the other
slap your hands together and see which you get




superman
Reply #13 Sunday, June 22, 2008 9:55 PM
I tried to figure it out as to the limit i could do....

I changed 'Called when L-click is released with 'Called when the script is executed...
but no change in behaviour After running it needed to be clicked..

I changed timer to a very large digit but it gave an error. and option to disable script. once i disabled and edited...but no gain.
Again i continued the script, although it worked but then there was an error and my widget will become buggy.....

So please give me a script for automatic color changing from the time the objects runs/starts till it is stopped...

It will be really a great help for me. As for till now i use animations to change color etc.
If i get this, my widgets will become resource friendly.
SirSmiley
Reply #14 Sunday, June 22, 2008 10:09 PM
Yes, it will crash if you run the timer constantly, also your memory usage will skyrocket.

Timer's are meant to run for a specific period of time to complete a routine/function and then end.

Here ya go with a Left click function to enable/disable it.
Code: vbscript
  1. Dim Speed, blnActive
  2. Speed=1000 ' This is the time in milliseconds between changing colors
  3. blnActive=True ' Indicates to start color change on Script Enter
  4. 'Called when L-click is released
  5. Function Object_OnLButtonUp(x, y, dragged)
  6. If Not dragged Then
  7. If blnActive Then
  8. blnActive=False
  9. Object.KillTimer 1
  10. ElseIf Not blnActive Then
  11. blnActive=True
  12. Object.SetTimer 1, Speed
  13. End If
  14. End If
  15. End Function
  16. 'Called when the script is executed
  17. Sub Object_OnScriptEnter
  18. If blnActive Then Object.SetTimer 1, Speed
  19. End Sub
  20. Sub Object_OnTimer1
  21. 'Store the current hue in variable
  22. hueshift = Object.hue
  23. 'If current hue is equal to or greater than 255
  24. 'reset to 0
  25. If hueshift => 255 Then
  26. hueshift = 0
  27. 'If hue is not yet 255, keep adding
  28. Else
  29. hueshift = hueshift + 7
  30. End If
  31. 'Set the object hue
  32. object.hue = hueshift
  33. End Sub
  34. 'Called when the script is terminated
  35. Sub Object_OnScriptExit
  36. Object.KillTimer 1
  37. End Sub
superman
Reply #15 Sunday, June 22, 2008 10:45 PM
WoW!!!! It worked
Thank you SirSmiley
I praise you highly
For you are the real coder
My heart would ever aspire

Thanks for your boon
I'll check the code soon
And tell you if it works
And if my widget spurts

bilbo1930
Reply #16 Monday, June 23, 2008 2:29 AM
Great work SirSmiley
superman
Reply #17 Monday, June 23, 2008 4:25 AM
My Sweet SirSmiley Can i use these scripts in my widgets. I know you will say yes but a formal permission is required otherwise my submission may be rejected.
Thank you very much
SirSmiley
Reply #18 Monday, June 23, 2008 10:40 AM
Of course you/anyone can use this or any script that I post in the forums in your object, widgets, themes, or gadgets.
superman
Reply #19 Monday, June 23, 2008 11:49 AM
SirSmiley U R always great! Thank u
Snowman
Reply #20 Monday, June 23, 2008 12:24 PM

real world test:

put demands in one hand
crap in the other

slap your hands together and see which you get

Now there's a quote I'll be remembering and using whenever someone's being naggy and rude.   

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!



web-wc01