|
Other OS Any other OS such as Microsoft Windows, BeOS, Plan9, Syllable, and whatnot. |
|
Thread Tools | Display Modes |
|
|||
Windows scripts can't print
I've spent over a week on 7 different forums, including Microsoft's own VBScript forum, trying to find someone who can help me write a simple script that downloads a page from a specific URL and automatically print it on a secondary printer (not the default). After all that, I found out vbscript can only print on the default. I might be able to change the default, then print, but that would conflict with other software.
Someone wrote one for me (I don't know vbscript) but it only prints on the default. I'd bet I can get this to work on fbsd with 10 lines or so of bash but I'm being told to get a Windows box, download the .NET platform, learn it all, then write my own. Those who are more helpful give me pointers on where to look in the docs but it either doesn't do what I want or is far more involved than I care for. If someone here knows of a simpler way to do this, I'd appreciate it, but <rant> For all the hype of .NET and Windows tools, and how many people act like they know so much about all that and how wonderful it all is....well....you know how I feel. </rant> |
|
||||
Can't you use another programming language, for example, I found this promising looking results on google for python:
http://newcenturycomputers.net/proje...sprinting.html I haven't tried it, I have I time I can try it at work tomorrow.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
|
|||
I would but then I'd have to install Python, or some other language. The idea behind this project is to have minimum messing with the computer. I am positive I won't be allowed to do more than put some script or executable on this WindowsXP box. It's a cash register for a franchised operation and they get very touchy.
|
|
|||
Cannot you just do a copy myfile LPT2?
With Borland Delphi for Win95 you could use a TPrintDialog component so the user could select an alternate printer. Delphi generated quite small executables IIRC Could Java be an option?
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
User shall not select anything. This all happens in the background. Will you give me Delphi for free and teach me how to use it?
|
|
|||
Although it is Delphi Professional, it only works on Win95. It is a no-go on Win98 and up
I cannot teach you, didn't use it for more then 8 years See http://en.wikipedia.org/wiki/Borland_Delphi and http://en.wikipedia.org/wiki/CodeGear http://cc.codegear.com/free/delphi has Delphi Explorer editions which are free for download.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
I'd try it but for now I've moved on. They have fax machines in all their locations so I'll just fax it to them till it becomes worthwhile to pay some Windows guy to code it for me.
It's a sad state of affairs I'd have to pay someone to write code that takes 10 lines or so of bash. |
|
||||
Quote:
How about something much simpler than vbscript. A batch file. You will need wget - Microsoft of course does not provide such useful utilities. path.to\wget -O path.to\filename URI print /d:device path.to\filename For instance this works for me: wget -O filename http://www.daemonforums.org/index.php type filename I have not used path.to as I am running the batch file from the same directory (folder) as wget. :] I also don't have a printer so I am using "type" to output to the screen. /d:device works on local or network printers: Specifies the name of the print device. Valid values for parallel ports are LPT1, LPT2, and LPT3. Valid values for serial ports are COM1, COM2, COM3, and COM4. You can also specify a network printer by its sharename (\\servername\print_share). The default value is PRN. The values PRN and LPT1 refer to the same parallel port. Using wget is probably quite easy for you (I am new to it) and also very configurable. This is a very simple batch file. If you need anything more (logfiles, filenames based on URI, filenames based on timestamps, etcetera) let me know. Believe it or not, the CLI in windows does a lot of stuff similar to sh. Best wishes. |
|
|||
I'm not allowed to download and install anything like wget on these Windows boxes. However I might like to try what you have and see if it does what I want. Will the print part of your code try and print anything if there is nothing fetched by wget? I don't recall if wget just creates a file of zero length when it saves it.
Right now I use wget on my fbsd box for this. It fetches the page and faxes it. In something less than 20 lines of bash. |
|
||||
Quote:
I suspect (I don't print on Windows much) that it will try to print this. In fact I am sure of it. Perhaps the biggest limitation of the Windows CLI is it is not complex enough to manipulate output streams in more than one way at a time. For instance, to check the output of a tracert (traceroute) for a string is trivial. To also redirect that stream to a file is not. Of course the solution in that case is to redirect the stream to a file first and then look for the string in the file. :] In the case of wget it does not write error messages (e.g. "404 Not Found") to the file. As I said, I am new to wget and the documentation is ... well ... I will have a better look later. Still, the cheap and dirty solution is to let wget run and then test the file. :] Code:
wget -O filename http://www.nowhere.net/nothing.html findstr ".*" filename && goto COOL type error_message && exit :COOL type filename && exit In this case there is a ready to go error_message file. findstr ".*" - look for any character repeated any number of times. Something nicer would be to store the URI as a variable and to append/prepend it as a footer/header on the error_message. Simple to do. Keep me updated. I like writing batch files. Best wishes. |
|
||||
Quote:
Best wishes. EDIT: If the file is available via ftp this simplifies things further. An ftp client is included on every Windows I know of. And it works pretty much like *nix ftp. Even using *nix commands ("ls" instead of "dir" for example). Last edited by diw; 30th March 2009 at 03:31 AM. Reason: Added ftp note. |
|
||||
the only big difference is Windows ftp client lacks the filename completion and better ascii/binary awareness of BSDs.
It's also possible to feed the ftp client a script with the -s:filename switch - basically like the I/O redirection of a unix shell would allow.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
The printer and the Windows box are standalone and do not have static IPs. The problems mentioned above about the shell in Windows also apply to VBScript. Also, are there any problems printing to the secondary printer when a job is running, or sent, to the primary printer?
|
|
||||
Quote:
Quote:
Post your bash script so I know where you are at. Apologies for not reading one of your earlier posts where you specifically say you can't install wget or other on these boxes. Of course with a moving target (dynamic - more importantly not shared) this makes it hard to wget from your end and shovel the file on to them. I suppose since you didn't say "yes ftp, ftp" that the file is not available via ftp. A batch file for http will require either: Installing wget on the client. Home and hosed. Without installing wget on the client - either they need to be accessible to you (you push the file you wgot to their printer) or you need to be accessible to them (they retrieve the file you wgot from you). Let me read between the lines. They are grabbing a file from your company? Put it on ftp. They already have ftp (part of windows), you have a domain - ipso facto - they can access your file over the internet already via a batch file. They can print locally to any printer they like via a batch file. I am happy, you are happy, everyone gets rich. Post the bash script. Best wishes. Last edited by diw; 31st March 2009 at 09:04 AM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can't load any scripts in ircII | guitarscn | General software and network | 4 | 22nd November 2010 12:06 AM |
Periodic scripts for mail scripts | stukov | FreeBSD General | 2 | 8th March 2009 07:51 PM |
Can't Print (Fresh First Time install) BSD newb | Xero | FreeBSD Installation and Upgrading | 4 | 15th February 2009 07:11 PM |
Print on remote WinXP from web host | drhowarddrfine | General software and network | 5 | 13th October 2008 05:41 PM |
FBSD emulating pdc w/ AD, exchange and print server? | cgc2 | FreeBSD General | 9 | 16th July 2008 04:14 PM |