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

Re: Macro question: possible to create an array variable?

Expand Messages
  • em315
    Here s an alternative (devised by a visitor to the www.wpuniverse.com for WPDOS 5.1) that I ve adapted for WPMac. In effect, it creates an array, with each
    Message 1 of 5 , Apr 3, 2011
    • 0 Attachment
      Here's an alternative (devised by a visitor to the www.wpuniverse.com for WPDOS 5.1) that I've adapted for WPMac. In effect, it creates an array, with each alternate item the Find string, then the Change string. Is there a way to divide the For Each line into multiple lines for clarity?

      Goto Top of Document
      Assign (Var21;"0")
      For Each (Var00;{"abc";"123";"def";"456"})
      If (Var21="0")
      Assign (Var30;Var00)
      Assign (Var21;"1")
      Else
      Assign (Var31;Var00)
      Goto Top of Document
      Find String (Var30)
      Change String (Var31)
      Change All
      Assign (Var21;"0")
      End If
      End For


      --- In wordperfectmac@yahoogroups.com, "em315" <em315@...> wrote:
      >
      > Thank you, John - that should have been obvious to me, but it wasn't. I'll revise the macro tonight or tomorrow and will revise the upload.
      >
      > --- In wordperfectmac@yahoogroups.com, "John R" <johnrethorst@> wrote:
      > >
      > >
      > >
      > > Most of the commands only need to be given once, with Find/Change Direction as Wrap Around as you have. Then I'd just do
      > >
      > > Find String ("abc")
      > > Change String ("def")
      > > Change All
      > > ;
      > > Find String ("ghi")
      > > Change String ("jkl")
      > > Change All
      > >
      > > John R.
      > >
      > >
      > >
      > > --- In wordperfectmac@yahoogroups.com, "em315" <em315@> wrote:
      > > >
      > > > Here's a question for the macro experts:
      > > >
      > > > For a converter program I'm working on (it converts other formats into WP format), I've written a WP macro that finds and replaces ten different strings.
      > > >
      > > > I've written the macro in the least efficient possible way, in a series of blocks that look like this:
      > > >
      > > > ; Change opening single quote
      > > > Find/Change Direction (Forward;Wrap Around)
      > > > Find/Change Where ({All})
      > > > Find/Change Match (Partial Word;Case Insensitive;Alphabet Insensitive;CharRep Insensitive;{Text Only})
      > > > Find/Change Affect (Affect Case;{Text Only})
      > > > Find/Change Action (Select Match)
      > > > Find String ("â_˜")
      > > > Change String ("`")
      > > > Change All
      > > >
      > > > Two issues:
      > > >
      > > > First, is it possible to create two arrays, one with the Find strings, the other with the Change strings, and use a For Each/End For loop to replace the strings in the first array with the strings in the second array? I know how to do this in WPDOS and WPWin, but I can't see how to do it in WPMac.
      > > >
      > > > Second, how much of that block of commands can be omitted without affecting the results?
      > > >
      > > > Thanks for any help with this.
      > > >
      > >
      >
    • John R
      Not that I know of. John R.
      Message 2 of 5 , Apr 4, 2011
      • 0 Attachment
        Not that I know of.

        John R.


        --- In wordperfectmac@yahoogroups.com, "em315" <em315@...> wrote:
        >
        > Here's an alternative (devised by a visitor to the www.wpuniverse.com for WPDOS 5.1) that I've adapted for WPMac. In effect, it creates an array, with each alternate item the Find string, then the Change string. Is there a way to divide the For Each line into multiple lines for clarity?
        >
        > Goto Top of Document
        > Assign (Var21;"0")
        > For Each (Var00;{"abc";"123";"def";"456"})
        > If (Var21="0")
        > Assign (Var30;Var00)
        > Assign (Var21;"1")
        > Else
        > Assign (Var31;Var00)
        > Goto Top of Document
        > Find String (Var30)
        > Change String (Var31)
        > Change All
        > Assign (Var21;"0")
        > End If
        > End For
      Your message has been successfully submitted and would be delivered to recipients shortly.