Very Hot Topic (More than 25 Replies) Envelopes from print spec (Read 10186 times)
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Envelopes from print spec
Apr 23rd, 2005 at 4:51pm
Print Post Print Post  
Hi -

Well I need to revisit prininting an envelope using print specs.

Unfortunately, I have never been able to get Windows to recognize an "alternate" printer, using Sesame.  So, for now at least, I have set my default printer for envelopes.

I am using the following code:

Code
Select All
AlternateDefaultPrinter("Envelopes")
PrintPagePaper(20)
Newpage(950,412)
PrintString("Herbert Teicher", 30, 25, 0, "Arial", 14, 0)
PrintString("26 McDonald Street", 30, @PageExtentY(), 0, "Arial", 14, 0)
PrintString("Staten Island, NY  10314-5055", 30, @PageExtentY(), 0, "Arial", 14, 0)

PrintString(Mail Name, 450, 200, 0, "BArial", 16, 0)
PrintString(Street Address + " " + Apt, 450, @PageExtentY(), 0, "BArial", 16, 0)
PrintString(City + ", " + State + "  " + Zip, 450, @PageExtentY(), 0, "BArial", 16, 0)

PrintString("Thanks for supporting The Middle Villager Newsletter", 30, 800, 0, "Arial", 8, 0)

FinishPage()
 



The return address prints just fine.  The merged data prints just fine.  But, for some reason, the last line "Thanks, etc." will  not print at all.  I have varied the coordinates to be sure that I wasn't going "off the page" or trying to "back-up" etc. but nothing seems to work.  HELP!!!

Also, is there any way to provide a code to tell Sesame to print an envelope for the entire set of retrieved records?

Thanks!

  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Envelopes from print spec
Reply #1 - Apr 23rd, 2005 at 5:53pm
Print Post Print Post  
Quote:
Hi -

Well I need to revisit prininting an envelope using print specs.

Unfortunately, I have never been able to get Windows to recognize an "alternate" printer, using Sesame.  So, for now at least, I have set my default printer for envelopes.

I am using the following code:

Code
Select All
AlternateDefaultPrinter("Envelopes")
PrintPagePaper(20)
Newpage(950,412)
PrintString("Herbert Teicher", 30, 25, 0, "Arial", 14, 0)
PrintString("26 McDonald Street", 30, @PageExtentY(), 0, "Arial", 14, 0)
PrintString("Staten Island, NY  10314-5055", 30, @PageExtentY(), 0, "Arial", 14, 0)

PrintString(Mail Name, 450, 200, 0, "BArial", 16, 0)
PrintString(Street Address + " " + Apt, 450, @PageExtentY(), 0, "BArial", 16, 0)
PrintString(City + ", " + State + "  " + Zip, 450, @PageExtentY(), 0, "BArial", 16, 0)

PrintString("Thanks for supporting The Middle Villager Newsletter", 30, 800, 0, "Arial", 8, 0)

FinishPage()
 



The return address prints just fine.  The merged data prints just fine.  But, for some reason, the last line "Thanks, etc." will  not print at all.  I have varied the coordinates to be sure that I wasn't going "off the page" or trying to "back-up" etc. but nothing seems to work.  HELP!!!

Also, is there any way to provide a code to tell Sesame to print an envelope for the entire set of retrieved records?

Thanks!



The coordinates of 30 by 800 would be off the page, by a good bit. The height limit specified in the NewPage command is 412. Have you tried using a y coordinate of less than 412?

To print every record in a result set - use mass update.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #2 - Apr 23rd, 2005 at 8:16pm
Print Post Print Post  
Mark -

The truth be known, I believe I got confused with the X,Y coordinates but believe I had tried less than 400.

In any event, I just tried it with 300 and it still didn't print.

The mass update info will be helpful, providing I can get that last line to print.

Any other suggestions?

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Envelopes from print spec
Reply #3 - Apr 23rd, 2005 at 8:37pm
Print Post Print Post  
Try using coordinates that are printing already, like 450, 200 or 30, 25. Also, remember to place a space in front of the font name if it is not bold or italic - i.e. " Arial". (page 136 of the programming manual).

Once you have it printing, then move it gradually in the direction you want, until some portion of it doesn't print.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #4 - Apr 23rd, 2005 at 10:26pm
Print Post Print Post  
Mark -

Finally, I got the line to print.  I think the problem was that I didn't have a space in front of the font name.  I did want it to print in italics, so I added the letter "I" without any space and that worked.

I trust that I will understand how to use the mass update feature to print the retrieved records.  If I have a problem with that issue, I'll come back here.

The last thing I would like to know is when you think the new print specs will be released. It is a real nuisance to have my default printer set to envelopes, because most of my routine printing is done on letter size paper .... and the envelope printing is intermittent.

Thanks!
« Last Edit: Apr 25th, 2005 at 3:30pm by SpencerWulwick »  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Envelopes from print spec
Reply #5 - Apr 25th, 2005 at 2:15pm
Print Post Print Post  
Hello Spencer,

What new print specs? If you have version 1.1.1 you should have all you need to make this happen. In 1.1.1 there is an SBasic command named PrintPageTray() which allows you to set which tray the printer should get paper from. 5 is Envelope so put the following line in your programming and see what happens. You will want it after AlternateDefaultPrinter.

Code
Select All
PrintPageTray(5) 



-Ray

p.s. This is Ray, The Cow is Mark.

-edit- I forgot to mention this command is undocumented and only lightly tested.

Syntax is

PrintPageTray(Tray Number as Int)

Tray Numbers are
0: USER
1: ONLYONE
2: LOWER
3: MIDDLE
4: MANUAL
5: ENVELOPE
6: ENVMANUAL
7: AUTO
8: TRACTOR
9: SMALLFMT
10: LARGEFMT
11: LARGECAPACITY
12: CASSETTE
13: FORMSOURCE
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
AlternateDefaultPrintRe: Envelopes from print spec
Reply #6 - Apr 25th, 2005 at 4:09pm
Print Post Print Post  
Ray -

You asked:

Quote:
What new print specs?


A while ago, on the forum, I was told that commands "were coming out" (or words to that effect) that would tell the printer which tray to use.  I assumed that when they were developed, they would be communicated.  So ...... I was waiting for them to be developed.

In any event, I tried using the PrintPageTray command and still no luck.

Perhaps you (or Mark) can look at my code and see if I am overlooking something. 

Code
Select All
AlternateDefaultPrinter("Auto HP LaserJet 5 - Envelopes")
PrintPagePaper(20)
PrintPageTray(5)
Newpage(950,412)
PrintString("Spencer Wulwick (MVR)", 30, 25, 0, "Arial", 14, 0)
PrintString("210 South Hale Avenue", 30, @PageExtentY(), 0, "Arial", 14, 0)
PrintString("Tampa, FL 33609-3933", 30, @PageExtentY(), 0, "Arial", 14, 0)

PrintString(Mail Name, 450, 200, 0, "BArial", 16, 0)
PrintString(Street Address + " " + Apt, 450, @PageExtentY(), 0, "BArial", 16, 0)
PrintString(City + ", " + State + "  " + Zip, 450, @PageExtentY(), 0, "BArial", 16, 0)

FinishPage()
 



I am, by the way, using an HP LaserJet 5M with an envelope feeder that inserts into a slot on the printer.

One variation I tried was in the name of the printer.  The windows setup for the printer is just as it is shown in the above code.

The programming guide says to use the name of the "shared printer."  So, I made the printer shareable (even though I don't need it set up that way) and assigned the share name ENVELOPES.  Even if I change the printer name from AUTO HP LASERJET 5 - ENVELOPES to ENVELOPES, it makes no difference.

I also tried the "auto" setting (7) and neither did that make a difference.

The envelope feeder works perfectly from other programs, such as MS Word, etc.

It would be a great help if I could get this to work so that I can set my default printer back to the way I want it.

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #7 - Apr 25th, 2005 at 4:33pm
Print Post Print Post  
Ray/Mark -

I'm wondering whether the numbers in the Programming guide - for the type of paper to use - are correct ..... of if possibly they are printer-specific dependant.

Originally, I was told to use "20" for envelopes.

I just looked in the programming guide and here's what I found.

1 = A0
2 = A1
3 = A2
4 = A3
5 = A4
6 = A5
7 = A6
8 = A7
9 = A8
10 = A9
11 = B0
12 = B1
13 = B2
14 = B3
15 = B4
16 = B5
17 = B6
18 = B7
19 = B8
20 = B9
21 = B10
22 = C5E
23 = DLE
24 = Executive
25 = Folio
26 = Ledger
27 = Legal
28 = Letter
29 = Tabloid
30 = Envelope

So, I tried modifying my programming by changing "20" to "30" for the paper type.

I got a message (on my printer) that told me to load legal-size paper .... and indeed, when printed, it was formatted for legal-size paper.

Likewise, I tried "27" and that, too, told me to load legal-size paper.

« Last Edit: Apr 26th, 2005 at 6:32am by SpencerWulwick »  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Envelopes from print spec
Reply #8 - Apr 25th, 2005 at 4:42pm
Print Post Print Post  
Hello Spencer,

I had forgotten that PrintPageTray was undocumented which was why I was wondering what other commands you were looking for. I though Mark had said it would be out in 1.1.1 but undocumented. anyways

Quote:
The programming guide says to use the name of the "shared printer."  So, I made the printer shareable (even though I don't need it set up that way) and assigned the share name ENVELOPES.  Even if I change the printer name from AUTO HP LASERJET 5 - ENVELOPES to ENVELOPES, it makes no difference.


No difference as it still prints to the Laserjet 5 on letter paper or no difference as it doesn't print?

The AlternateDefaultPrinter() command can use both the local name for the printer and the shared name for the printer. The 1.1 documentation has been updated to say this.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #9 - Apr 25th, 2005 at 4:49pm
Print Post Print Post  
Ray -

"Makes no difference" meaning it prints to the letter tray.

You may have responded before you saw my later post regarding the numbers to use for the paper type.

Repeating, using "20" (which I was told to use for envelopes) prints to letter size paper.

Using "30" - which the programming guide says to use for envelopes - tells me to load legal-size paper.

Using "27" - which the programming guide says to use for legal-size paper - tells me to load legal-size paper.

  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Envelopes from print spec
Reply #10 - Apr 25th, 2005 at 5:03pm
Print Post Print Post  
Quote:
Ray/Mark -

I'm wondering whether the numbers in the Programming guide - for the type of paper to use - are correct ..... of if possibly they are printer-specific dependant.

Originally, I was told to use "20" for envelopes.


Hello Spencer,

Who told you to use 20 for envelopes?

As far as I am aware the numbers in the documentation are correct.

From what I remember you have two printers correct? A LaserJet5 and an OfficeJet all-in-one.
Which one do you want to be your normal day to day default printer?
Change your system so that printer is the default printer.
Try using the below code. Replace "Auto HP LaserJet 5" witht he name of your plain jane LaserJet 5 not the one you set up for envelopes

Code
Select All
AlternateDefaultPrinter("Auto HP LaserJet 5")
PrintPageTray(5)
Newpage(950,412)
PrintString("Am I on a Letter?", 30, 25, 0, "Arial", 14, 0)
FinishPage()
 



If it is not on a letter try PrintPageTray(6).

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #11 - Apr 25th, 2005 at 5:53pm
Print Post Print Post  
Ray -

This is getting more and more complicated and I am getting more and more confused.

First, yes, I do have two printers on this particular computer.  My most common default setting is for the HP LaserJet 5 - One-sided.  From time-to-time, I might periodically change it to the HP Officejet 7210 All-In-One. 

Regarding use of 20 for envelopes, I went back to my original post on the forum and couldn't find anyone telling me to use 20 for envelopes .... unless I misread your "code" (the print is rather small).

It was you who told me to use 30.   Every time I try 30 (and I just tried it again), it tells me to load legal-size paper.

Until now I never had a "plain jane" LaserJet 5 setting (other than when I first installed the printer). 

The reason is that I have many options for my printer.  I can print:

letter one-sided
Letter head-to-head
letter head-to-foot
legal size
manual feed
envelope feeder

When I first started with a simple LaserJet 5 setting, I found that I kept having to change the properties when using different paper options.  So, I simply set up a paper-specific printer for each option I might want and that has always worked very well for me.

In any event, I just added a "new" printer as simply HP LaserJet 5 and didn't change the default settings.

I tried the code you provided and it printed on letter (I was a bit confused because I would have thought the question would be "Am I on an Envelope?" ... because that is my objective). 

In any event, it printed on letter.  I tried changing the PrintPageTray to 6 and it still printed on letter.

Any chance I could call to clarify any of this?
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Envelopes from print spec
Reply #12 - Apr 26th, 2005 at 12:54am
Print Post Print Post  
Spencer, try this:


Make both of your printers shareable.
Write down the names they use as Shared Printers
Write down the name of your computer as a network name.


Go to a command prompt
Type NET VIEW to see the printers and their names.

Try to capture them with NET USE:
NET USE LPT2:  \\computername\sharedprintername

Does that work?  If yes, try using those names in the Sesame commands for printers.  Remember to use the double quotes.

AlternateDefaultPrinter("\\computername\sharedprintername")
Do your print stuff:
PrintString("STUFF")
FinishPage()
RestoreDefaultPrinter()

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #13 - Apr 26th, 2005 at 6:31am
Print Post Print Post  
Bob -

This is going to get me "old" before my time.  (What do you mean "too late")  lol

I am only using one printer for printing envelopes, so I only made that one shareable (I can't imagine why the other printer would come into play at all).

When I type NET VIEW, it only gives me the computer name as
\\OFFICE and tells me that "The command completed successfully"

Quote:
Try to capture them with NET USE:
NET USE LPT2:  \\computername\sharedprintername


I wasn't sure whether you meant to literally type computername\sharedprintername ....  or office\envelopes, so I tried it both ways (substituting LPT1 which is my actual printer port used).

In either case I get "System error 85 has occurred.  The local device name is already in use.

In any event, I went ahead and tried the programming you recommended using

Code
Select All
AlternateDefaultPrinter("\\office\envelopes")
 




The printer status window bounces between 1 to 4 documents in queue and reads spooling, printing, deleting ad infinitium.  It never prints and just goes on and on until I cancel the job.

My hair is already gray.  What color do you think it will turn after this?   lol
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Envelopes from print speccat
Reply #14 - Apr 26th, 2005 at 1:04pm
Print Post Print Post  
Spencer,
Most printer drivers on MS OSs, have a set of dialog boxes that control two aspects of the behavior of the printer. The "pages" of these two aspects appear almost identical - yet are not identical. The first of these appears on the "General" tab under the button labeled "Printing Preferences". The other appears on the "Advanced" tab, under the button labeled "Printing Defaults". On the defaults dialog there are settings for Paper/Quality, and "Advanced". Under the "Advanced" button on the "Defaults" dialog there are setting for Paper Sizes. On the "Paper/Quality" tab of the "Defaults" dialog, there are settings for "Paper Source" and tray selection.

Do not confuse these settings for the identical settings that appear on the "General" tab of the main printer dialog box - though it would be wise to make sure that they both agree and that they both agree with your expectations for that printer in regard to paper sizes and trays.
Microsoft has attempted to generalize the trays/paper sizes with the following table:

DMBIN_USER;
DMBIN_ONLYONE;
DMBIN_LOWER;
DMBIN_MIDDLE;
DMBIN_MANUAL;
DMBIN_ENVELOPE;
DMBIN_ENVMANUAL;
DMBIN_AUTO;
DMBIN_TRACTOR;
DMBIN_SMALLFMT;
DMBIN_LARGEFMT;
DMBIN_LARGECAPACITY;
DMBIN_CASSETTE;
DMBIN_FORMSOURCE;

Unfortunately, this table can only roughly correspond to the actual settings as devised by the author of the actual printer driver. For example, by no means can this table accomodate the likelihood that there may be more than one manual feed, or tray containing envelopes. Because, this may be non-specific, Microsoft, has also, incorporated in the development tools the ability to specify a paper size. The driver is then supposed to use the assignment of paper size to a particular tray to determine the appropriate tray to use for any selected paper size. This works only as well as the driver will let it, based on the settings that have been assigned to that driver.

  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #15 - Apr 26th, 2005 at 5:02pm
Print Post Print Post  
Marc -

I appreciate the detailed explanation and do understand what you are saying.

I always try to reason things through in a logical sequence and am generally pretty good at it.

Here's the part that I don't undertand, though.  

(1) If I make the "Auto HP LaserJet 5 - Envelopes" the default printer, the printing is done on an envelope.  It would seem to me that would indicate that the Windows printer setup dialogue box is appropriately set up.   It would also seem that I should be able to omit both the PrintPagePaper and the PrintPageTray commands from the programming, since that information is contained in the Printer Setup.

(2) If in the Sesame programming I include "PrintPagePaper(30)" I get a printer message telling me to "load legal size paper."  That tells me two additional things:  (a)  The PrintPagePaper command is being recognized by my print driver and (b) "30" is either being misinterpreted or is simply not the correct code for my particular driver.

(3) If I make another printer (e.g. letter-size one sided) the default printer (which is set up for portrait printing), and use the AlternatePrinterCoding in Sesame, the text is printed in landscape (but, as I said before on letter-size paper).  This tells me, once again, that the AlternatePrinterCoding is being recognized and the page layout is being correctly applied in the AlternatePrinter setup dialogue.  

Why the envelope feeder is not being utilized is totally beyond my comprehension.

At this point, I feel that I must "give up" and leave envelopes set up as my default printer. Perhaps, when I get a new printer, it will "fix" the problem.

On the issue of using mass update to print multiple envelopes, I am having a problem with the coding to retrieve the set of records I want to print on.  I am so "weary" at this point, that I would really appreciate suggested sample programming to

(1) retireve a set of record based on a saved retrieve set

(2) sort the records based on a saved retrieve set

and

(3) print the retrieved, sorted record set (using my existing printspec coding to print the envelopes).

Thanks.


  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Envelopes from print spec
Reply #16 - Apr 26th, 2005 at 7:06pm
Print Post Print Post  
Quote:
Marc -

I appreciate the detailed explanation and do understand what you are saying.

I always try to reason things through in a logical sequence and am generally pretty good at it.

Here's the part that I don't undertand, though. 

(1) If I make the "Auto HP LaserJet 5 - Envelopes" the default printer, the printing is done on an envelope.  It would seem to me that would indicate that the Windows printer setup dialogue box is appropriately set up.   It would also seem that I should be able to omit both the PrintPagePaper and the PrintPageTray commands from the programming, since that information is contained in the Printer Setup.

As I mentioned before, there are two settings. Which of the two that is being used depends on whether the print dialog is being made visible while creating the graphics context. If one is correct that will allow appropriate behavior under some (usuallu only microsoft) applications. Any application that, by default, does not display the print dialog will need the other setting. It is best to make sure that both agree.

Quote:
(2) If in the Sesame programming I include "PrintPagePaper(30)" I get a printer message telling me to "load legal size paper."  That tells me two additional things:  (a)  The PrintPagePaper command is being recognized by my print driver and (b) "30" is either being misinterpreted or is simply not the correct code for my particular driver.

Again, as I said, it depends on whether the printer agrees with MS as to what paper is in which tray.

Quote:
(3) If I make another printer (e.g. letter-size one sided) the default printer (which is set up for portrait printing), and use the AlternatePrinterCoding in Sesame, the text is printed in landscape (but, as I said before on letter-size paper).  This tells me, once again, that the AlternatePrinterCoding is being recognized and the page layout is being correctly applied in the AlternatePrinter setup dialogue. 

Depends on the *default* settings - which are different, parallel, and identical to the "regular" settings.

Quote:
Why the envelope feeder is not being utilized is totally beyond my comprehension.

See above.
Quote:
At this point, I feel that I must "give up" and leave envelopes set up as my default printer. Perhaps, when I get a new printer, it will "fix" the problem.


Not if the condition is reestablished. This is most likely a difference between the two separate settings - the regular settings and the default settings. Those things that print without the system's dialog box appearing use the default settings.

Quote:
On the issue of using mass update to print multiple envelopes, I am having a problem with the coding to retrieve the set of records I want to print on.  I am so "weary" at this point, that I would really appreciate suggested sample programming to

(1) retireve a set of record based on a saved retrieve set

Use LoadRetrieveSpec or set a retrieve spec as the default.
Quote:
(2) sort the records based on a saved retrieve set

LoadSortSpec and a SelectTreeItem call - or use the default spec setting.
Quote:
and

(3) print the retrieved, sorted record set (using my existing printspec coding to print the envelopes).

Simply place the code, pretty much as is in the Mass Update spec for any LE.
Quote:
Thanks.

You're welcome.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #17 - Apr 27th, 2005 at 2:07pm
Print Post Print Post  
Mark -

I am trying to write code to retrieve and sort records in preparation for running a mass update to print envelopes ... and I'm trying to take it a step at a time.

So, for right now, I am simply trying to retrieve the appropriate records in sorted order.

Here is the code I have on my command button:

Code
Select All
var saverecord as Int
var loadretrieve as Int
var doretrieve as Int
var loadsort as Int
var dosort as Int



saverecord = @selecttreeitem("Search Update Menu!Navigation!Save Record")

loadretrieve = @LoadRetrieveSpec("Paid Subscribers - People Who have paid for a subscription to the Middle Villager Newsletter")

doretrieve = @selecttreeitem("Search Menu!Search Commands!Retrieve New Results (F10)")

loadsort =
@LoadSortSpec("Alphabetical By Last Name")


dosort = @selecttreeitem("Search Menu!Search Commands!Sort")

If not @Askuser("You are about to print","(several hundred) envelopes","Do you want to do this?") Then
STOP



STOP

AlternateDefaultPrinter("Envelopes")
PrintPagePaper(20)
Newpage(950,412)
PrintString("Herbert Teicher", 30, 25, 0, "Arial", 14, 0)
PrintString("26 McDonald Street", 30, @PageExtentY(), 0, "Arial", 14, 0)
PrintString("Staten Island, NY  10314-5055", 30, @PageExtentY(), 0, "Arial", 14, 0)

PrintString(Mail Name, 450, 200, 0, "BArial", 16, 0)
PrintString(Street Address + " " + Apt, 450, @PageExtentY(), 0, "BArial", 16, 0)
PrintString(City + ", " + State + "  " + Zip, 450, @PageExtentY(), 0, "BArial", 16, 0)

PrintString("Thanks for supporting The Middle Villager Newsletter", 30, 355, 0, "IArial", 12, 0)

FinishPage()

 



I know that the print code has to be moved to the mass update spec; however, I would think that the code should work up to the STOP point.  

In other words I expect to get the appropriate retrieved set of records in sorted order, before being asked whether to continue.    

Instead, I still have all the records in the database as they were when I opened the application.

Also, in the "Ask User" box, can I include the actual number of records in the retrieved record set - and, if so, how?

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Envelopes from print spec
Reply #18 - Apr 27th, 2005 at 2:27pm
Print Post Print Post  
Hello Spencer,

I believe you need the following line in your code after the SelectTreeItem that saves the record.

@SelectTreeItem("Search Update Menu!Search (F7)")

@ResultSetTotal() will return the number of records in the result set so

Code
Select All
If @Askuser("You are about to print", @ResultSetTotal() + " envelopes","Do you want to do this?") Then
{
//Run Mass Update
} 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #19 - Apr 27th, 2005 at 2:41pm
Print Post Print Post  
Ray -

Just tested the programming you suggested and it is perfect.  It tells me the number of records retrieved.  Thank you, thank you!

The problem I am still having, however, is that it is not retrieving the records I want.  Do you see anything wrong with my code for retrieving (and sorting) a record set?

Thanks
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Envelopes from print spec
Reply #20 - Apr 27th, 2005 at 2:50pm
Print Post Print Post  
Spencer,

Is it retrieving all the records, no records, some of the records but not the right ones?

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Envelopes from print spec
Reply #21 - Apr 27th, 2005 at 3:00pm
Print Post Print Post  
Spencer,

I see a problem with the sort. In the order that you have it

Code
Select All
dosort = @selecttreeitem("Search Menu!Search Commands!Sort") 



should be

Code
Select All
dosort = @SelectTreeItem("Search Update Menu!Results Commands!Sort") 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #22 - Apr 27th, 2005 at 3:01pm
Print Post Print Post  
Ray -

When the application is started, I automatically retrieve all records sorted alphabetically by last name.  There are 1866 records in all.

When I use press the command button, the record set remains unchanged with 1866 records still there.

I assume therefore, that it is not completing the retrieve function.
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Envelopes from print spec
Reply #23 - Apr 27th, 2005 at 3:05pm
Print Post Print Post  
Spencer,

Does the screen flash like it goes back to the retrieve spec?

One way to find out is open your application and go to the 6th record, any number would work other than the first.
Click the Button
Are you still on the same record?

If you are then you are not returning to the retrieve spec.
If you are not then the Retrieve spec is not loading properly. Check the name of the spec.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #24 - Apr 27th, 2005 at 3:16pm
Print Post Print Post  
Ray -

I am so glad that I have you.   lol  You are great.

I tried it again from the 6th record and nothing happened.  The problem was with the name of my retrieve spec.  I was typing the entire name the way I saw it in the spec navigator.

However,  the actual name was simply "Paid Subscribers."  (The rest of it probably came from a "description" of the spec).    I just tried it and it worked like a charm.

I did not yet try the sort with the change you told me to make.  The records were already in alphabetical order, so it appeared right.   I will play with that, too, by first changing the sort order and then see if it is changed to the way I want it.  I think I should be able to do that on my own.

Thanks again for helping me through this.
« Last Edit: Apr 27th, 2005 at 10:56pm by SpencerWulwick »  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #25 - Apr 27th, 2005 at 11:31pm
Print Post Print Post  
Ray, et. al. -

I am still having problems with my command button for retrieving a record set and sorting it (although i am happy to say that I am making great progress and am very much encouraged).

First, I would like to point out (just in case it is not self evident) that the reason for all the "save record" commands is that when a record has a date of birth, the age is automatically recalculated, on form entry.  In order to ensure that I don't get the "sometimes" message that "my record has changed but not yet been saved," I included the "save" command to preclude the possibility.

Here is the code I am presently using:

Code
Select All
var saverecord as Int
var loadretrieve as Int
var doretrieve as Int
var loadsort as Int
var dosort as Int

saverecord = @selecttreeitem("Search Update Menu!Navigation!Save Record")

loadretrieve = @LoadRetrieveSpec("Paid Subscribers")

saverecord = @selecttreeitem("Search Update Menu!Navigation!Save Record")

doretrieve = @selecttreeitem("Search Menu!Search Commands!Retrieve New Results (F10)")

saverecord = @selecttreeitem("Search Update Menu!Navigation!Save Record")

loadsort = @LoadSortSpec("Alphabetical By Last Name")

saverecord = @selecttreeitem("Search Update Menu!Navigation!Save Record")

dosort = @SelectTreeItem("Search Update Menu!Results Commands!Sort")

If @Askuser("You are about to print", @ResultSetTotal() + " envelopes","Do you want to do this?") Then
{
//Run Mass Update
}

STOP

AlternateDefaultPrinter("Envelopes")
PrintPagePaper(20)
Newpage(950,412)
PrintString("Herbert Teicher", 30, 25, 0, "Arial", 14, 0)
PrintString("26 McDonald Street", 30, @PageExtentY(), 0, "Arial", 14, 0)
PrintString("Staten Island, NY  10314-5055", 30, @PageExtentY(), 0, "Arial", 14, 0)

PrintString(Mail Name, 450, 200, 0, "BArial", 16, 0)
PrintString(Street Address + " " + Apt, 450, @PageExtentY(), 0, "BArial", 16, 0)
PrintString(City + ", " + State + "  " + Zip, 450, @PageExtentY(), 0, "BArial", 16, 0)

PrintString("Thanks for supporting The Middle Villager Newsletter", 30, 355, 0, "IArial", 12, 0)

FinishPage()

 



I am having a couple of problems with the retrieve/sort spec.

1) When I press the command button, the appropriate record set is retrieved, however it is not properly sorted.  That's my first problem.  (I am presented - at this point - with the ask user message telling me the number of envelopes I am about to print and asking if I want to continue).

2) If I click "yes" on the askuser box and then  click on the command button a second time, I am presented with the askuser box yet a second time, asking if I want to contnue.    By clicking on the command button a second time, the records are then properly sorted.

It seemed to me that perhaps my statements were "out-of-order" so I tried a couple of variations, with no success.

I am eager to get to the actual "print" (mass update) command and would appreciate additional help.

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Envelopes from print spec
Reply #26 - Apr 28th, 2005 at 2:55pm
Print Post Print Post  
Hello Spencer,

The order looks fine to me, Looks like the order I have from the application I built yesterday to look at this. Try this code see if it gives you different results.

Code
Select All
Var SaveRecord as Int
Var LoadRetrieve as Int
Var DoRetrieve as Int
Var LoadSort as Int
Var vReturn as Int

SaveRecord = @SelectTreeItem("Search Update Menu!Navigation!Save Record")

vReturn  = @SelectTreeItem("Search Update Menu!Search (F7)")

LoadSort = @LoadSortSpec("Alphabetical By Last Name")

LoadRetrieve = @LoadRetrieveSpec("Paid Subscribers")

DoRetrieve = @SelectTreeItem("Search Menu!Search Commands!Retrieve New Results (F10)") 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #27 - Apr 29th, 2005 at 1:54am
Print Post Print Post  
Ray -

I'm still struggling along with my little project that I had thought would be much easier for me to accomplish.  But, as I said before, I am making progress.

I tried the new code you provided and that seems to work better. 

I am left with two issues.  First, here's the code I am currently using on the command button:

Code
Select All
Var SaveRecord as Int
Var vReturn as Int
Var LoadSort as Int
Var LoadRetrieve as Int
Var DoRetrieve as Int

SaveRecord = @SelectTreeItem("Search Update Menu!Navigation!Save Record")

vReturn  = @SelectTreeItem("Search Update Menu!Search (F7)")

LoadSort = @LoadSortSpec("Alphabetical By Last Name")

LoadRetrieve = @LoadRetrieveSpec("Paid Subscribers")

DoRetrieve = @SelectTreeItem("Search Menu!Search Commands!Retrieve New Results (F10)")

If @Askuser("You are about to print", @ResultSetTotal() + " envelopes","Do you want to do this?") Then

{
AlternateDefaultPrinter("Envelopes")
PrintPagePaper(20)
Newpage(950,412)
PrintString("Herbert Teicher", 30, 25, 0, "Arial", 14, 0)
PrintString("26 McDonald Street", 30, @PageExtentY(), 0, "Arial", 14, 0)
PrintString("Staten Island, NY  10314-5055", 30, @PageExtentY(), 0, "Arial", 14, 0)

PrintString(Mail Name, 450, 200, 0, "BArial", 16, 0)
PrintString(Street Address + " " + Apt, 450, @PageExtentY(), 0, "BArial", 16, 0)
PrintString(City + ", " + State + "  " + Zip, 450, @PageExtentY(), 0, "BArial", 16, 0)

PrintString("Thanks for supporting The Middle Villager Newsletter", 30, 355, 0, "IArial", 12, 0)

FinishPage()
 



I know that this won't print all the envelopes, but I thought it would print an envelope for the first record in the set; it doesn't.

Also, I thought that the mass update would be more straight-forward with something like: RunMassUpdate("Pint Envelopes") but, unfortunately, it doesn't seem to be.

I have checked everything I could find on Mass Update in both the Programming Guide and the User's Guide but just can't seem to get the gist of what I need to do.  I have created and named a Mass Update Spec in the Global Code of the form.  Am I supposed to write code to "load" it and then SelectTreeItem() to run it?  If so, how do I tell it that I want it to continue without input from the user?

If I could resolve these last two issues, I should be able to complete this phase of my application.  (Actually, my first question isn't germain to the task; however, it would help me to understand why it doesn't work for the first envelope).

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Envelopes from print spec
Reply #28 - May 2nd, 2005 at 12:49am
Print Post Print Post  
This might be a solution to your last two items:

I would suggest that you record a macro to "MassUpdateUnattended", which calls the Mass Update from the Tree and presses Continue to allow non intervention by the user.

Now in your program, load the Mass Update Spec, then call the macro.

Do not include the loading of the Mass Update spec in the macro, just the call for execution and Continue button.  This will alllow you to have a "generic" Mass Update macro that you can call with any Mass Update Spec.
« Last Edit: May 2nd, 2005 at 3:14am by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Envelopes from print spec
Reply #29 - May 8th, 2005 at 5:45pm
Print Post Print Post  
Ray -

I responded to a similar discussion on another thread but am repeating a question previously asked that has not been answered, with regard to the following code:

Code
Select All
Var SaveRecord as Int  
Var vReturn as Int
Var LoadSort as Int
Var LoadRetrieve as Int  
Var DoRetrieve as Int  
  
SaveRecord = @SelectTreeItem("Search Update Menu!Navigation!Save Record")  
  
vReturn  = @SelectTreeItem("Search Update Menu!Search (F7)")  
  
LoadSort = @LoadSortSpec("Alphabetical By Last Name")  
  
LoadRetrieve = @LoadRetrieveSpec("Paid Subscribers")  
  
DoRetrieve = @SelectTreeItem("Search Menu!Search Commands!Retrieve New Results (F10)")  

If @Askuser("You are about to print", @ResultSetTotal() + " envelopes","Do you want to do this?") Then  
  
{
AlternateDefaultPrinter("Envelopes")
PrintPagePaper(20)  
Newpage(950,412)  
PrintString("Herbert Teicher", 30, 25, 0, "Arial", 14, 0)  
PrintString("26 McDonald Street", 30, @PageExtentY(), 0, "Arial", 14, 0)  
PrintString("Staten Island, NY  10314-5055", 30, @PageExtentY(), 0, "Arial", 14, 0)  
  
PrintString(Mail Name, 450, 200, 0, "BArial", 16, 0)  
PrintString(Street Address + " " + Apt, 450, @PageExtentY(), 0, "BArial", 16, 0)  
PrintString(City + ", " + State + "  " + Zip, 450, @PageExtentY(), 0, "BArial", 16, 0)  

PrintString("Thanks for supporting The Middle Villager Newsletter", 30, 355, 0, "IArial", 12, 0)
  
FinishPage()   



I know that this won't print all the envelopes, but I thought it would print an envelope for the first record in the set; it doesn't. Can you see any reason why it wouldn't print one envelope?

While playing with recording a macro to run the mass update, I discovered that while I had RECORDING ON, I as NOT asked whether I wanted user intervention.  I am assuming, therefore, that when the progamming is run, that additional user input would  NOT be required.  Do you know whether my assumption is correct?

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Envelopes from print spec
Reply #30 - May 9th, 2005 at 3:52pm
Print Post Print Post  
Hello Spencer,

If "Envelopes" is not a valid name for a printer nothing would print. Other than that I do not see any obvious errors with the code that you posted, other than the missing curly brace but I believe that is just a copy/paste error.

If you put a WriteLn() statement in the If loop does the Writeln run?

ex
Code
Select All
 If @Askuser("You are about to print", @ResultSetTotal() + " envelopes","Do you want to do this?") Then
{
writeln("We're printing now!")
AlternateDefaultPrinter("Envelopes")
PrintPagePaper(30)
Newpage(950,412)
.......
.....
....
 



I believe your Mass Update question has already been answered

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged