adding mute function when object is hidden
from
WinCustomize Forums
I'm trying to modify (for personal use) the script in ickypoo's Marvin widget to add a function where the sound is automatically muted when the widget is hidden. I think I know how to do this (I've been reading the DesktopX scripting tutorial), but what I'm doing is not working. Actually, I've tried several different paths to achieve this, including using ObjectOnStateChange calls to detect whether the object is hidden or shown. This is what the latest iteration of modification looks like:
Object.PersistStorage("soundNUM") = 1
'Called when the script is executed
Sub Object_OnScriptEnter
Object.SetTimer 99384, 25
Object.SetTimer 98994, 60000
End Sub
'Called when the script is terminated
Sub Object_OnTimer99384
Object.Left = Object.Left + 1
If Object.Left > System.ScreenWidth Then Object.Left = - Object.Width
End Sub
Sub Object_OnTimer98994
Object_OnMouseEnter()
Object_OnShow(IsVisible)
End Sub
Sub Object_OnShow(IsVisible)
If IsVisible = True Then
Object.Volume = 85
Else
Object.Volume = 0
End If
End Sub
Sub Object_OnMouseEnter
Object.ToolTipText = "Playing marvin" & Object.PersistStorage("soundNUM") & ".wav"
Object.Sound = "marvin" & Object.PersistStorage("soundNUM") & ".wav"
Object.PersistStorage("soundNUM") = Object.PersistStorage("soundNUM") + 1
If Object.PersistStorage("soundNUM") > 16 Then Object.PersistStorage("soundNUM") = 1
End Sub
Could someone here who's really clever with scripting give me a pointer or two? I've just started trying to tinker with this, and I may be overlooking something dumb. Thanks.
And I'm always ready to help them.
