Loading ...
Sorry, an error occurred while loading the content.

Re: Simple printing "patch" for MacVim

Expand Messages
  • Steven Michalske
    automator to the rescue --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_mac maillist. For more information,
    Message 1 of 26 , Jul 1, 2008
    • 0 Attachment
      automator to the rescue


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • björn
      ... That s a pretty neat idea too. I m guessing most people would expect a print dialog box though (I would) so in that sense I think Nico s idea is slightly
      Message 2 of 26 , Jul 2, 2008
      • 0 Attachment
        2008/7/2 Steven Michalske <smichalske@...>:
        > automator to the rescue
        >
        > then you would set the printing command to:
        >
        > automator -i FILE_NAME_HERE ~/Documents/printToOreo.workflow
        >
        > here in automator.app I set it to my preferred printer, your other
        > option is to use the default printer.
        >
        > it wont show a print dialog box.... but it works.

        That's a pretty neat idea too. I'm guessing most people would expect
        a print dialog box though (I would) so in that sense I think Nico's
        idea is slightly better. What do other people think?

        Björn

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_mac" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Nico Weber
        ... I prefer opening the file in Preview. As far as I understand the automator action does not give any visual feedback (?), which is confusing to me. Nico
        Message 3 of 26 , Jul 2, 2008
        • 0 Attachment
          >> automator to the rescue
          >>
          >> then you would set the printing command to:
          >>
          >> automator -i FILE_NAME_HERE ~/Documents/printToOreo.workflow
          >>
          >> here in automator.app I set it to my preferred printer, your other
          >> option is to use the default printer.
          >>
          >> it wont show a print dialog box.... but it works.
          >
          > That's a pretty neat idea too. I'm guessing most people would expect
          > a print dialog box though (I would) so in that sense I think Nico's
          > idea is slightly better. What do other people think?

          I prefer opening the file in Preview. As far as I understand the
          automator action does not give any visual feedback (?), which is
          confusing to me.

          Nico

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Matt Tolton
          ... I also prefer opening the file in preview. --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_mac maillist. For
          Message 4 of 26 , Jul 2, 2008
          • 0 Attachment
            >> That's a pretty neat idea too. I'm guessing most people would expect
            >> a print dialog box though (I would) so in that sense I think Nico's
            >> idea is slightly better. What do other people think?
            >
            > I prefer opening the file in Preview. As far as I understand the
            > automator action does not give any visual feedback (?), which is
            > confusing to me.

            I also prefer opening the file in preview.

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_mac" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Steven Michalske
            under the print finder items action s options you can turn on show this action check box. This will put a simple dialog box on the screen with the option to
            Message 5 of 26 , Jul 2, 2008
            • 0 Attachment
              under the print finder items action's options you can turn on show
              this action check box.

              This will put a simple dialog box on the screen with the option to
              select the printer.

              With hardcopy on my linux installs I don't get feedback..... it just
              prints.....

              to monitor status of large jobs, the printer dialog box will be in
              your dock till the job is sent to the printer.

              :-)

              hardkrash

              On Jul 2, 2008, at 1:43 PM, Nico Weber wrote:

              >
              >>> automator to the rescue
              >>>
              >>> then you would set the printing command to:
              >>>
              >>> automator -i FILE_NAME_HERE ~/Documents/printToOreo.workflow
              >>>
              >>> here in automator.app I set it to my preferred printer, your other
              >>> option is to use the default printer.
              >>>
              >>> it wont show a print dialog box.... but it works.
              >>
              >> That's a pretty neat idea too. I'm guessing most people would expect
              >> a print dialog box though (I would) so in that sense I think Nico's
              >> idea is slightly better. What do other people think?
              >
              > I prefer opening the file in Preview. As far as I understand the
              > automator action does not give any visual feedback (?), which is
              > confusing to me.
              >
              > Nico
              >
              > >


              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_mac" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Steven Michalske
              install the workfolw to ~/.vim and set this printexpr=system( automator -i .v:fname_in. ~/.vim/print.workflow ) edit the workflow s options for the option
              Message 6 of 26 , Jul 2, 2008
              • 0 Attachment
                install the workfolw to ~/.vim

                and set this

                printexpr=system('automator\ -i\ '.v:fname_in.'\ ~/.vim/print.workflow')

                edit the workflow's options for the option for it to ask you for which
                printer to use.

                hardkrash

                On Jul 2, 2008, at 10:25 PM, Steven Michalske wrote:

                > under the print finder items action's options you can turn on show
                > this action check box.
                >
                > This will put a simple dialog box on the screen with the option to
                > select the printer.
                >
                > With hardcopy on my linux installs I don't get feedback..... it
                > just prints.....
                >
                > to monitor status of large jobs, the printer dialog box will be in
                > your dock till the job is sent to the printer.
                >
                > :-)
                >
                > hardkrash
                >
                > On Jul 2, 2008, at 1:43 PM, Nico Weber wrote:
                >
                >>
                >>>> automator to the rescue
                >>>>
                >>>> then you would set the printing command to:
                >>>>
                >>>> automator -i FILE_NAME_HERE ~/Documents/printToOreo.workflow
                >>>>
                >>>> here in automator.app I set it to my preferred printer, your other
                >>>> option is to use the default printer.
                >>>>
                >>>> it wont show a print dialog box.... but it works.
                >>>
                >>> That's a pretty neat idea too. I'm guessing most people would
                >>> expect
                >>> a print dialog box though (I would) so in that sense I think Nico's
                >>> idea is slightly better. What do other people think?
                >>
                >> I prefer opening the file in Preview. As far as I understand the
                >> automator action does not give any visual feedback (?), which is
                >> confusing to me.
                >>
                >> Nico
                >>
                >> >>
                >


                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_mac" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • björn
                ... That is much better, but I still prefer being able to see the file to be printed in Preview first. Attached is a patch that builds on both Nico s and
                Message 7 of 26 , Jul 3, 2008
                • 0 Attachment
                  2008/7/3 Steven Michalske <smichalske@...>:
                  >
                  > install the workfolw to ~/.vim
                  >
                  > and set this
                  >
                  > printexpr=system('automator\ -i\ '.v:fname_in.'\ ~/.vim/print.workflow')
                  >
                  > edit the workflow's options for the option for it to ask you for which
                  > printer to use.

                  That is much better, but I still prefer being able to see the file to
                  be printed in Preview first. Attached is a patch that builds on both
                  Nico's and Steven's ideas. Automator is used to open the file from
                  :hardcopy in Preview, then the it deletes the temporary file.

                  Two nuisances:

                  1. Preview doesn't always get the focus
                  2. When quitting Preview you get a dialog box asking if you want to
                  save the pdf since it converted the ps that :hardcopy generated

                  Can somebody please test the attached patch before I merge this into
                  the public repo?

                  Thanks,
                  Björn

                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_mac" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • Nico Weber
                  Hi, ... (2.) happens with the system( open ) call as well. ... Seems to work over here. Does the automator action guarantee that Open Finder Items does not
                  Message 8 of 26 , Jul 3, 2008
                  • 0 Attachment
                    Hi,

                    > Two nuisances:
                    >
                    > 1. Preview doesn't always get the focus
                    > 2. When quitting Preview you get a dialog box asking if you want to
                    > save the pdf since it converted the ps that :hardcopy generated

                    (2.) happens with the system('open') call as well.

                    > Can somebody please test the attached patch before I merge this into
                    > the public repo?

                    Seems to work over here. Does the automator action guarantee that
                    "Open Finder Items" does not return until the file is opened? If not,
                    this has the same problem as using system('open') and then deleting
                    the file (with the difference that automator is several orders of
                    magnitude slower, so that the problem is not observable). Hm, it works
                    with a 82 pages document (6000 lines of 'aaaaaaaa'), so this is
                    probably ok.

                    >

                    It's a bit sad that this has to be 5k what could be a 120 byte change.
                    But who cares about 5k these days :-P

                    Nico

                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_mac" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Matt Tolton
                    ... TBH, I think that the automator solution is more complex than necessary for this task. Why aren t we doing something like this: set
                    Message 9 of 26 , Jul 3, 2008
                    • 0 Attachment
                      > It's a bit sad that this has to be 5k what could be a 120 byte change.
                      > But who cares about 5k these days :-P

                      TBH, I think that the automator solution is more complex than
                      necessary for this task. Why aren't we doing something like this:

                      set printexpr=system('(open\ -a\ Preview\ '.v:fname_in.';sleep\ 60;rm\
                      '.v:fname_in.')&')

                      Matt

                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_mac" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    • Frank Hellenkamp
                      Hi, ... And what about: set printexpr=system( (ps2pdf .v:fname_in. .v:fname_in. .pdf;open -a Preview .v:fname_in. .pdf;sleep 60;rm
                      Message 10 of 26 , Jul 3, 2008
                      • 0 Attachment
                        Hi,

                        >> It's a bit sad that this has to be 5k what could be a 120 byte change.
                        >> But who cares about 5k these days :-P
                        >
                        > TBH, I think that the automator solution is more complex than
                        > necessary for this task. Why aren't we doing something like this:
                        >
                        > set printexpr=system('(open\ -a\ Preview\ '.v:fname_in.';sleep\ 60;rm\
                        > '.v:fname_in.')&')

                        And what about:

                        set printexpr=system('(ps2pdf\ '.v:fname_in.'\ '.v:fname_in.'.pdf;open\
                        -a\ Preview\ '.v:fname_in.'.pdf;sleep\ 60;rm\ '.v:fname_in.';rm\
                        '.v:fname_in.'.pdf)&')

                        It first converts the postscript to pdf, so you won't be asked to save
                        the file.


                        Frank

                        --
                        frank hellenkamp | interface designer
                        jonas.info@... | mail
                        +49.30.49 78 20 70 | tel
                        +49.173.70 55 781 | mbl
                        +49.1805.4002.243 912 | fax
                      • Matt Tolton
                        ... Don t you have to have ghostscript installed to have ps2pdf on your system? --~--~---------~--~----~------------~-------~--~----~ You received this message
                        Message 11 of 26 , Jul 4, 2008
                        • 0 Attachment
                          > set printexpr=system('(ps2pdf\ '.v:fname_in.'\ '.v:fname_in.'.pdf;open\ -a\
                          > Preview\ '.v:fname_in.'.pdf;sleep\ 60;rm\ '.v:fname_in.';rm\
                          > '.v:fname_in.'.pdf)&')

                          Don't you have to have ghostscript installed to have ps2pdf on your system?

                          --~--~---------~--~----~------------~-------~--~----~
                          You received this message from the "vim_mac" maillist.
                          For more information, visit http://www.vim.org/maillist.php
                          -~----------~----~----~----~------~----~------~--~---
                        • Nico Weber
                          ... That deletes the pdf after 60 seconds as well. I don t know if Preview is happy about that. Nico --~--~---------~--~----~------------~-------~--~----~ You
                          Message 12 of 26 , Jul 4, 2008
                          • 0 Attachment
                            >>> It's a bit sad that this has to be 5k what could be a 120 byte
                            >>> change.
                            >>> But who cares about 5k these days :-P
                            >> TBH, I think that the automator solution is more complex than
                            >> necessary for this task. Why aren't we doing something like this:
                            >> set printexpr=system('(open\ -a\ Preview\ '.v:fname_in.';sleep\
                            >> 60;rm\
                            >> '.v:fname_in.')&')
                            >
                            > And what about:
                            >
                            > set printexpr=system('(ps2pdf\ '.v:fname_in.'\
                            > '.v:fname_in.'.pdf;open\ -a\ Preview\ '.v:fname_in.'.pdf;sleep\ 60;rm
                            > \ '.v:fname_in.';rm\ '.v:fname_in.'.pdf)&')
                            >
                            > It first converts the postscript to pdf, so you won't be asked to
                            > save the file.

                            That deletes the pdf after 60 seconds as well. I don't know if Preview
                            is happy about that.

                            Nico

                            --~--~---------~--~----~------------~-------~--~----~
                            You received this message from the "vim_mac" maillist.
                            For more information, visit http://www.vim.org/maillist.php
                            -~----------~----~----~----~------~----~------~--~---
                          • Nico Weber
                            ... This fails if Preview takes more than 60 seconds to open the file (entirely reasonable on my iBook when lots of other programs are open). The automator
                            Message 13 of 26 , Jul 4, 2008
                            • 0 Attachment
                              >> It's a bit sad that this has to be 5k what could be a 120 byte
                              >> change.
                              >> But who cares about 5k these days :-P
                              >
                              > TBH, I think that the automator solution is more complex than
                              > necessary for this task. Why aren't we doing something like this:
                              >
                              > set printexpr=system('(open\ -a\ Preview\ '.v:fname_in.';sleep\ 60;rm\
                              > '.v:fname_in.')&')

                              This fails if Preview takes more than 60 seconds to open the file
                              (entirely reasonable on my iBook when lots of other programs are
                              open). The automator solution seems to work fine, and while it's a bit
                              complex, it (seemingly) works reliably.

                              Nico

                              --~--~---------~--~----~------------~-------~--~----~
                              You received this message from the "vim_mac" maillist.
                              For more information, visit http://www.vim.org/maillist.php
                              -~----------~----~----~----~------~----~------~--~---
                            • Frank Hellenkamp
                              ... I have a ps2pdf in /usr/bin/ so I *think* it s part of the system (I m not sure.) Have someone a clean system without that much fiddling, which I have done
                              Message 14 of 26 , Jul 4, 2008
                              • 0 Attachment
                                >> set printexpr=system('(ps2pdf\ '.v:fname_in.'\ '.v:fname_in.'.pdf;open\ -a\
                                >> Preview\ '.v:fname_in.'.pdf;sleep\ 60;rm\ '.v:fname_in.';rm\
                                >> '.v:fname_in.'.pdf)&')
                                >
                                > Don't you have to have ghostscript installed to have ps2pdf on your system?

                                I have a ps2pdf in /usr/bin/ so I *think* it's part of the system (I'm
                                not sure.)

                                Have someone a clean system without that much fiddling, which I have
                                done with mine?

                                I *have* an extra ghostscript install but it's in /opt/local/bin/,
                                because it's a macports install.


                                Frank

                                --
                                frank hellenkamp | interface designer
                                jonas.info@... | mail
                                +49.30.49 78 20 70 | tel
                                +49.173.70 55 781 | mbl
                                +49.1805.4002.243 912 | fax
                              • Frank Hellenkamp
                                ... The thing is, that the automator workflow in itself eats much resources, and thereof takes longer. The simpler scripting solution works much faster on my
                                Message 15 of 26 , Jul 4, 2008
                                • 0 Attachment
                                  >>> It's a bit sad that this has to be 5k what could be a 120 byte
                                  >>> change.
                                  >>> But who cares about 5k these days :-P
                                  >> TBH, I think that the automator solution is more complex than
                                  >> necessary for this task. Why aren't we doing something like this:
                                  >>
                                  >> set printexpr=system('(open\ -a\ Preview\ '.v:fname_in.';sleep\ 60;rm\
                                  >> '.v:fname_in.')&')
                                  >
                                  > This fails if Preview takes more than 60 seconds to open the file
                                  > (entirely reasonable on my iBook when lots of other programs are
                                  > open). The automator solution seems to work fine, and while it's a bit
                                  > complex, it (seemingly) works reliably.

                                  The thing is, that the automator workflow in itself eats much resources,
                                  and thereof takes longer. The simpler scripting solution works much
                                  faster on my g4 powerbook, than the automator-solution.

                                  So it depends. We could wait much longer than 60 seconds, but sure, it
                                  is a hack, and you will have an extra process in the background for that
                                  time.


                                  Frank

                                  --
                                  frank hellenkamp | interface designer
                                  jonas.info@... | mail
                                  +49.30.49 78 20 70 | tel
                                  +49.173.70 55 781 | mbl
                                  +49.1805.4002.243 912 | fax
                                • Frank Hellenkamp
                                  ... That won t be a problem, when the file is open. The actual file won t be removed from the filesystem until it s closed. Frank -- frank hellenkamp |
                                  Message 16 of 26 , Jul 4, 2008
                                  • 0 Attachment
                                    >>>> It's a bit sad that this has to be 5k what could be a 120 byte
                                    >>>> change.
                                    >>>> But who cares about 5k these days :-P
                                    >>> TBH, I think that the automator solution is more complex than
                                    >>> necessary for this task. Why aren't we doing something like this:
                                    >>> set printexpr=system('(open\ -a\ Preview\ '.v:fname_in.';sleep\
                                    >>> 60;rm\
                                    >>> '.v:fname_in.')&')
                                    >> And what about:
                                    >>
                                    >> set printexpr=system('(ps2pdf\ '.v:fname_in.'\
                                    >> '.v:fname_in.'.pdf;open\ -a\ Preview\ '.v:fname_in.'.pdf;sleep\ 60;rm
                                    >> \ '.v:fname_in.';rm\ '.v:fname_in.'.pdf)&')
                                    >>
                                    >> It first converts the postscript to pdf, so you won't be asked to
                                    >> save the file.
                                    >
                                    > That deletes the pdf after 60 seconds as well. I don't know if Preview
                                    > is happy about that.

                                    That won't be a problem, when the file is open. The actual file won't be
                                    removed from the filesystem until it's closed.


                                    Frank

                                    --
                                    frank hellenkamp | interface designer
                                    jonas.info@... | mail
                                    +49.30.49 78 20 70 | tel
                                    +49.173.70 55 781 | mbl
                                    +49.1805.4002.243 912 | fax
                                  • Matt Tolton
                                    ... Let s just not delete the file, then. It will be cleared after awhile, anyway. The automator solution is slower, and it is overkill.
                                    Message 17 of 26 , Jul 4, 2008
                                    • 0 Attachment
                                      > This fails if Preview takes more than 60 seconds to open the file
                                      > (entirely reasonable on my iBook when lots of other programs are
                                      > open). The automator solution seems to work fine, and while it's a bit
                                      > complex, it (seemingly) works reliably.

                                      Let's just not delete the file, then. It will be cleared after
                                      awhile, anyway. The automator solution is slower, and it is overkill.

                                      --~--~---------~--~----~------------~-------~--~----~
                                      You received this message from the "vim_mac" maillist.
                                      For more information, visit http://www.vim.org/maillist.php
                                      -~----------~----~----~----~------~----~------~--~---
                                    • Matt Tolton
                                      ... I don t have ps2pdf on my system. However, I poked around a bit and found pstopdf, which DOES look like it is distributed with OS X.
                                      Message 18 of 26 , Jul 4, 2008
                                      • 0 Attachment
                                        > I have a ps2pdf in /usr/bin/ so I *think* it's part of the system (I'm not
                                        > sure.)

                                        I don't have ps2pdf on my system. However, I poked around a bit and
                                        found pstopdf, which DOES look like it is distributed with OS X.

                                        --~--~---------~--~----~------------~-------~--~----~
                                        You received this message from the "vim_mac" maillist.
                                        For more information, visit http://www.vim.org/maillist.php
                                        -~----------~----~----~----~------~----~------~--~---
                                      • björn
                                        Hi, I ve pushed a patch which uses Nico s original suggestion without the delete , i.e. just open the file in Preview and let it handle conversion to pdf.
                                        Message 19 of 26 , Jul 5, 2008
                                        • 0 Attachment
                                          Hi,

                                          I've pushed a patch which uses Nico's original suggestion without the
                                          "delete", i.e. just open the file in Preview and let it handle
                                          conversion to pdf.

                                          Although pstopdf is installed by default on both 10.4 and 10.5 it does
                                          not give the user any feedback that its processing the file. This is
                                          weird when you're trying to print a large file because it seems like
                                          nothing is happening. So using that is out.

                                          Lots of people think using Automator is overkill. I agree. For now
                                          we'll rely on OS X to delete the temp files for us. I guess this
                                          could create problems if somebody never reboots their computer and
                                          prints large documents several times a day, each day of the year.
                                          When that user complains we may already have implemented a nicer
                                          printing system so that we may smugly reply "download the latest
                                          release!". (One can always hope!)

                                          Björn

                                          --~--~---------~--~----~------------~-------~--~----~
                                          You received this message from the "vim_mac" maillist.
                                          For more information, visit http://www.vim.org/maillist.php
                                          -~----------~----~----~----~------~----~------~--~---
                                        Your message has been successfully submitted and would be delivered to recipients shortly.