[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - How to create button for "Page Setup"

How to create button for "Page Setup"

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

How to create button for "Page Setup"

Postby MarkB » Tue Dec 06, 2011 11:32 pm

The button "Print" in the main toolbar immediately starts the printer to print. With this button there's no possibility to adjust printing settings (B/W or Color, Nbr of copies, print-quality etc..) in advance. This is only possible via the menu "File" > "Page Setup...". I did not find this entry in the customization pane > available toolbar buttons. Is there a possibility to create a button in the main toolbar for the function "Page Setup" and if so, how to do ?

Thanks and regards

Sabine



Sabine, there is no such ready-made button that I koow of, and no command tag. For fun, I offer an outre solution, which you may take or leave as you wish.

This assumes a fairly recent Windows OS. Create a custom toolbar button that launches the following PocoScript, called PageSetup.

Code: Select all
{ Sends the keystrokes Alt+fu to the current window.
Embed $code "EndEmbed"
' Automatically generated, disposable VBScript
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%(fu)"
Set WshShell = Nothing
EndEmbed
AppendToFile False
AddStrings $vbsfilename $scriptpath "PageSetup.vbs"
SaveBody $code $vbsfilename
{ Do not use ExecuteAndWait with a VBScript.
Execute $vbsfilename


Tested with PocoMail 4.8 and Windows 7 Home Premium SP1 64-bit.

Edit 2012-03-12: Removed the stray slash from
AddStrings $vbsfilename $scriptpath "/PageSetup.vbs"
Last edited by MarkB on Mon Mar 12, 2012 1:28 am, edited 1 time in total.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: How to create button for "Page Setup"

Postby MarkB » Sat Dec 10, 2011 8:17 am

Thank you very much Mark and Tomas,

I've created the button and with the script it works perfect. However, I discovered, that with the function "Page Setup" I cannot send the page directly to the printer. I need to close the "Page Setup"-window and use the button "Print" on the toolbar to finally have the mail printed. Also in the "Page Setup"-window I cannot select which page(s) of a mail I want to have printed and how many copies of it. This of course has nothing to do with your script Mark. The script works fine as it is. Thanks for that !
I find the proposal of Tomas very interesting though because in the "Preview Form" it is possible to select which page(s) I want to have printed and how many copies of it I want. Aso I can have the page(s) printed directly, without having to return to the "Print" button on the toolbar at the main program window.
My question now : would it be possible to modify your script so the result would be the opening of the window "Printing". That is the window that pops up, whenn you push the button "Print" on the left corner of the Preview Form.

Thanks in advance and have a nice weekend to everybody.

Sabine


Hi, Sabine. It was intrepid and trusting of you to try that script.

It appears to be fairly standard practice that page setup dialogs have no "print now" option. Firefox, Internet Explorer, NoteTab and LibreOffice Writer do not, for some examples. (The print preview window in all of those, however, has buttons for both page setup (except Writer) and printing -- which you would like.)

You still want the button to open the Page Setup dialog, is that correct? But in addition to that, you would like to have the Print dialog -- the one that is normally reached via a button on the Preview Form window -- maybe open automatically when the Page Setup dialog closes. Or do you want the latter only ?
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: How to create button for "Page Setup"

Postby Sabine2 » Sun Dec 11, 2011 4:47 am

Good evening Mark (it's just after 17h30 here in France),

thanks for your reply.
Yes it was intrepid of me to trust your script. Actually I waited some time with the testing, just to see if somebody (Eric or Tomas) would warn me not to try it. They didn't ! So I thought, if they trust you, why shouldn't I trust you (resp. the script) too :D .

You are right, usually there is no "Print now"-option on "page setup" dialogs (I was not really aware of that). "Print preview" windows do however (as you say).
Knowing all of this now, I would actually not need the "Page setup"-dialog but preferably a button that calls such "Print now" dialog. Exactly the little window that can be reached via the "Print"-button on the Preview Form. In this window it is possible to select a certain page of a multi-page mail to be printed and the number of copies. Also print quality, sorting, zoom etc can be set via the "Properties" button and.... it can be printed directly from here. So yes Mark.... I would prefer the latter only. I would even not need to see the Preview Form at all in the background.
I'm not at all capable to create such scripts as you do nor am I skilled to modify it, so I do fully trust on you again :) .

Again thanks sofar and have a nice evening to Canada.

Sabine
Sabine2
Drop-in Visitor
 
Posts: 10
Joined: Tue Jan 19, 2010 2:07 am
Location: France

Re: How to create button for "Page Setup"

Postby MarkB » Sun Dec 11, 2011 6:04 am

In this window it is possible to select a certain page of a multi-page mail to be printed....


Without seeing the print preview, would you know which page to select? I am wondering if opening the print preview, as Tomas suggested, might be best after all.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: How to create button for "Page Setup"

Postby Sabine2 » Sun Dec 11, 2011 8:33 am

I didn't think of that :( .
Yes your right, I wouldn't know which page to print. And yes, taking this into account probably the idea Tomas suggested seems to be the only feasible solution.
I would very much like to try it out but I don't know how to modify the script with the commands Tomas mentioned. Could you pls give me some help ?

Thanks and best regards,

Sabine
Sabine2
Drop-in Visitor
 
Posts: 10
Joined: Tue Jan 19, 2010 2:07 am
Location: France

Re: How to create button for "Page Setup"

Postby MarkB » Sun Dec 11, 2011 9:31 am

That doesn't require a script, just a command tag. Open Tools | Scripts | Buttons and in an available button, instead of selecting a script, type /menu/print, and for a description type Preview (or whatever you like).

Off topic: Now I'm going to sit in front of the television for 2 hours to watch your countrymen Nathalie Pechalat and Fabian Bourzat, among others.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: How to create button for "Page Setup"

Postby Sabine2 » Sun Dec 11, 2011 10:38 pm

Thank you very much for your help Mark. I didn't realize, that it was so easy.
Last question, do you know whether is it possible to replace the icon of the button with some other nice icon ? The "special" button shows a big number 4 and is by far not as elegant and explanatory as the other ones in the toolbar :wink:

Off topic : The Ice-show. Was it a show or was it a championship ? I personally find it very dangerous, all those jumps.... brrr..

Regards
Sabine
Sabine2
Drop-in Visitor
 
Posts: 10
Joined: Tue Jan 19, 2010 2:07 am
Location: France

Re: How to create button for "Page Setup"

Postby MarkB » Mon Dec 12, 2011 1:07 am

You're stuck with the numbered icons, I believe.

It was a competition, the final of the ISU Grand Prix of Figure Skating in Quebec City. Pechalat and Bourzat won bronze. Serious competitive skating: good. Ice shows: bad.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: How to create button for "Page Setup"

Postby Tomas » Mon Dec 12, 2011 1:43 am

Sabine2 wrote:Last question, do you know whether is it possible to replace the icon of the button with some other nice icon ? The "special" button shows a big number 4 and is by far not as elegant and explanatory as the other ones in the toolbar :wink:


There are two ways:
one might be to hack the Pocomail executable with resource editor. Not quite recommended, though it shall work.

Another is to create a skin in Pocomail. Best way to do that is to start from some existing skin, that's also how you can learn it as I don't think there is any documentation.
User action buttons are BUTTON26 to BUTTON35.

In short: in the skin folder you then edit the default.ini file, eg. for Button27 aka. User Action 1, it might include this:

[Button27]
Action=27
Left=40
Top=5
Image=server-u.bmp

Where the bmp file is the image you wish to use.

If you are comfortable playing with the above, if you encounter any problems let me know and I can check it.
Tomas
Tomas
Pillar of the Community
 
Posts: 1418
Joined: Sun Jul 25, 2004 1:34 am

Re: How to create button for "Page Setup"

Postby MarkB » Mon Dec 12, 2011 5:27 am

Yeah, I should have said, You're stuck with the numbered icons unless you're prepared to hack the Poco executable with a resource editor or modify a skin.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: How to create button for "Page Setup"

Postby Tomas » Mon Dec 12, 2011 12:56 pm

MarkB wrote:Yeah, I should have said, You're stuck with the numbered icons unless you're prepared to hack the Poco executable with a resource editor or modify a skin.


yes it's both a bit of a hack (something like me attempting skating), though the potential of the implementation coming closer to user experience comparable with the beauty of watching professional figure skating was there once (if implemented with GUI and documented fully)
Tomas
Tomas
Pillar of the Community
 
Posts: 1418
Joined: Sun Jul 25, 2004 1:34 am


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 4 guests

cron