Page number printed cards

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Page number printed cards

Post by bsouthuk » Thu Mar 25, 2010 1:46 pm

Hello all

Wonder if somebody can help me.

I have a stack that contains lots of cards that I need printin. However only cards that I have selected to print - I have the following code that I am using for this:

Code: Select all


function whatCards2Print
repeat with i = 1 to the num of btns of grp "ActivePrint" of cd 1
if the hilite of btn i of grp "ActivePrint" of cd 1 = true then
put i & "," after new_list
end if
end repeat

delete char -1 of new_list

RETURN new_list
end whatCards2Print



set the formatForPrinting of stack "qg" to true
   set the printRotated to false 

   open printing with dialog 



set the printScale to 1
    set the printMargins to 0, 0, 0, 0  --1/2 inch margins 
    set the printGutters to 0, 0 --1/4 inch gutters 
   put whatCards2Print() into  Cards2print
repeat for each item i in  Cards2print
print  Card i 
end repeat 
close printing
I now need to page number the cards that have been selected in format "Page 1 of 24, Page 2 of 24' etc and wondered what code i'd need to add to make this possible?
Your help is most appreciated.

Cheers

Daniel

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Page number printed cards

Post by Klaus » Thu Mar 25, 2010 1:57 pm

Hi Daniel,

I already answered this about 9 days ago!
See here:http://forums.runrev.com/phpBB2/viewtop ... f=9&t=5057


Best

Klaus

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Re: Page number printed cards

Post by bsouthuk » Thu Mar 25, 2010 2:08 pm

Hi Klaus

You did and thank you for that.

However am experiencing a few problems. The page numbering code must work with the code I have written above as it must relate to check box buttons within a group.

The reason for this is that the stack containing all of the cards has lots of different 'grouped check box buttons' that determine which pages are to be printed and depending upon the user that logs in to my application determines which 'check box button group' is visible.

Does this make sense?

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Page number printed cards

Post by Klaus » Thu Mar 25, 2010 3:11 pm

Hi Daniel,

whatever :-)

You only used parts of my original script in your example!

But here is a hint on how to do this in your script, see the comments!

Code: Select all

...
## Your function will return a comma separated list of all the card number to be printed
put whatCards2Print() into  Cards2print

## Now you can get the COUNT of these card to be printed:
put the num of items of Card2Print into tCardCount

## Since "repeat for each" will noit give you a clue what number is curretnly processed you need to make you own counter:
put 0 into tCounter

repeat for each item i in  Cards2print
   add 1 to counter

   ## Now you can fill your info field of all these cards inside of this loop!
   put "Page" && tCounter && "of" && tCardCount into fld "pagenumber" of cd i
   print Card i 

   ## Optional: remove this info again after printing
   put empty into fld "pagenumber" of cd i
end repeat 
...
Best

Klaus

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Re: Page number printed cards

Post by bsouthuk » Thu Mar 25, 2010 4:32 pm

Done! You're a star Klaus.

Its simple when you know how!

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Page number printed cards

Post by Klaus » Thu Mar 25, 2010 6:28 pm

Hi Daniel,
bsouthuk wrote:Done! You're a star Klaus.
I know! 8)

Check this if you like rock music:
http://www.youtube.com/watch?v=W6w-EMwJh4g
I am the guy with glasses and few hair on the right :D

Best

Klaus

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Page number printed cards

Post by sturgis » Thu Mar 25, 2010 7:51 pm

Hmm. You don't have much hair on the left either!

You guys rock.

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Page number printed cards

Post by Klaus » Thu Mar 25, 2010 8:01 pm

sturgis wrote:Hmm. You don't have much hair on the left either!
Ahhh, you made my day!!! :lol: :lol: :lol:
sturgis wrote:You guys rock.
Thanks, it's a lot of fun!
Check our website, it is in german but "Bilder" means pictures and sure you get the picture with "Sounds", so you can see and hear us, if you like.
http://www.andernfalls.de/

I totally spoil the average age of the band, all of them are more than 20 years younger than me 8)

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Page number printed cards

Post by sturgis » Thu Mar 25, 2010 8:17 pm

Nice site. Think i'll snag your downloads and add em to my library.
All I need to do now is learn German to better appreciate. The only thing I can see that the band needs now is a really great... ukulele soloist! However, if you ever decide you need a low to average ukulele soloist, i'm there.

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Page number printed cards

Post by Klaus » Fri Mar 26, 2010 9:00 am

Hi sturgis,

OK, I talked to my band mates and we will give you a try!
We'll meet next tuesday 8:00 PM in Bonn-Beuel at McDonalds, bring a microphone, if you don't have pick-up on your uke :D


Best

Klaus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10058
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Page number printed cards

Post by FourthWorld » Fri Mar 26, 2010 2:26 pm

Klaus wrote:Check this if you like rock music:
http://www.youtube.com/watch?v=W6w-EMwJh4g
Nice Klaus! Is that a fretless bass you're playing? The group has a good sound - and that was an amazingly clean recording for a live performance.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Page number printed cards

Post by sturgis » Fri Mar 26, 2010 2:48 pm

Hmm. I do happen to have a pickup in my uke. Any chance you can swing by to pick me up? In New Mexico, USA? *grin* Instead how about an audition tape? Made a quick and dirty shortened cover of "Smooth" (santana and rob thomas). Keep in mind its recorded with my laptop mic not proper recording equipment but even so for a self styled "mediocre" player its not bad.

Used to play keyboard also, but all we have at the moment is a really badly tuned piano.

P.S. ignore any string buzz, ukes are really sensitive to string burr and i'm due for a new set.
Klaus wrote:Hi sturgis,

OK, I talked to my band mates and we will give you a try!
We'll meet next tuesday 8:00 PM in Bonn-Beuel at McDonalds, bring a microphone, if you don't have pick-up on your uke :D


Best

Klaus

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Page number printed cards

Post by Klaus » Fri Mar 26, 2010 6:55 pm

Hi sturgis,

ok, send me the tape :D
My address: klaus (AT) major-k.de

Best

Klaus

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Page number printed cards

Post by sturgis » Fri Mar 26, 2010 7:05 pm

Hmm, thought I had posted it last time. Heres a link to my audition recording. http://runthenumbersnow.com/santana/smoothe.mp3

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Page number printed cards

Post by Klaus » Tue Mar 30, 2010 10:32 am

Hi all,

sorry for being a bit late to answer.
A friend of mine died surprisingly on sunday, he just did not wake up anymore.
He was the boy friend of our female singer and we had been on stage together
about a week ago. :cry:


@Richard
Yes this is my baby, a fretless 6-string bass I bought more than 20 years ago.

@sturgis
That is really cool what you do with your uke, honestly!


Best

Klaus

Post Reply