macro calls text module

macro calls text module

5
NewbieNewbie
5

    Feb 07, 2007#1

    hallo forum;

    i need help. :(
    i've wrote a macro which checks a text entrie and call a template of my text module.
    in my macro are 49 posibilities and in my text module are 49 posibilities.
    if i edit my text an activate the F2 Key the macro starts. Problem: the both first entries are working correct. the rest are not correct working.
    Please check my macro and check the text module an help me to find my failure.

    Thank you

    Stephan

    My macro, sorry zip attachment doesn't work:

    lgv_sel_word

    InsertMode
    ColumnModeOff
    HexOff
    UnixReOff
    Key LEFT ARROW
    IfCharIs "ask_mes"
    Key RIGHT ARROW
    Template 0
    ExitMacro
    EndIf
    IfCharIs "default_set"
    Key RIGHT ARROW
    Template 1
    ExitMacro
    EndIf
    IfCharIs "exists"
    Key RIGHT ARROW
    Template 2
    ExitMacro
    EndIf
    IfCharIs "field_get_buf"
    Key RIGHT ARROW
    Template 3
    ExitMacro
    EndIf
    IfCharIs "field_read"
    Key RIGHT ARROW
    Template 4
    ExitMacro
    EndIf
    IfCharIs "field_ret_qry"
    Key RIGHT ARROW
    Template 5
    ExitMacro
    EndIf
    IfCharIs "field_set_acc"
    Key RIGHT ARROW
    Template 6
    ExitMacro
    EndIf
    IfCharIs "field_set_buf"
    Key RIGHT ARROW
    Template 7
    ExitMacro
    EndIf
    IfCharIs "field_set_menu"
    Key RIGHT ARROW
    Template 8
    ExitMacro
    EndIf
    IfCharIs "field_set_qry"
    Key RIGHT ARROW
    Template 9
    ExitMacro
    EndIf
    IfCharIs "field_write"
    Key RIGHT ARROW
    Template 10
    ExitMacro
    EndIf
    IfCharIs "file_choose"
    Key RIGHT ARROW
    Template 11
    ExitMacro
    EndIf

    and so on.....

    6,606548
    Grand MasterGrand Master
    6,606548

      Feb 07, 2007#2

      The name of the command is IfCharIs and not IfStringIs or IfWordIs.

      IfCharIs "ask_mes" means if the character at current cursor position is an 'a' or 's' or 'k' or 'm' or 'e' or (once again) 's' then do ...

      There is no IfStringIs or IfWordIs command. Suggestion for a possible workaround:

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      SelectWord
      Find MatchCase "ask_mes"
      Replace All SelectText "ask_mes"
      IfFound
      Key Ctrl+LEFT ARROW
      Key Ctrl+LEFT ARROW
      Key Ctrl+LEFT ARROW
      Template 0
      ExitMacro
      EndIf
      Find MatchCase "default_set"
      Replace All SelectText "default_set"
      IfFound
      Key Ctrl+LEFT ARROW
      Key Ctrl+LEFT ARROW
      Key Ctrl+LEFT ARROW
      Template 1
      ExitMacro
      EndIf

      I'm not sure where the template should be inserted. After the replace the cursor is always at the end of the string. So Ctrl+LEFT ARROW moves the cursor back to the begin of the string. Unfortunately the underscore is a delimiter character for Ctrl+LEFT/RIGHT ARROW.

      The macro property Continue if a Find with Replace not found must be checked for this macro.
      Best regards from an UC/UE/UES for Windows user from Austria

      36
      Basic UserBasic User
      36

        Feb 08, 2007#3

        This is what I do to get the result it seems you are looking for:

        InsertMode
        ColumnModeOff
        Key Ctrl+LEFT ARROW
        Find MatchWord "dvc"
        IfFound
        DeleteToEndofLine
        Template 24
        ExitMacro
        EndIf
        Find MatchWord "dvi"
        IfFound
        DeleteToEndofLine
        Template 28
        ExitMacro
        EndIf
        ... rest goes along the same principle ...

        This will result in the template being inserted where the first character in the word was. Unfortunatly it doesn't work on multiple lines tho (that is, not without serious messing around, which in most cases isn't worth it).

        Note the ctrl+LEFT ARROW, in my case it works fine as I have no 'separator' characters in my 'words', you'd have to either fix one for each of your 'words' or make them one word etc.

        Also note DeleteToEndofLine, it is fine in how I use these macros, but might not be for you (ie. if you want to use it in the middle of a line the whole line will be overwritten).

        5
        NewbieNewbie
        5

          Feb 08, 2007#4

          hallo mofi,

          thanks for fast answer. i changed my macro but like the example. the problem is, that for the second and third Find MatchCase commando, the macro returns with the failure "Suchtext nicht gefunden!". I don't know where the problem is.

          Thanks
          Stephan

          InsertMode
          ColumnModeOff
          HexOff
          UnixReOff
          SelectWord
          Find MatchCase "ask_mes"
          Replace All SelectText "ask_mes"
          IfFound
          Key Ctrl+RIGHT ARROW
          Key Ctrl+RIGHT ARROW
          Key Ctrl+RIGHT ARROW
          Template 0
          ExitMacro
          EndIf
          Find MatchCase "default_set"
          Replace All SelectText "default_set"
          IfFound
          Key Ctrl+RIGHT ARROW
          Key Ctrl+RIGHT ARROW
          Key Ctrl+RIGHT ARROW
          Template 1
          ExitMacro
          EndIf
          Find MatchWord "exists"
          Replace All SelectText "exists"
          IfFound
          Key Ctrl+RIGHT ARROW
          Template 2
          ExitMacro
          EndIf
          Find MatchCase "field_get_buf"
          Replace All SelectText "field_get_buf"
          IfFound
          Key RIGHT ARROW
          Template 3
          ExitMacro
          EndIf

            Feb 08, 2007#5

            hallo danne,

            thanks for your fast answer. I understand your tip. My problem is, that in the most of my looking "commands" is an "_" included.
            So i can't use your tip.

            Thank you

            Stephan :?

            6,606548
            Grand MasterGrand Master
            6,606548

              Feb 08, 2007#6

              Again: The macro property Continue if a Find with Replace not found must be checked for this macro.

              Oder auf Deutsch: Unter Makro - Entfernen/Eigenschaften ändern muss man für dieses Makro Nach erfolglosem Suchen & Ersetzen weitermachen aktivieren.
              Best regards from an UC/UE/UES for Windows user from Austria

              5
              NewbieNewbie
              5

                Feb 08, 2007#7

                hallo mofi,

                thank you again. this part of your help i don't understand, but now i understand.

                oder auf Deutsch :wink: : Da ich zu blöd zum lesen war nochmals Danke. Kaum macht man es richtig funktioniert es. :P

                Danke und Gruß nach Austria

                Stephan from Germany :D