topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 11, 2024, 9:46 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: set default printer according to ip address  (Read 11102 times)

techidave

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,045
    • View Profile
    • Donate to Member
IDEA: set default printer according to ip address
« on: April 11, 2009, 04:59 PM »
Is it possible to code a program that will set the default printer according to the IP address regardless of which NIC is being used?

For example:
at location 1, the computer ip address is 10.1.1.x and it connects to a networkable printer via the lan.

at location 2, the computer ip address is 10.2.1.x and it connects to a local printer via the lan.

at location 3, the computer ip address is 10.3.1.x and it connects to a networkable printer via the lan.

at location 4, the computer ip address is 192.168.1.x and it connects to a networkable printer via the wireless.

I have googled this and didn't find anything that just did printers only and nothing else.  Plus most of them had a tray icon that need clicked on to change it.  I would rather not have to do that.

Something simple and easy would be great!

Thanks in advanced,
Dave

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: set default printer according to ip address
« Reply #1 on: April 11, 2009, 07:55 PM »
 :) Try NetSetMan from www.netsetman.com

Skrommel

techidave

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,045
    • View Profile
    • Donate to Member
Re: IDEA: set default printer according to ip address
« Reply #2 on: April 11, 2009, 08:06 PM »
It has a bit more setup than I would like to see but I will give it a whirl. 

techidave

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,045
    • View Profile
    • Donate to Member
Re: IDEA: set default printer according to ip address
« Reply #3 on: April 16, 2009, 05:53 AM »
It appears that anytime you try to hook up to another LAN or WLAN, you have to go through the setup with Netsetman before you can connect.  Not exactly what I was looking for.  For me it wasn't a big problem but for some of my other users who are technology challenged, it can be HUGE!

Or maybe there is something within the netsetman program that I am not aware of that will take care of this??

Dave

techidave

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,045
    • View Profile
    • Donate to Member
Re: IDEA: set default printer according to ip address
« Reply #4 on: April 21, 2009, 08:59 PM »
I have been giving NetSetMan a whirl for a little bit.  it is working fine except... it doesn't automatically change profiles when the IP changes.  At least not by putting the laptop into sleep mode.  I haven't tried it by powering off and then turning back on again.

I was looking something would automatically change when it was on  a different network.  Yes some of my teachers don't do well change.  but I guess clicking on an icon in the tray and then changing to a different network shouldn't be too difficult.

I will have to see what powering off and on does to automatic changes as compare to just shutting the lid.

steeladept

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,061
    • View Profile
    • Donate to Member
Re: IDEA: set default printer according to ip address
« Reply #5 on: April 23, 2009, 02:56 AM »
Instead of powering off, try just logging off then back in. That should provide the equivalent I believe.  Perhaps it would be possible to just add a manual rescan button to go through those steps for you?  I am assuming, of course, that this is not a new location, but an old one you are going back to.  Just a thought.  I really ought to give this a try before I continue to comment  ;D :huh:

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,205
    • View Profile
    • Donate to Member
Re: IDEA: set default printer according to ip address
« Reply #6 on: April 23, 2009, 03:48 AM »
Not sure it helps the OP much...  but there's a program called SDP = Select Default Printer by Edward Brophy, available here (the author's page seems to have disappeared).

What is it?

  SDP is a command line utility for setting which printer/output-device
  is to be used by default under Windows 95, 98 and NT.  It will not run
  under Windows 3.1.

Why did I make it?

  I had to make print outs every morning automatically using task scheduling
  software using NotePad & WordPad using the little know /p command line
  option.  (aside:  NotepPad /p SDP.TXT automatically loads, prints, and
  closes this doc.)  However, if someone sent a fax or something the previous
  day, the print outs would go to the fax instead of the printer.  I needed
  A utility that would make the printer the default output every morning. 
  I created SDP and I set my scheduling software to run it before the morning
  print outs and... guess what?  No more problems.

How do you use it?

  The basic usage is:  SDP.EXE <printer description>
 
  Just type in all or part of the printer's name and/or port and SDP will
  select the first device that it matches.  The printer description is
  CASE SENSITIVE!  Epson is not the same as EPSON to SDP.  You should run
  SDP without parameters to see the case used.  Also do no use quotes or
  chevrons (< >) on the command line, just what it asks for. 

  Example:  SDP.EXE Okidata

  Running SDP without parameters gives you the help screen that shows which
  printers are installed (i.e. selectable) and their complete, case sensitive
  description.  It displays the printer's name and port separated by a comma.
  You can enter this entire description as shown or any part of it.  If
  the printer description was:  HP LaserJet 4P,\\network\hp you could
  enter:  SDP.EXE 4P,\\net and SDP would find it.
 
  SDP can be run from a DOS window, a DOS batch file, the Run command on the
  Start Menu or you can create a shortcut with the <printer description>
  after the program's name.  From a DOS batch file, it's a good idea to use
  the START command with the /w wait option.

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Re: IDEA: set default printer according to ip address
« Reply #7 on: April 23, 2009, 06:51 AM »
Here is a very, very, very basic Autohotkey script. It checks every ten seconds for the current ip and changes the default printer. If it's more like the solution you're looking for, feel free to enhance it!

Documentation about printui.dll can be found here: http://www.microsoft...view/printuidll.mspx


#NoEnv
#persistent
#SingleInstance force
;#NoTrayIcon

SetTimer,Check,10000
Gosub,Check
return

Check:
if A_IPAddress1 = %OldIP%
Return

If A_IPAddress1 = 192.168.1.238
run,rundll32 printui.dll`,PrintUIEntry /y /n\\PCNV\PDFCreator

If A_IPAddress1 = 192.168.1.2
run,rundll32 printui.dll`,PrintUIEntry /y /n\\Machine2\Printer2

If A_IPAddress1 = 192.168.1.3
run,rundll32 printui.dll`,PrintUIEntry /y /n\\Machine3\Printer3

If A_IPAddress1 = 192.168.1.4
run,rundll32 printui.dll`,PrintUIEntry /y /n\\Machine4\Printer4

TrayTip,Default printer changed

OldIP := A_IPAddress1

Return

techidave

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,045
    • View Profile
    • Donate to Member
Re: IDEA: set default printer according to ip address
« Reply #8 on: April 23, 2009, 07:32 AM »
I did find this printer switcher but it is no longer under development and only allows for 2 printers.

http://abednarz.net/...ds-printer-switcher/