VBA Use Printer via unique identifier - ms-access

I am programming an Access form which needs to print. Since I am not developing the form on the same computer as the computer it will be used on, I can't be sure the printers name will be the same and if it will be the standard printer. My first attempt was to list all printers using Application.Printers.
The problem is that I can't find a pattern in the devices name or anything to identify the right printer. Is there any smart attempt on this, using for example the MAC adress or the IP of the printer?

Non-networked printers don't have unique identifiers. The combination printer name + computer name should be unique, though.
For networked printers, you can try using the .Port property to identify a certain printer. However, this property is configurable, and is a string.
If you want to get the IP address of a certain printer, you will have to use the EnumPorts function (MSDN) to get the available ports and their associated IP addresses. Since that's a C++ function, that's not very easy. Then, using the .Port property, you can identify which printer is using that port.

Related

NetSuite SuiteScript 2.0 Integration with external hook

I need to setup EPL2 label printing from Netsuite. Unfortunately the company this is for is very small and they don't have much money to spend, hence they cannot buy a $1000 label printing solution.
The current system uses a linux server that then sends a file to one of the CUPS print server queues using the linux cat command. From there it goes to a Intel NetportExpress 10/100 Print Server and then to the Argox V1000+ label printer. This is via a corporate network ip address.
Instead I started looking at some cheap options:
Popup a browser window with content type text/plain and use a suitelet to populate that browser window with the EPL2 label printer codes. Then open a print dialog window so that the user can print to the label printer driver. This requires installation of the label printer driver for all users. Sadly I could not get this to print a label.
Integration from Netsuite via a Restlet to an external python application (on Linux) that can then perform the linux cat command needed to print the label. The Restlet works nice, but unfortunately there does not seem to be a way to have some sort of hook that fires when a new label custom record arrives. Therefore I have to keep on polling the Restlet from Python every 2 seconds to see if a new label is waiting to be printed. I started running this about an hour ago and so far I have made about 2500 requests without errors. My concurrency limit is 5 and I'm using 2 so that seems ok. The script does very little so I don't think there will be size limit issues. The problem is just that I wonder whether NetSuite will eventually terminate my script for doing so many requests. Not sure whether there is such a governance issue, but can't imagine that they won't eventually stop that sort of thing.
Use the http module to send data in an ajax type manner. This should be able to pickup when new data arrives instead of having to poll (not sure). The problem with this is that I assume I will need a static IP address which is sadly an expensive option.
Use Netsuite SOAP web services which might have a hook instead of polling (not sure). I think this would not be free (like Restlets) either.
So my question is whether there is a better option that I'm missing or what would you recommend. Also would I hit some sort of governance limit if I poll every 2 seconds with option 2?
Update: The polling mysteriously stopped working after 7395 requests and about 3 hours. It did not return an error that I'm aware of. The rejected requests on Integration Governance shows 0.
I used to do the emailing thing quite a bit and it works pretty well. Volume may be an issue.
Another thing to do is just get a static IP address with something like ngrok.
ngrok runs on linux/mac/windows so you'd be able to write an app that listens on a particular port. Netsuite would send an https post to that app at (for instance) https://printing.mycompany.ngrok.io and the app would handle local printing.
I believe ngrok runs about $US60/year.
the app can verify identity with some sort of timestamp and hash so that if someone does get the https address they couldn't easily use all your paper or cause a DoS situation.
We got bamboozled by a printer vender (Zebra) before we found out that we could HTTP post to most printers using PRINTER_IP:9100 and just sending the RAW ZPL/EPL as the body.
Look into: IPP enabled printers. most are these days. saves you 1000's in longrun if you have a large warehouse operation like we do
Instead of polling I would have NetSuite initiate the connection in an afterSubmit User Event script.
I've automated label printing by having NetSuite email attachments to a dedicated mail box which is monitored by a Linux server. My setup is documented here:
https://gist.github.com/michoelchaikin/80af08856144d340b335d69aa383dbe7

html scan image from scanner on a web page and save the image to local folder or back to page

Printer type hp officejet pro 6830
Is there a way to scan from html/java script image from a scanner ?
If it cant be done can anyone recommend a lib for java that give access to the printer/scanner.
The over all idea is to add a button to web page and scan image back to the page or to a local folder
I already tried using Scanner.js: HTML/JavaScript Web Twain WIA
but it didnt work for me not sure why?
thanks
This can kinda be done.
Before starting I must specify that I'm trying this on my HP PhotoSmart network printer, but it should apply to yours as well.
If from your browser you surf to your printer IP address (I suppose you're using it as a network printer, ie. http://192.168.1.79), you should find a couple of options and the ability to scan documents from the web browser itself (you might have to enable this function first from the settings).
It works and you could spend hours reverse-engineering that things. Luckly, it seems someone has already done that: hp-webscan and it's only ~60 lines so it's easy to convert to another environment/language.
Otherwise HP printers should expose a CUPS (IPP) / SANE interface and you could use that.
SANE (Scanner Access Now Easy) is a set of API to communicate with scanners across a network. I gave you the link to the Wikipedia page describing the technology. Here's an example of binding for Node: node-sane.
Python Flask service, which can be called from javascript to start scanner, and get the scanned image as pdf. This python code will allow you to use image scanner from a web page. An example for a web page "client_page.html".
You can edit the code so it will return an image :
https://github.com/KHBillel/ImageScanner4Web

Why is it preferable to use a host name (domain) rather than an IP address in a URL?

I have just started to teach myself how to use Javascript HTML etc.
Why is it preferable to use a host name (domain) rather than an IP address in a URL?
If an IP address points to a vhost, there are sometimes occasions where the one server (with one public-facing IP address) is listening for requests on port 80 for several different websites (different host headers), presenting a different website depending on what URL the user typed.
A nice eloquent and more in depth answer is here.
It also gives you a much easier transition path should you need to move your application/website to a different host. i.e., you can build your new website on an entirely different host, test it either by IP address or altering a hosts file, and then, once you're satisfied, simply switch the DNS entry to point to your new host.

How can I send a paper cut command using my web app?

I have a web app that prints out several receipts. I need to cut every consecutive receipt that follows. Is there a way somehow to embed the paper cut command in my HTML template?
Like a <br>
Thanks.
UPDATE : ESC/POS Commands to cut paper
SUGGESTED SOLUTIONS :
Convert a byte array (printer commands) to string and send it with the window.open(urlString).
After some research i found the jZebra applet. This will work for me! I can now
send printer commands from browser to physical thermal printer on network address.
http://code.google.com/p/jzebra/
After some research i found the jZebra applet. This will work for me! I can now send printer commands from browser to physical thermal printer on network address. http://code.google.com/p/jzebra/

How to mark-up telephone numbers on Intranet for Mitel Unified Communicator Advanced

I am using Mitel Unified Communicator Advanced 2.0 with the Mitel.DialBHO plugin for Internet Explorer. The plugin tries to detect numbers in web pages that are formatted like phone numbers and then overlays a click-to-dial hyperlink.
My question is, how would I go about marking up the phone directory on our intranet to explicitly tell the plugin that something is a phone number? We have three digit extention numbers that we use internally and the plugin won't auto-detect these as dialable numbers.
I have tried the usual markup of ext 555 and ext 555, but neither of these have the desired effect. callto tries to launch NetMeeting and tel doesn't have a registered program and IE displays an error to this effect.
TL;DR:
How do you make a hyperlink (or any other tag with a special attribute) tell Mitel UC Advanced to dial a number when clicked?
Bonus question
It strikes me that the Stack Exchange may have a better place to ask this question. Any idea which one would be best?
UPDATE
So I have found the format I need to use it {number}, but it won't accept 3 digit numbers. Unified Communicator will open, but says that it received an "Invalid Command".
Sending it a fully formed phone number works, but if I convert our internet three digit number to the equivelent external number, it uses an outside line instead of routing it internally.
Any way of sending it a three digit number?
If you want to dial an internal number from Mitel Unified Communicator, the format is as follows (where 555 is your desired extention number).
Click here to dial me!