Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2005
    Posts
    14

    Detect installed printer?

    Can I / how can I detect whether a particular printer has been installed? I know the exact name of the printer.

    Any help would be greatly appreciated - thanks.

  2. #2
    Join Date
    Nov 2005
    Posts
    98
    I don't know if it will work on non-NT system but I think that you can try this:

    result = Registry.GetKeyNames(HKEY_LOCAL_MACHINE, "\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers");
    result = Dialog.Message("Notice", result[1], MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

    It will enumerate all printers on your computer (my example only show the first)

    Eliminator

  3. #3
    Join Date
    May 2000
    Location
    Indigo Rose Software
    Posts
    2,150
    Good one Eliminator.

    We do not have a direct action to do this. I'll bet that there is a key somewhere on non NT machines in the registry.

    Adam.

  4. #4
    Join Date
    Sep 2005
    Posts
    14
    Thanks for your help.

    In XP and 2000, the registry location is different:

    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\Current Version\Devices

    We decided to instead go with a script that uses the Windows FileOpen function. See http://msdn2.microsoft.com/en-us/library/ms536027.aspx

  5. #5
    Join Date
    Nov 2005
    Posts
    98
    Sorry, I didn't check on other but you can use a System.GetOSName and for each os use a different key.

    Sorry for my mistake
    Eliminator

  6. #6
    Join Date
    Mar 2009
    Location
    -31.9554,115.85859
    Posts
    282

    Huh?

    How would I handle the error if no printer is installed?

    Getting quite frustrated, can I even suppress the error?

    Any help please... All i need to do is detect whether or not a printer is installed, but I get "a nil value" if no printer is found.

  7. #7
    Join Date
    Nov 2008
    Posts
    39
    FOR NT

    Code:
    result = Registry.GetKeyNames(HKEY_LOCAL_MACHINE, "\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers");
    if result == "" then
    ~SETUP YOUR ACTION FOR NO PRINTER HERE
    else
    ~SETUP YOUR ACTION FOR YES PRINTER HERE
    end
    FOR NON NT

    Code:
    result = Registry.GetKeyNames(HKEY_CURRENT_USER "\Software\Microsoft\Windows NT\Current Version\Devices\\Printers");
    if result == "" then
    ~SETUP YOUR ACTION FOR NO PRINTER HERE
    else
    ~SETUP YOUR ACTION FOR YES PRINTER HERE
    end

    or something similar

Similar Threads

  1. Acrobat.det does not detect that Acrobat is not installed
    By mlupo in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 07-22-2005, 06:51 AM
  2. Detect if a application is installed
    By digitalsr2 in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 05-20-2005, 07:55 AM
  3. Determining what Version of Internet Explorer is Installed
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 10-03-2003, 10:59 AM
  4. HOWTO: Detect Acrobat Version
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-22-2002, 04:01 PM
  5. Detect Other Installed Softwares
    By Bubbancs in forum Setup Factory 6.0
    Replies: 1
    Last Post: 01-10-2002, 10:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts