Auto changing color

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
79,763 views 23 replies
Reply #1 Top
you'll probably have to revise the script to include a timer instead of clicking
+1 Loading…
Reply #2 Top
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
Reply #3 Top
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
+1 Loading…
Reply #4 Top
This script is by Peterdudejm.


So please revise it and post it.


I don't know about that first guy you mentioned. :LOL: You might want to PM a DX author. ;) And isn't there a DX site?
Reply #5 Top
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
+2 Loading…
Reply #6 Top
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!
+1 Loading…
Reply #7 Top
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
+1 Loading…
Reply #8 Top
Learning is always better than just getting.
Reply #9 Top
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
Reply #10 Top
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...... :)
Reply #11 Top
Roses are red
Violets are blue

Some poems are needed
but these aren't.

 ;p
Reply #12 Top
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


:LOL: :LOL: :LOL: :LOL:

Reply #13 Top
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. :CONGRAT: :) :D :CONGRAT:
Reply #14 Top
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
+2 Loading…
Reply #15 Top
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

:CONGRAT: :) :D
+1 Loading…
Reply #16 Top
Great work SirSmiley :CONGRAT:
Reply #17 Top
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
Reply #18 Top
Of course you/anyone can use this or any script that I post in the forums in your object, widgets, themes, or gadgets.
Reply #20 Top

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.  :CONGRAT: 

Reply #21 Top
If u don't know something u can ask.
After all, forum are community meant for help with ideas, disscussions etc. I needed to ask because to learn vbscript i'll have to abandon my management books..
If i were a computer student, i won't have asked...
...and that might be the case with most who ask, won't u help them then?
Reply #22 Top
If u don't know something u can ask.
After all, forum are community meant for help with ideas, disscussions etc. I needed to ask because to learn vbscript i'll have to abandon my management books..
If i were a computer student, i won't have asked...
...and that might be the case with most who ask, won't u help them then?


well sure... but...

these:


What i want to auto change the color slowly... without clicking it.....


[quote]So please revise it and post it. Thank you[/quote

and thank u very much for the next one......


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



don't really fit the 'polite request for help' category.

I have an 8 yr old that makes veiled demands, but she's better at it.
Reply #23 Top
Thanx i'll keep that in my mind...and sorry if my request was not polite...but my heart was true ...and our cultures are different... Anyways thanx again dear friend...
+1 Loading…