Hello,
Let's say I have 2 printers under Windows 7 x64. I have 2 scripts to set each of the 2 printers as default and I pinned shortcuts to those 2 scripts to the taskbar. They work fast.
I've been meaning to add some dynamic icons for these shortcuts so that when I set a printer as default, its shortcut gets a colored icon and the other printer's shortcut gets b/w icon. Not many viable options to do this, but I found some code here on the forum and I adapted it to my situation. I made a .dll file with the 4 icons I need to use, because it seems that the code won't work with .ico.
I will post the code below, but first let me tell you which my problems are:
- the icon change in the folder where I have all files (the 2 .vbs, the 2 .lnk, icons.dll) happens in 15-20 seconds, which is a bit slow given the fact that the default printer change takes place in 1 second - this happens even if I refresh the folder (F5) repeatedly
- the icon change doesn't happen at all for the icons in taskbar (I made shortcuts correctly, with target: C:\Windows\System32\wscript.exe "E:\Printers\Bro.lnk")
It might be the code I use that is wrong and maybe you guys can help me make it better. Here it is:
Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "Brother DCP-T300"
WshNetwork.SetDefaultPrinter PrinterPath
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace("E:\Printers")
Set objFolderItem = objFolder.ParseName("Bro.lnk")
Set objShortcut = objFolderItem.GetLink
objShortcut.SetIconLocation "E:\Printers\icons.dll" ,0
objShortcut.Save
Set objFolderItem = objFolder.ParseName("Bul.lnk")
Set objShortcut = objFolderItem.GetLink
objShortcut.SetIconLocation "E:\Printers\icons.dll" ,3
objShortcut.Save
WScript.Quit 1
Please help me make this faster, or if not possible please at least tell me why.
About the taskbar thing, I can live without it since it works for desktop shortcuts.
Please don't say I'm too picky and that it takes 3 seconds to switch between printers via CPanel - I know.
I might as well be using 5 printers on a tight schedule and need to switch between them pretty fast without having always to right click and set as default printer.
Thank you in advance.