Optimizing print code

charles61 cszasz at mac.com
Fri Sep 10 11:53:27 EDT 2010


I have developed the following print card code for both the Mac and Windows.
When I tested it the Print Dialog seems to take longer to show up despite
improvements I made to both print scripts. 
I would certainly appreciate any suggestions on how to speed up the print
dialog appearing!

Here is my code:

on mouseUp
   if the platform is "macos"
   then
      select empty
      
      open printing with dialog as sheet
      if the result = "cancel" then exit to top
      
      set the printPaperOrientation to "portrait"
      set the printmargins to 36,108,36,72
      set the printScale to .8738
      
      set the mark of card "referral" to false
      set the mark of card "letter" to false
      set the mark of card "help" to false
      
      lock screen
      set the hiliteColor of this stack to 255,255,255
      set the backgroundColor of this stack to 255,255,255
      hideStuff
      
      go to first marked card
      select empty
      
      repeat with x=1 to the number of marked cards ---> Page numbering of
marked cards
         put "Page" && x into field "PageNumber" of marked card x
      end repeat
      
      select empty
      click at "0,0"
      print marked cards
      
      close printing ---> Printing is done!
      
      set the mark of card "referral" to true
      set the mark of card "letter" to true
      set the mark of card "help" to true
      
      set the hiliteColor of this stack to 126,188,237
      set the backgroundcolor of this stack to 237,239,217
   
      showStuff
      unlock screen
      go to card "communications"
   end if
   
   if the platform is "win32" 
   then 
      answer printer
      set the printPaperOrientation to "portrait"
      set the printmargins to 36,108,36,72
      set the printScale to .8738
      
      open printing 
      if the result = "cancel" then exit to top
      
      set the mark of card "referral" to false
      set the mark of card "letter" to false
      set the mark of card "help" to false
      
      set the formatforprinting of this stack to true
      select empty
      
      lock screen
      hide stuff
      go to first marked card
      
      repeat with x=1 to the number of marked cards ---> Page numbering of
marked cards
         put "Page" && x into field "PageNumber" of marked card x
      end repeat
      
      select empty
      print marked cards
      close printing ----> Printing completed --->Added 9-7-10
   end if
   
   set the mark of card "referral" to true
   set the mark of card "letter" to true
   set the mark of card "help" to true
   
   set the backgroundcolor of this stack to 237,239,217
   set the formatforprinting of this stack to false
   showStuff
   go to card "communications"
   unlock screen
end mouseUp

on hideStuff
   hide group "menubar 1" of card "eligibility"
   hide button "print Elig" of card "eligibility"
   hide button "continue" of card "eligibility"
   hide button "eligmenu" of card "eligibility"
   hide group "main" of card "eligibility"
   --   hide button "Omenu1" of card "eligibility"
   hide button "print" of card "communications"
   hide group "nav" of card "communications"
   hide button "list" of card "communications"
   hide group "main" of card "communications"
   
   hide button "print" of card "help" ---> New 9-7-10
   hide button "save" of card "help"
   hide button "eligibility page" of card "help"
   hide button "clear" of card "help"
end hideStuff

on showStuff
   show group "menubar 1" of card "eligibility"
   show button "print Elig" of card "eligibility"
   show button "continue" of card "eligibility"
   show button "eligmenu" of card "eligibility"
   show group "main" of card "eligibility"
   show button "print" of card "communications"
   show group "nav" of card "communications"
   show button "list" of card "communications"
   show group "main" of card "communications"
   
   show button "print" of card "help" ---> New 9-7-10
   show button "save" of card "help"
   show button "eligibility page" of card "help"
   show button "clear" of card "help"
end showStuff

-- 
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Optimizing-print-code-tp2534663p2534663.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list