How can I find the standard printer from CAL

BluefingerBluefinger Member Posts: 20
edited 2008-05-22 in NAV Tips & Tricks
Hi

I need to find the name of the standard printer. In the Printer system table I have a list of all installed printers but how do I know which one is standard?

many thanks in advance!!!!

Comments

  • garakgarak Member Posts: 3,263
    edited 2008-11-24
    The standard printer for a user is stored in the registry in Key
    "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device".

    So, with this little code, you can get back the default printer of the current user.
    Name DataType Subtype Length
    WshShell Automation 'Windows Script Host Object Model'.WshShell
    
    if isclear(WshShell) then
    create(WshShell);
    
    RegKey := 'HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device';
    
    Variantvariable := WshShell.RegRead(RegKey);
    
    clear(WshShell);
    
    message(format(Variantvariable));
    

    You can change the users default printer with following:
    rundll32 printui.dll,PrintUIEntry /y /n "Your Printer Name"
    

    Regards
    Do you make it right, it works too!
  • apertierraapertierra Member Posts: 61
    Check codeunit 1: FindPrinter
  • garakgarak Member Posts: 3,263
    do you mean the default printer of the user in windowssystem or in navision :?:

    Navision -> CU 1
    Windows -> WSH
    Do you make it right, it works too!
  • krikikriki Member, Moderator Posts: 9,094
    [Topic moved from Navision Attain forum to Navision Tips & Tricks forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.