Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: yasminsept pe Simpatie.ro
| Femeie 24 ani Bucuresti cauta Barbat 26 - 54 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
Tevi: aia
When you're at work and you have access to 3-4 printers, and you print on all 3-4 daily, it's kind of annoying to always have to right click them or their shortcuts to select "Set as default printer", ain't it?
CLICK HERE ---> if you want the icons to change for active / inactive printers; there are a few more things you need to do. Credits go to Arthur from edugeek
Open notepad and paste the following code into notepad, then Save As - under "Save as type" instead of text document (*.txt) select All Files, then add the extension .vbs to the name you desire. Eg: PDFCreator.vbs
Set WshNetwork = WScript.CreateObject("WScript.Network") PrinterPath = "PDFCreator" WshNetwork.SetDefaultPrinter PrinterPath WScript.Quit 1 |
Replace PDFCreator with your printer name (from Devices and Printers). PDFCreator is a local printer, that's why the name is simple.
If you want to add a network shared printer, use the following code:
Set WshNetwork = WScript.CreateObject("WScript.Network") PrinterPath = "\\Server\CanonX3" WshNetwork.SetDefaultPrinter PrinterPath WScript.Quit 1 |
You can find full names (including server) of printers from Devices and Printers, go to start - run - regedit and navigate to the following key: HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices or HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers
Modificat de TRaP (acum 6 ani)
|
|
pus acum 6 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
To add them as shortcuts to the taskbar, you need to create their shortcuts (lnk files), then right click them and select properties. Under the Target filed, replace the link to the vbs file:
"C:\PDFCreator.vbs"
with
C:\Windows\System32\wscript.exe "C:\PDFCreator.vbs" or C:\Windows\System32\cscript.exe "C:\PDFCreator.vbs"
Then you can pin this shortcut to taskbar and run it with 1 click.
Otherwise, if you pin the unmodified shortcut, your vbs won't run on click.
After shortcuts are edited, you can change their icons if you want, to make them distinct. You can select one from C:\Windows\System32\shell32.dll or you can create your own icons with online creators. ---- make text writing icons, like: PDF ---- generate icon from an image
You can make icons manually on:
Modificat de TRaP (acum 6 ani)
|
|
pus acum 6 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
You can try using AutoHotkey to have the possibility of compiling your scripts to executable files: or
Modificat de TRaP (acum 6 ani)
|
|
pus acum 6 ani |
|
Mrrrr
AdMiN
Inregistrat: acum 17 ani
Postari: 2228
|
|
Another way:
Create new shortcut and as a link add:
rundll32.exe PRINTUI.DLL,PrintUIEntry /y /n "YourPrinterHere" |
_______________________________________
|
|
pus acum 6 ani |
|
Mrrrr
AdMiN
Inregistrat: acum 17 ani
Postari: 2228
|
|
If you want the icons to change for active / inactive printers, there are a few more things you need to do.
What do I mean by active / inactive is that when the BRO printer is set as default and the PDF printer is not, the BRO icon color is green and the other one is black:
and when I make the PDF printer as default, it changes the PDF icon to blue and the BRO icon to black:
This is very useful when you have 3-5 printers and want to know which one is active at any time.
1. Make a DLL file from all your icons.
I used a software called GConvert 5, which comes as TRiAL for 15 days. They say that after 15 days some features will become Pro only, but they don't say you won't be able to use the program. And maybe (I'll know for sure in 2 weeks) the ICL/DLL creation features will remain active.
Anyway, to make a DLL file, first of all you will have to make an Icon Library file (ICL) using the Library menu of GConvert. Then you can convert the ICL file to DLL using again the Library menu.
Now that you have your DLL with active and inactive icons, you have to jot down the order of your icons in the DLL file. You can see them in GConvert, for example:
AVIZ_active (green) is icons.dll ,0 AVIZ_inactive (b/w) is icons.dll ,1 HP_active (yellow) is icons.dll ,2 HP_inactive (b/w) is icons.dll ,3 PDF_active (red) is icons.dll ,4 PDF_inactive (b/w) is icons.dll ,5
Put the DLL file and the script (VBS) files into the same folder. In this example I've put them in E:\Printers and made a subfolder to put the shortcuts in: E:\Printers\Shortcuts
2. Make the scripts you need.
I modified the script from post #1 (because now it's more complex, it changes icons of shortcuts). I will post an example below, with explanations on what needs to be changed.
Copy and paste the following code into notepad, then save file as .vbs file:
Set WshNetwork = WScript.CreateObject("WScript.Network") PrinterPath = "Brother DCP-T300" WshNetwork.SetDefaultPrinter PrinterPath
Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.NameSpace("E:\Printers\Shortcuts") Set objFolderItem = objFolder.ParseName("BRO.lnk") Set objShortcut = objFolderItem.GetLink objShortcut.SetIconLocation "E:\Printers\icons.dll" ,0 objShortcut.Save
Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.NameSpace("E:\Printers\Shortcuts") Set objFolderItem = objFolder.ParseName("PDF.lnk") Set objShortcut = objFolderItem.GetLink objShortcut.SetIconLocation "E:\Printers\icons.dll" ,3 objShortcut.Save
Dim oShell Set oShell = CreateObject("WScript.Shell") oShell.Run "%WinDir%\System32\RUNDLL32.EXE user32.dll,"_ & "UpdatePerUserSystemParameters",1 ,true Set oShell = Nothing wscript.quit |
In red you have the name of the printer, exactly how it's taken from Control Panel - Devices and Printers. If your printer is on a network, check post #1 for details on how to find its full name. In blue you have the path to your shortcuts folder and the name of the shortcuts. In green you have the path to the DLL file and the corresponding index for the icon.
When BRO printer is set as default (lines 1-3), the BRO.lnk file will get icon with index 0 in the DLL file, which is the green / active icon (lines 5-10). If BRO printer is now default, we must change all the other shortcuts to b/w / inactive icons. Depending on how many printers you want to add, you will have to repeat lines 12-17 for every other printer that is not default. In this case I assigned icon index 3 to the PDF printer, which is the b/w icon.
The end part of the code (lines 19-24) is for refreshing the icons and making them change almost instantly. Otherwise it would take up to 20 seconds for the change to be made.
You will have to make one such VBS file for each of the printers, setting each as default, making the icon active (colored) and all the other printers' icons inactive (b/w).
3. Make shortcuts to the VBS files and put the shortcuts in a separate folder. Make sure the folder as well as the shortcuts' names are the ones you set in the VBS files.
Make sure the shortcuts have the target in this form: C:\Windows\System32\wscript.exe "E:\Printers\BRO.vbs"
4. Create a new toolbar on your taskbar and set it to show the contents of the folder where the printer shortcuts are.
Right click the taskbar, select Toolbars -> New toolbar. Navigate to the folder with printer shortcuts and select it.
Note: You can add all your pinned icons to this toolbar by copying their shortcuts from desktop or wherever to this folder and unpinning them from taskbar.
Here's how it works:
_______________________________________
|
|
pus acum 6 ani |
|
Mrrrr
AdMiN
Inregistrat: acum 17 ani
Postari: 2228
|
|
Might be needing this if you are on a newer version of Windows (8, 10).
Code for refreshing icon cache from Arthur (edugeek) in PowerShell language:
function Update-ExplorerIcon { [CmdletBinding()] param()
$code = @' private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff); private const int WM_SETTINGCHANGE = 0x1a; private const int SMTO_ABORTIFHUNG = 0x0002;
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)] static extern bool SendNotifyMessage(IntPtr hWnd, uint Msg, UIntPtr wParam, IntPtr lParam);
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)] private static extern IntPtr SendMessageTimeout ( IntPtr hWnd, int Msg, IntPtr wParam, string lParam, uint fuFlags, uint uTimeout, IntPtr lpdwResult ); [System.Runtime.InteropServices.DllImport("Shell32.dll")] private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
public static void Refresh() { SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero); SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, IntPtr.Zero, null, SMTO_ABORTIFHUNG, 100, IntPtr.Zero); } '@
Add-Type -MemberDefinition $code -Namespace MyWinAPI -Name Explorer [MyWinAPI.Explorer]::Refresh()
}
Update-ExplorerIcon |
_______________________________________
|
|
pus acum 6 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
IMPORTANT NOTE:
On Windows 9x, 2000, XP, Vista, it's best to put the shortcuts in the Quick Launch folder, and not create a new toolbar. When there was a sudden power loss, Windows removed the new toolbar from its list and reset the Quick Launch toolbar. It seems that by default on some system there is a registry setting preventing you to change the taskbar - it doesn't save your changes and after restart your toolbar is gone.
Windows 7 no longer has the Quick Launch toolbar, in 7 you "pin" icons to taskbar, so the problem is no longer there.
So just move the icons there, then modify the .vbs files accordingly.
Windows 9x: C:\Windows\Application Data\Microsoft\Internet Explorer\Quick Launch Windows 2000/XP/Vista: C:\Documents and Settings\Your Name Folder\Application Data\Microsoft\Internet Explorer\Quick Launch
Read more on how to backup your taskbar:
How to bring back Quick Launch in Windows 7, 8, 10:
Modificat de TRaP (acum 6 ani)
|
|
pus acum 6 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
You can convert ps1 files to exe with
|
|
pus acum 6 ani |
|
Mrrrr
AdMiN
Inregistrat: acum 17 ani
Postari: 2228
|
|
A new set of icons for 3 printers - Canon, HP and PDF virtual printer
Free software used to create that DLL file:
Pass: aia
_______________________________________
|
|
pus acum 6 ani |
|