Create copies of code part with increasing numbers

Create copies of code part with increasing numbers

1
NewbieNewbie
1

    May 29, 2007#1

    I've never messed with macros in UE before, 'til this need... The documentation isn't giving me much of an idea on how to do this, but it can't be that difficult, surely.

    Basically, I need to duplicate this piece of code 750 times, incrementing the numbered variable each time (aren't scripting languages without arrays wonderful?).

    Code: Select all

    elseif ( tltravvars.trav002 == 0 )
    	set tltravvars.trav002 to newtrav
    Thanks in advance. :)

    262
    MasterMaster
    262

      May 30, 2007#2

      First you go and get Mofis macro examples which you can download from the sticky in the macro section of the forum. We need Mofis excellent CountUp macro.

      Then try this macro:

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Clipboard 0
      Loop 750
      "elseif ( tltravvars.trav000 == 0 )
         set tltravvars.trav000 to newtrav
      "
      Key HOME
      EndLoop
      Top
      Find "000"
      Copy 
      Top
      Loop 
      Find "000"
      IfNotFound
      ExitLoop
      EndIf
      PlayMacro 1 "CountUp"
      Find "000"
      IfNotFound
      ExitLoop
      EndIf
      Paste 
      EndLoop

      6,604548
      Grand MasterGrand Master
      6,604548

        May 30, 2007#3

        I think for this simple job following macro is better because it is much faster.

        InsertMode
        ColumnModeOff
        HexOff
        NewFile
        Clipboard 9
        Loop 10
        "elseif ( tltravvars.trav == 0 )#!#   set tltravvars.trav to newtrav
        "
        EndLoop
        SelectAll
        Copy
        EndSelect
        Bottom
        Loop 74
        Paste
        EndLoop
        ClearClipboard
        Clipboard 0
        Key BACKSPACE
        Top
        Loop 24
        Key RIGHT ARROW
        EndLoop
        ColumnModeOn
        ColumnInsertNum 0 1 LeadingZero
        Loop 35
        Key RIGHT ARROW
        EndLoop
        ColumnInsertNum 0 1 LeadingZero
        ColumnModeOff
        Bottom
        InsertLine
        Top
        Find "#!#"
        Replace All "^p"
        Best regards from an UC/UE/UES for Windows user from Austria