Welcome Guest.   Make a donation to an author on the site September 21, 2014, 03:14:04 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Read the full one-year retrospective report on DonationCoder.com.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA: set default printer according to ip address  (Read 4355 times)
techidave
Supporting Member
**
Posts: 960


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: April 11, 2009, 04:59:42 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
Logged
skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: April 11, 2009, 07:55:54 PM »

 smiley Try NetSetMan from www.netsetman.com

Skrommel
Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
techidave
Supporting Member
**
Posts: 960


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: April 11, 2009, 08:06:50 PM »

It has a bit more setup than I would like to see but I will give it a whirl. 
Logged
techidave
Supporting Member
**
Posts: 960


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: April 16, 2009, 05:53:58 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
Logged
techidave
Supporting Member
**
Posts: 960


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: April 21, 2009, 08:59:35 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.
Logged
steeladept
Supporting Member
**
Posts: 1,056



Fettucini alfredo is macaroni & cheese for adults

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #5 on: April 23, 2009, 02:56:54 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  Grin huh
Logged
rjbull
Charter Member
***
Posts: 2,758

View Profile Give some DonationCredits to this forum member
« Reply #6 on: April 23, 2009, 03:48:22 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).

Quote
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.
Logged
wr975
Charter Member
***
Posts: 369



View Profile Give some DonationCredits to this forum member
« Reply #7 on: April 23, 2009, 06:51:31 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.com/.../overview/printuidll.mspx

[copy or print]

#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
Logged
techidave
Supporting Member
**
Posts: 960


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: April 23, 2009, 07:32:26 AM »

I did find this printer switcher but it is no longer under development and only allows for 2 printers.

http://abednarz.net/wp/beds-printer-switcher/
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.04s | Server load: 0.28 ]