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

Re: WPMac macro question

Expand Messages
  • John R
    ... Any window, or a window of a given name?
    Message 1 of 15 , Nov 20, 2012
    • 0 Attachment
      --- In wordperfectmac@yahoogroups.com, "em315" <em315@...> wrote:

      > Macro question: what is the IF THEN statement that checks whether a window is open in WPMac, so that a PDF-writing macro will refuse to run if there is no document open to "print" to PDF?

      Any window, or a window of a given name?
    • John R
      ... To check for any open window in WP: If (NumberOfWindows
      Message 2 of 15 , Nov 20, 2012
      • 0 Attachment
        --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@...> wrote:
        >
        > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
        >
        > > Macro question: what is the IF THEN statement that checks whether a window is open in WPMac, so that a PDF-writing macro will refuse to run if there is no document open to "print" to PDF?
        >
        > Any window, or a window of a given name?


        To check for any open window in WP:

        If (NumberOfWindows<1)
        ; no windows open
        End If


        To check for a window of a given name:

        On Error (error)
        Select Window ("OpenPDF")
        Alert ("You got it")
        Go (further)
        Label (error)
        Alert ("No such window as OpenPDF")
        Return
        ;
        Label (further)
        Alert ("Macro continues here")
      • em315
        The IF... statement was what I needed. Thank you. After adding it to the macro I was already using, I got this: If (NumberOfWindows 0) New Document Type (a)
        Message 3 of 15 , Nov 21, 2012
        • 0 Attachment
          The IF... statement was what I needed. Thank you. After adding it to the macro I was already using, I got this:

          If (NumberOfWindows>0)
          New Document
          Type (a)
          Save As ("WPMac HD:System Folder:WPMacAppData:OpenPDF.file")
          Close
          Print Options (1;32000;1;Document;Every Page;Forward;Print Overlay)
          Print (Document)
          Else
          Alert ("No document window open.")
          End If

          Sometime over the next few days, I'll try to add an opening menu ("Create a PDF file and open it in Preview?") and work on the OS X folder action script to refine it a bit. My guess is that you could do this far more elegantly than I ever will!

          --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@...> wrote:
          >
          > --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@> wrote:
          > >
          > > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
          > >
          > > > Macro question: what is the IF THEN statement that checks whether a window is open in WPMac, so that a PDF-writing macro will refuse to run if there is no document open to "print" to PDF?
          > >
          > > Any window, or a window of a given name?
          >
          >
          > To check for any open window in WP:
          >
          > If (NumberOfWindows<1)
          > ; no windows open
          > End If
          >
          >
          > To check for a window of a given name:
          >
          > On Error (error)
          > Select Window ("OpenPDF")
          > Alert ("You got it")
          > Go (further)
          > Label (error)
          > Alert ("No such window as OpenPDF")
          > Return
          > ;
          > Label (further)
          > Alert ("Macro continues here")
          >
        • em315
          One more WP macro question: Can a WP macro select a printer? Or does that require running an Applescript? Thanks!
          Message 4 of 15 , Nov 21, 2012
          • 0 Attachment
            One more WP macro question:

            Can a WP macro select a printer? Or does that require running an Applescript?

            Thanks!
          • John R
            A WP macro by itself can t select a printer. A macro can call an Applescript though: ;macro code Execute Apple Script ( name of script ) with only the name: WP
            Message 5 of 15 , Nov 21, 2012
            • 0 Attachment
              A WP macro by itself can't select a printer. A macro can call an Applescript though:

              ;macro code
              Execute Apple Script ("name of script")

              with only the name: WP will find it and run it from any mounted volume.



              --- In wordperfectmac@yahoogroups.com, "em315" <em315@...> wrote:
              >
              > One more WP macro question:
              >
              > Can a WP macro select a printer? Or does that require running an Applescript?
              >
              > Thanks!
              >
            • em315
              Hello John, Here s a curious thing about WP macros, and I wonder if you know a solution. The macro I m working on prints the current document to a virtual
              Message 6 of 15 , Nov 21, 2012
              • 0 Attachment
                Hello John,

                Here's a curious thing about WP macros, and I wonder if you know a solution.

                The macro I'm working on prints the current document to a virtual printer. When I print the document manually, the print file takes the name of the document, followed by .ps. For example, if the document is titled "The Meaning of Life", then the print file is saved as "The Meaning of Life.ps".

                But when a macro includes the Print command, the print file is named "untitled.ps", not "The Meaning of Life.ps".

                Is there a way to force the Print command in the macro write the print file with the name of the document?

                Thanks for any advice on this - and Happy Thanksgiving to all who celebrate the US variety of Thanksgiving.
              • John R
                That appears to be a program artifact. The WP macro command Rename File could fix the file once it s written. John R.
                Message 7 of 15 , Nov 23, 2012
                • 0 Attachment
                  That appears to be a program artifact. The WP macro command Rename File could fix the file once it's written.

                  John R.




                  --- In wordperfectmac@yahoogroups.com, "em315" <em315@...> wrote:
                  >
                  > Hello John,
                  >
                  > Here's a curious thing about WP macros, and I wonder if you know a solution.
                  >
                  > The macro I'm working on prints the current document to a virtual printer. When I print the document manually, the print file takes the name of the document, followed by .ps. For example, if the document is titled "The Meaning of Life", then the print file is saved as "The Meaning of Life.ps".
                  >
                  > But when a macro includes the Print command, the print file is named "untitled.ps", not "The Meaning of Life.ps".
                  >
                  > Is there a way to force the Print command in the macro write the print file with the name of the document?
                  >
                  > Thanks for any advice on this - and Happy Thanksgiving to all who celebrate the US variety of Thanksgiving.
                  >
                • em315
                  One more question, which I m only asking because the Scripting Guide and help file doesn t give an answer. When you Save As... in Text format, a prompt appears
                  Message 8 of 15 , Nov 23, 2012
                  • 0 Attachment
                    One more question, which I'm only asking because the Scripting Guide and help file doesn't give an answer.

                    When you Save As... in Text format, a prompt appears asking which text format to use. Is there any way to respond to that prompt in a script?

                    --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@...> wrote:
                    >
                    > That appears to be a program artifact. The WP macro command Rename File could fix the file once it's written.
                    >
                    > John R.
                    >
                    >
                    >
                    >
                    > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
                    > >
                    > > Hello John,
                    > >
                    > > Here's a curious thing about WP macros, and I wonder if you know a solution.
                    > >
                    > > The macro I'm working on prints the current document to a virtual printer. When I print the document manually, the print file takes the name of the document, followed by .ps. For example, if the document is titled "The Meaning of Life", then the print file is saved as "The Meaning of Life.ps".
                    > >
                    > > But when a macro includes the Print command, the print file is named "untitled.ps", not "The Meaning of Life.ps".
                    > >
                    > > Is there a way to force the Print command in the macro write the print file with the name of the document?
                    > >
                    > > Thanks for any advice on this - and Happy Thanksgiving to all who celebrate the US variety of Thanksgiving.
                    > >
                    >
                  • John R
                    I have looked for a way to script that, and can t find one. I haven t tried Prefab Player though.
                    Message 9 of 15 , Nov 23, 2012
                    • 0 Attachment
                      I have looked for a way to script that, and can't find one. I haven't tried Prefab Player though.



                      --- In wordperfectmac@yahoogroups.com, "em315" <em315@...> wrote:
                      >
                      > One more question, which I'm only asking because the Scripting Guide and help file doesn't give an answer.
                      >
                      > When you Save As... in Text format, a prompt appears asking which text format to use. Is there any way to respond to that prompt in a script?
                      >
                      > --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@> wrote:
                      > >
                      > > That appears to be a program artifact. The WP macro command Rename File could fix the file once it's written.
                      > >
                      > > John R.
                      > >
                      > >
                      > >
                      > >
                      > > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
                      > > >
                      > > > Hello John,
                      > > >
                      > > > Here's a curious thing about WP macros, and I wonder if you know a solution.
                      > > >
                      > > > The macro I'm working on prints the current document to a virtual printer. When I print the document manually, the print file takes the name of the document, followed by .ps. For example, if the document is titled "The Meaning of Life", then the print file is saved as "The Meaning of Life.ps".
                      > > >
                      > > > But when a macro includes the Print command, the print file is named "untitled.ps", not "The Meaning of Life.ps".
                      > > >
                      > > > Is there a way to force the Print command in the macro write the print file with the name of the document?
                      > > >
                      > > > Thanks for any advice on this - and Happy Thanksgiving to all who celebrate the US variety of Thanksgiving.
                      > > >
                      > >
                      >
                    • em315
                      I worked around it in the latest version of my system (posted a few hours ago) by saving an RTF file with the name of the current document, then (in OS X)
                      Message 10 of 15 , Nov 24, 2012
                      • 0 Attachment
                        I worked around it in the latest version of my system (posted a few hours ago) by saving an RTF file with the name of the current document, then (in OS X) converting that file to text and reading its contents, and applying that name to the output PDF. I'm not sure I've got the timing right, but it seems to work.

                        --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@...> wrote:
                        >
                        > I have looked for a way to script that, and can't find one. I haven't tried Prefab Player though.
                        >
                        >
                        >
                        > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
                        > >
                        > > One more question, which I'm only asking because the Scripting Guide and help file doesn't give an answer.
                        > >
                        > > When you Save As... in Text format, a prompt appears asking which text format to use. Is there any way to respond to that prompt in a script?
                        > >
                        > > --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@> wrote:
                        > > >
                        > > > That appears to be a program artifact. The WP macro command Rename File could fix the file once it's written.
                        > > >
                        > > > John R.
                        > > >
                        > > >
                        > > >
                        > > >
                        > > > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
                        > > > >
                        > > > > Hello John,
                        > > > >
                        > > > > Here's a curious thing about WP macros, and I wonder if you know a solution.
                        > > > >
                        > > > > The macro I'm working on prints the current document to a virtual printer. When I print the document manually, the print file takes the name of the document, followed by .ps. For example, if the document is titled "The Meaning of Life", then the print file is saved as "The Meaning of Life.ps".
                        > > > >
                        > > > > But when a macro includes the Print command, the print file is named "untitled.ps", not "The Meaning of Life.ps".
                        > > > >
                        > > > > Is there a way to force the Print command in the macro write the print file with the name of the document?
                        > > > >
                        > > > > Thanks for any advice on this - and Happy Thanksgiving to all who celebrate the US variety of Thanksgiving.
                        > > > >
                        > > >
                        > >
                        >
                      Your message has been successfully submitted and would be delivered to recipients shortly.