Sign in to follow this  
Followers 0
tharris

Adding printers - RESOLVED

4 posts in this topic

#1 ·  Posted (edited)

Printer_Test.au3

I am working on a script to allow users to add printers to their machine. They are asked to provide the name, IP, and select the model from a drop down list and then choose add. I then take their input and fill in the script and add the printer. When I run the install I get an error that it was unable to find a suitable driver. I have used pieces of this code before when I had a specific printer to install for multiple users and it is able to install the drivers fine so the issue seems to be with collecting one of the variables and passing it on. Attached is the code I am using. Any help would be greatly appreciated.

Edited by tharris

Share this post


Link to post
Share on other sites



Wow no response. I've never had that happen.

I know I know I probably won't get anything now though.

Share this post


Link to post
Share on other sites

Wow no response. I've never had that happen.

I know I know I probably won't get anything now though.

You mean in all of your 6 posts, you've NEVER gone unanswered for more than 8 hours? muttley

(Just giving you a hard time)

Anyway,

$Model is a handle to the Combo control, so your StringInStr tests will never be true.

Also, that code is run before the message loop starts.

What you need to do is to ditch the If/ElseIf nightmare and modify this section:

Case $nMsg = $Add
        ;; Read Values from GUI
        Switch GUICtrlRead($Model)
            Case "HP Laserjet 4250 PCL 6"
                $PrinterDriver = $4250Driver
            Case "HP Laserjet 4350 PCL6"
                $PrinterDriver = $4250Driver
                ;; Fill in the rest
        EndSwitch
        ;; Continue with what you already have...
        
        ;;Stop Print Spooler Service
        RunWait('cmd /c net stop "print spooler"')
        ;;Adding specified printer
        ...

You'll need to GUICtrlRead($IPAddress) as well.

Also, I recommend that you write to CurrentControlSet instead of ControlSet001. Many laptops and some desktops use alternate hardware profiles.

Welcome to the forums, and good luck!


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

I didn't necessarily mean just my post alone. I don't post often but do review the boards quite a bit. Generally speaking I can find what I need. Most likely not the exact script but by pulling bits and pieces from other scripts. Thanks for your assistance. That is what I needed. The script is not fully functional yet but it does appear to be gathering the correct information which it was not doing earlier.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0