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

Re: Macro question: place variable in Mac OS clipboard?

Expand Messages
  • em315
    That s exactly what I did in the version that I posted yesterday. I used an Applescript to prompt the user for a default zoom level; then I save it to the
    Message 1 of 14 , Mar 21, 2013
    • 0 Attachment
      That's exactly what I did in the version that I posted yesterday. I used an Applescript to prompt the user for a default zoom level; then I save it to the clipboard so that WP can copy it from the clipboard to a global variable, which is used by the OnOpenDocument macro (and a New Document Template is in the Templates folder so that new documents get the same zoom level).

      The same Applescript saves a text file that contains the zoom-level number.

      An OnStartup macro that runs when WP starts up runs an Applescript that reads the text file for the zoom-level number and copies it to the clipboard - so that the WP macro can copy the number from the clipboard to a global variable. It seems to work.

      Again, this is entirely your idea - I just banged my forehead on the trackpad until the code seemed to work.


      --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@...> wrote:
      >
      > I don't know of a way to do that. But again (see last post), I'd try to generate a value in Applescript and pass that to WP instead of the other way around.
      >
      > John R.
      >
      >
      >
      > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
      > >
      > > Now that you've answered one question, may I bother you with another:
      > >
      > > Can I use an AppleScript to get the value of a Global Variable in WordPerfect?
      > >
      > > In other words, is it possible to have an AppleScript that says something like this:
      > >
      > > tell application "WordPerfect"
      > > set myVar to GlobalVar26
      > > end tell
      > > tell me to activate
      > > display dialog myVar
      > >
      >
    • John R
      Looks like it would work fine. I d probably steer clear of the clipboard and pass the value to WP with a neutral (and in this case often helpful) macro like
      Message 2 of 14 , Mar 23, 2013
      • 0 Attachment
        Looks like it would work fine. I'd probably steer clear of the clipboard and pass the value to WP with a neutral (and in this case often helpful) macro like Redraw, adding a parameter to it that WP accepts as a script variable. Script variables 1-50 are global in scope.

        set theZoom to text returned of (display dialog "Enter zoom level:") etc.
        tell app "WordPerfect" to do script {"Redraw",theZoom)

        placing the numeric string into ScriptVar01.

        John R.


        --- In wordperfectmac@yahoogroups.com, "em315" <em315@...> wrote:
        >
        > That's exactly what I did in the version that I posted yesterday. I used an Applescript to prompt the user for a default zoom level; then I save it to the clipboard so that WP can copy it from the clipboard to a global variable, which is used by the OnOpenDocument macro (and a New Document Template is in the Templates folder so that new documents get the same zoom level).
        >
        > The same Applescript saves a text file that contains the zoom-level number.
        >
        > An OnStartup macro that runs when WP starts up runs an Applescript that reads the text file for the zoom-level number and copies it to the clipboard - so that the WP macro can copy the number from the clipboard to a global variable. It seems to work.
        >
        > Again, this is entirely your idea - I just banged my forehead on the trackpad until the code seemed to work.
        >
        >
        > --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@> wrote:
        > >
        > > I don't know of a way to do that. But again (see last post), I'd try to generate a value in Applescript and pass that to WP instead of the other way around.
        > >
        > > John R.
        > >
        > >
        > >
        > > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
        > > >
        > > > Now that you've answered one question, may I bother you with another:
        > > >
        > > > Can I use an AppleScript to get the value of a Global Variable in WordPerfect?
        > > >
        > > > In other words, is it possible to have an AppleScript that says something like this:
        > > >
        > > > tell application "WordPerfect"
        > > > set myVar to GlobalVar26
        > > > end tell
        > > > tell me to activate
        > > > display dialog myVar
        > > >
        > >
        >
      • John R
        s/b set theZoom to text returned of (display dialog Enter zoom level: ) etc. tell app WordPerfect to do script { Redraw ,theZoom} with curly brackets around
        Message 3 of 14 , Mar 23, 2013
        • 0 Attachment
          s/b

          set theZoom to text returned of (display dialog "Enter zoom level:") etc.
          tell app "WordPerfect" to do script {"Redraw",theZoom}

          with curly brackets around script name and parameters.




          --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@...> wrote:
          >
          > Looks like it would work fine. I'd probably steer clear of the clipboard and pass the value to WP with a neutral (and in this case often helpful) macro like Redraw, adding a parameter to it that WP accepts as a script variable. Script variables 1-50 are global in scope.
          >
          > set theZoom to text returned of (display dialog "Enter zoom level:") etc.
          > tell app "WordPerfect" to do script {"Redraw",theZoom)
          >
          > placing the numeric string into ScriptVar01.
          >
          > John R.
          >
          >
          > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
          > >
          > > That's exactly what I did in the version that I posted yesterday. I used an Applescript to prompt the user for a default zoom level; then I save it to the clipboard so that WP can copy it from the clipboard to a global variable, which is used by the OnOpenDocument macro (and a New Document Template is in the Templates folder so that new documents get the same zoom level).
          > >
          > > The same Applescript saves a text file that contains the zoom-level number.
          > >
          > > An OnStartup macro that runs when WP starts up runs an Applescript that reads the text file for the zoom-level number and copies it to the clipboard - so that the WP macro can copy the number from the clipboard to a global variable. It seems to work.
          > >
          > > Again, this is entirely your idea - I just banged my forehead on the trackpad until the code seemed to work.
          > >
          > >
          > > --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@> wrote:
          > > >
          > > > I don't know of a way to do that. But again (see last post), I'd try to generate a value in Applescript and pass that to WP instead of the other way around.
          > > >
          > > > John R.
          > > >
          > > >
          > > >
          > > > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
          > > > >
          > > > > Now that you've answered one question, may I bother you with another:
          > > > >
          > > > > Can I use an AppleScript to get the value of a Global Variable in WordPerfect?
          > > > >
          > > > > In other words, is it possible to have an AppleScript that says something like this:
          > > > >
          > > > > tell application "WordPerfect"
          > > > > set myVar to GlobalVar26
          > > > > end tell
          > > > > tell me to activate
          > > > > display dialog myVar
          > > > >
          > > >
          > >
          >
        • em315
          Thank you - a much better solution than mine. Will implement later...
          Message 4 of 14 , Mar 23, 2013
          • 0 Attachment
            Thank you - a much better solution than mine. Will implement later...

            --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@...> wrote:
            >
            > s/b
            >
            > set theZoom to text returned of (display dialog "Enter zoom level:") etc.
            > tell app "WordPerfect" to do script {"Redraw",theZoom}
            >
            > with curly brackets around script name and parameters.
            >
            >
            >
            >
            > --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@> wrote:
            > >
            > > Looks like it would work fine. I'd probably steer clear of the clipboard and pass the value to WP with a neutral (and in this case often helpful) macro like Redraw, adding a parameter to it that WP accepts as a script variable. Script variables 1-50 are global in scope.
            > >
            > > set theZoom to text returned of (display dialog "Enter zoom level:") etc.
            > > tell app "WordPerfect" to do script {"Redraw",theZoom)
            > >
            > > placing the numeric string into ScriptVar01.
            > >
            > > John R.
            > >
            > >
            > > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
            > > >
            > > > That's exactly what I did in the version that I posted yesterday. I used an Applescript to prompt the user for a default zoom level; then I save it to the clipboard so that WP can copy it from the clipboard to a global variable, which is used by the OnOpenDocument macro (and a New Document Template is in the Templates folder so that new documents get the same zoom level).
            > > >
            > > > The same Applescript saves a text file that contains the zoom-level number.
            > > >
            > > > An OnStartup macro that runs when WP starts up runs an Applescript that reads the text file for the zoom-level number and copies it to the clipboard - so that the WP macro can copy the number from the clipboard to a global variable. It seems to work.
            > > >
            > > > Again, this is entirely your idea - I just banged my forehead on the trackpad until the code seemed to work.
            > > >
            > > >
            > > > --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@> wrote:
            > > > >
            > > > > I don't know of a way to do that. But again (see last post), I'd try to generate a value in Applescript and pass that to WP instead of the other way around.
            > > > >
            > > > > John R.
            > > > >
            > > > >
            > > > >
            > > > > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
            > > > > >
            > > > > > Now that you've answered one question, may I bother you with another:
            > > > > >
            > > > > > Can I use an AppleScript to get the value of a Global Variable in WordPerfect?
            > > > > >
            > > > > > In other words, is it possible to have an AppleScript that says something like this:
            > > > > >
            > > > > > tell application "WordPerfect"
            > > > > > set myVar to GlobalVar26
            > > > > > end tell
            > > > > > tell me to activate
            > > > > > display dialog myVar
            > > > > >
            > > > >
            > > >
            > >
            >
          • em315
            Thanks for this suggestion. I ve now implemented your suggestion, and left the clipboard untouched, which I wanted to do all along. New version posted now. So
            Message 5 of 14 , Mar 23, 2013
            • 0 Attachment
              Thanks for this suggestion. I've now implemented your suggestion, and left the clipboard untouched, which I wanted to do all along. New version posted now.

              So basically this code is entirely yours. Thanks again.

              --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@...> wrote:
              >
              > Looks like it would work fine. I'd probably steer clear of the clipboard and pass the value to WP with a neutral (and in this case often helpful) macro like Redraw, adding a parameter to it that WP accepts as a script variable. Script variables 1-50 are global in scope.
              >
              > set theZoom to text returned of (display dialog "Enter zoom level:") etc.
              > tell app "WordPerfect" to do script {"Redraw",theZoom)
              >
              > placing the numeric string into ScriptVar01.
              >
              > John R.
              >
              >
              > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
              > >
              > > That's exactly what I did in the version that I posted yesterday. I used an Applescript to prompt the user for a default zoom level; then I save it to the clipboard so that WP can copy it from the clipboard to a global variable, which is used by the OnOpenDocument macro (and a New Document Template is in the Templates folder so that new documents get the same zoom level).
              > >
              > > The same Applescript saves a text file that contains the zoom-level number.
              > >
              > > An OnStartup macro that runs when WP starts up runs an Applescript that reads the text file for the zoom-level number and copies it to the clipboard - so that the WP macro can copy the number from the clipboard to a global variable. It seems to work.
              > >
              > > Again, this is entirely your idea - I just banged my forehead on the trackpad until the code seemed to work.
              > >
              > >
              > > --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@> wrote:
              > > >
              > > > I don't know of a way to do that. But again (see last post), I'd try to generate a value in Applescript and pass that to WP instead of the other way around.
              > > >
              > > > John R.
              > > >
              > > >
              > > >
              > > > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
              > > > >
              > > > > Now that you've answered one question, may I bother you with another:
              > > > >
              > > > > Can I use an AppleScript to get the value of a Global Variable in WordPerfect?
              > > > >
              > > > > In other words, is it possible to have an AppleScript that says something like this:
              > > > >
              > > > > tell application "WordPerfect"
              > > > > set myVar to GlobalVar26
              > > > > end tell
              > > > > tell me to activate
              > > > > display dialog myVar
              > > > >
              > > >
              > >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.