Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PORTPROMPT: 2

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
When I list the printers on the network, I get all the usual suspects and something names PORTPROMPT: - could anyone give me the heads up on what that is?
I suspect it is something to do with USB but I need the actual name of the printer.

Keith
 
Never seen before.

That's one of the items APRINTERS gives you? OR are you using ANETRESOURCES? Or what are you using at all?

Bye, Olaf.
 
I did Google 'portprompt' but it didn't show any of the threads it now shows - not sure what happened there but thanks for the heads up.

It only shows on my pesky WIN8 machine, which seeing as it is designed to work with those APP things, is not surprising.

Keith
 
Doesn't matter much, keith. What Vilhelm-Ion and I both found is from 2012 already.
Some people first ask colleagues or friends.
Nothing is wrong.

Google is less personal but typically the fastest option. Try a but of variations.

Bye, Olaf.
 
Maybe you should also look into google options. It allows you to prefer your own language, pages from your country, only your language or the opposite, to prioritize english sites.
It pays to make some settings in google.

Bye, Olaf.
 
Maybe you should also look into google options. It allows you to prefer your own language, pages from your country, only your language or the opposite, to prioritize english sites.

Very true. And, of course, Google also knows your search history - and quite a lot more about you - and will usually customise its results accordingly. What this means is that the results that Keith might see in Google won't be the same as what Wilhelm-Ion, Olaf or myself might see.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
The Google search results I see tend to follow the flow of the work I am doing at that particular time as like many others, Google is my first port of call to find answers - why not, in the old days it meant a trip to the local library and a few hours in the company of clever people and I was never comfortable with them.

I have a small Facebook network and the number of adverts, close to the subject of my latest Google searches, is much more than pure coincidence.

Keith
 
In dubio pro reo.

In the end I have to believe you didn't get that result. But if I search a movie title I also don't get source code and if I search a technical, and there is no other meaning it has, then I get technical results. It's an open secret I doubt you did a search, but it doesn't matter much anyway.

I have seen people fail with google and blaming it. You can combine words and make your results tend into an unusual direction, too. I'm still just guiding and recommending things to you, I hope you're not already offended. In the end it's true google adapts to the users, but people often don't know the simplest ways to get more out of it, eg by simply searching two keywords or using annotations like specifying a site to search in, eg site:tek-tips.com or something like that. Or search definition of PORTPROMPT.

I already said people are used to different things and prefer their ways and there is nothing wrong to come here, in case somebody knew more about it, he might have shown code to handle printing to files with windows 8 and the PORTPROMPT: port.

You still didn't answer my question, if you did I might point out to you what the different elemenst of the array you get mean or how you misinterpreted this as a printer name. It's a port, not a printer name.

Anyway, now we have a discussion - maybe also helpful to others - about google. With google you just have search results, not discussions. So I don't blame you coming here with such a question. But not finding anything about it? Are you really sure? I can't imagine that.

Bye, Olaf.
 
OK, so I had my rant. I just felt a little fooled by you and I don't like to be fooled.
Anyway, getting back on just being helpful, here is my assumption what you did:

Code:
APRINTERS(laPrinter)

For lnPrinter = 1 To Alen(laPrinter)
  ? laPrinter(lnPrinter)
Endfor

You overlooked the result of most ASomething() functions is a 2-D array, In this case having two columns. Every second element is an element of column 2, which stores port names, not printer names. You can get even more info on all printers by specifying ,1 in the APRINTERS function and getting a 5 column array back.

Code:
For lnPrinter = 1 To APRINTERS(laPrinter,1)
  ? "Printer #",lnPrinter
  ? "Name:",laPrinter(lnPrinter,1)
  ? "Port:",laPrinter(lnPrinter,2)
  ? "Driver:",laPrinter(lnPrinter,3)
  ? "Comment:",laPrinter(lnPrinter,4)
  ? "Location:",laPrinter(lnPrinter,5)
Endfor

I get no printer giving me any Location info, but some more port names unknown to me.

Bye, Olaf.
 
Sorry Olaf but you can doubt as much as you like. I never just post on Tek-Tips without doing a certain amount of research myself first but in this case I did a search for PORTPROMPT: and got a couple of meaningless results and the rest were about PORTAPROMPT which is a totally unconnected tele prompting service.

I have been a member of this forum for many years and have never used it as an alternative to using my own grey cells.

You have always been a knowledgeable individual who provides logical and correct answers to questions posted by myself and others and for that I am grateful.

Keith
 
Then you only go through half the array. APRINTER returns number of ROWS, not number of elements. As this parameterization returns a two dimensional array, you print half the printer names and their ports.

I gave you code that gives you all infos.

Bye, Olaf.
 
Just FYI:

Code:
Local Array laArray[2,2]
For nrow=1 to 2
   For ncol = 1 to 2
      ? nrow, ncol, laArray[nrow,ncol]
   EndFor
EndFor
myarray = "Test"
For nrow=1 to 2
   For ncol = 1 to 2
      ? nrow, ncol, laArray[nrow,ncol]
   EndFor
EndFor
For nElement = 1 to 4
   ? nElement, laArray[nElement]
EndFor

This demonstrates:
1. How to create array variables in most recent syntax LOCAL/PRIVATE/PUBLIC ARRAY, if not using APRINTERS, AFIELDS, ADIR, AERROR, AEVENTS,... and most other array functions. ALINES only creates a 1 dimensional array, as there is no side info about the single lines, whcih would be of interest. Length for example can easily be determined by LEN.
2. Like any variable also all array elements are initialiszed with .F., of course not so, if using array creating functions.
3. How to initialize all elements of an array with another value in one single line without iteration.
4. How you can iterate a two dimensional array with both row/column addressing AND element addressing.

So it's not forbidden to address a two dimensional array with the element number, but as already said array creating functions mostly create a two dimensional array and return the number of rows instead of number of elements, so you have to use the row/column addressing, if your loop goes from 1 to the return value of APRINTERS, for example.

Bye, Olaf.
 
FYI in regard to printers.

With this simple set of rules you never need to go as low level as determining printer names with APRINTER:

1. Only use FRX and LBX
2. Never use embedding printer info in FRXes or LBXes
3. Set the destination printer with SET PRINTER TO NAME GETPRINTER()

Earlier on SYS(1037) was a very good friend to let a user choose printer and make settings, but GETPRINTER() is at least giving you the name exactly as needed and the user can also look for network printers in the dialog.

If you can't apply to rule #1 because your printer does not come with a windows driver and has its own special command escape sequences, you have to go low level, but only in that case. But modern POS system voucher printers can be addressed with endless paper LBX labels and via Windows printer driver.

Rule #2 may be bended, if you have special situations in a small network supporting a specific printer and adapting your report very specifically for it.

The lack of setting printer options can be compensated by installing a printer multiple times with different names and the different settings needed, eg for the tray. Make the printer name saying what settings its setting and its very user friendly again.

That's all the main things you need to know about printing in VFP9. You don't have to care for printer ports, that is taken care of by a printer driver. The driver will know to which port to send which printer commands, PS, PCL, whatever. And aside of the crippled SYS(1037) dialog, this has been this way since VFP6 at least. Can't tell you about earlier VFP versions.

Bye, Olaf.
 
Thanks for the information Olaf.
Scenario is, I am developing the app on a WIN8 box which shares a network with a Vista box and an XP box.
This particular app is for a network with WIN7 boxes and is many miles away from my location. The client is fairly web savvy so I send him regular updates via FTP.
It is an Epos system in a high street shop and has worked for many years using a small receipt printer for customer receipts.
He now wants the option to print A4 receipts for some customers but still retain the small printer for most customers.
We decided that it should always print a small receipt, this was for convenience.

It was while testing a script, on my network, for finding the names of his printers that I encountered PORTPROMPT: and I was keen to find out what it was even though it has no direct bearing on the project itself.

Once I know the name of the A4 printer, I hope to use 'set printer to' to access it and I am hoping that 'set printer to default' will revert it back to the small receipt printer. I have no way of knowing if this will work until it is tested but that is part of the challenge.

Keith
 
If your reports don't embed special printer info (eg from your dev pc) you print to default printer and that's it. But then it's as easy as defining a menu item to do SET PRINTER TO NAME (GETPRINTER()) and the users can choose the printer without changing default windows printer.

Bye, Olaf.
 
Hi,

The 'PortPrompt' is coming from printer 'Microsoft XPS Document Writer' - a driver installed with OS(8.1)

Please try these line of codes:

Code:
lnNo = APRINTERS(laPrinters)

If lnNo > 0
    for x= 1 to lnNo
        ? laPrinters[x,1]
	? laPrinters[x,2]
    endfor 
Endif

Regards,

Jockey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top