DX Hidden Object - How To
from
WinCustomize Forums
I have a desktop where I have created a hidden printer object. Upon a registry hit (like the printer is printing a file) I want the printer object to show up on the desktop. I have created the VB Script to find the registry entry and just note that the printer has gone online and is printing. But this little script pegs the system usage. Any ideas on how to make it run in the background with little to no overhead or hook the system tray when the printer icon shows up there or to just run with VERY little overhead? Any help would be greatly appreciated.
Option Explicit
Dim ScriptShell, FileSysObj
Set ScriptShell = CreateObject("Wscript.Shell")
Set FileSysObj = CreateObject("Scripting.FileSystemObject")
Sub Object_OnStateChange(State)
If State = "Mouse Away") Then
Object.SetTimer 10,5000
End If
End Sub
Sub Object_OnTimer10
Dim PrinterOnline
PrinterOnline = ScriptShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Hardware Profiles\0001\System\CurrentControlSet\Control\Print\Printers\Epson\PrinterOnline")
If PrinterOnline = 1 Then
Msgbox ("Printer Is ON line!")
End If
If PrinterOnline = 0 Then
Msgbox ("Printer Is Now OFF line!")
End If
End Sub
Option Explicit
Dim ScriptShell, FileSysObj
Set ScriptShell = CreateObject("Wscript.Shell")
Set FileSysObj = CreateObject("Scripting.FileSystemObject")
Sub Object_OnStateChange(State)
If State = "Mouse Away") Then
Object.SetTimer 10,5000
End If
End Sub
Sub Object_OnTimer10
Dim PrinterOnline
PrinterOnline = ScriptShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Hardware Profiles\0001\System\CurrentControlSet\Control\Print\Printers\Epson\PrinterOnline")
If PrinterOnline = 1 Then
Msgbox ("Printer Is ON line!")
End If
If PrinterOnline = 0 Then
Msgbox ("Printer Is Now OFF line!")
End If
End Sub
