Please combine these two vbscripts..............

Hi my sweet uncles, aunties, brothers, sisters & friends.......

Please mention how to combine these two scripts............

One by Vad_M and second by SirSmiley....

1..Adjusting position of a desktopx object so that it remains at center for every resolution..
Link: https://forums.wincustomize.com/316412
Script:

X = cint((system.WorkareaRight - object.width)/2)
Y = cint((system.WorkareaBottom - object.height)/2)
object.move X,Y '<== this will move your object directly into the center of your screen


2..Auto changing hue or color......
Link: https://forums.wincustomize.com/315915
Script:

Dim Speed, blnActive
Speed=1000 ' This is the time in milliseconds between changing colors
blnActive=True ' Indicates to start color change on Script Enter

'Called when L-click is released
Function Object_OnLButtonUp(x, y, dragged)
If Not dragged Then
If blnActive Then
blnActive=False
Object.KillTimer 1
ElseIf Not blnActive Then
blnActive=True
Object.SetTimer 1, Speed
End If
End If
End Function

'Called when the script is executed
Sub Object_OnScriptEnter
If blnActive Then Object.SetTimer 1, Speed
End Sub



Sub Object_OnTimer1
'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 Sub

'Called when the script is terminated
Sub Object_OnScriptExit
Object.KillTimer 1
End Sub


Thank you very much ...I have no idea....Hope you have......Please help me.......
Thanks & +3 karma in advance................
Bye

(Thread moved by admin)

4,225 views 2 replies
Reply #1 Top
I' think this will work for you:

Dim Speed, blnActive
Speed=1000 ' This is the time in milliseconds between changing colors
blnActive=True ' Indicates to start color change on Script Enter

'Called when L-click is released
Function Object_OnLButtonUp(x, y, dragged)
If Not dragged Then
If blnActive Then
blnActive=False
Object.KillTimer 1
ElseIf Not blnActive Then
blnActive=True
Object.SetTimer 1, Speed
End If
End If
End Function

'Called when the script is executed
Sub Object_OnScriptEnter
If blnActive Then Object.SetTimer 1, Speed
X = cint((system.WorkareaRight - object.width)/2)
Y = cint((system.WorkareaBottom - object.height)/2)
object.move X,Y '<== this will move your object directly into the center of your screen
End Sub

Sub Object_OnTimer1
'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 Sub


..of course all credit to Vad and SirSmiley :)
+3 Loading…
Reply #2 Top
Thank you very much and you too deserve some credit.......at least for combining these
Thanks again....... :)