printing stack, occasionally printing too many cards

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

printing stack, occasionally printing too many cards

Post by jalz » Wed Oct 01, 2014 9:09 pm

Hi Guys,

I have an unusual problem with one of my scripts. I have a print script, which prints all the cards in my stack. The actual script seems to work fine, however on some occasions (mainly when I've just opened the stack) if I have 2 cards in my stack and I run that script, it will print out a blank card initially and then the subsequent two cards. If I then run the script again, it seems to print only the 2 cards I would want. It seems as though it happens nearly every time LC has been opened from fresh and I've clicked on my print script. Anyone shed light on this?

Code: Select all

on mouseUp 
   set the printPaperOrientation to "portrait"
   put printPaperSize into tPageSize
   set itemdelimiter to comma
   put item 1 of tPageSize into tPageWidth
   put item 2 of tPageSize into tPageHeight
   add 50 to tPageHeight
   
   open printing with dialog
   if the result is "Cancel" then exit mouseUp
   set the printMargins to 13,13,13,13 --left,top,right,bottom
   set the printGutters to 18,18 --1/4 inch gutters
   repeat with i = 1 to number of cards
      
      put the short name of this card of stack "Print" into tCardName
      put "Grp_"  & tCardName into tGrpName
      
      set the vscrollbar of grp tGrpName to false
      set the hscrollbar of grp tGrpName to false
      
      print card i from 15,50 to tPageWidth, tPageHeight
   end repeat 
   close printing -- sends job to printer
end mouseUp
Many thanks

Jalz

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”