Underline a word

Underline a word

9

    Oct 27, 2007#1

    Hi all,

    I need to underline the heading as follows.

    For example:

    Code: Select all

                                             Underline a word
                                             ----------------
    I am trying to underline like above using macros, but not getting any ideas how to go with.

    Any suggestions are appreciated.

    344
    MasterMaster
    344

      Re: UnderLine a Word

      Oct 28, 2007#2

      What is a heading? How can it be detected? What version do you use? Can you post an example? Do you know that underlining can only mean another line of "-"signs and no formatting?
      Questions Questions.....
      Normally using all newest english version incl. each hotfix. Win 10 64 bit

      6,675585
      Grand MasterGrand Master
      6,675585

        Re: UnderLine a Word

        Oct 28, 2007#3

        And you hopefully know that UltraEdit is a text editor and in plain text files it is not possible to store hidden style informations like bold, underline, font size, etc. So you can only configure the syntax highlighting engine to display words (not phrases) with a customized style.

        Or are you talking about underlining with character '-'? Yes, Bego has already written all the questions necessary to write a macro. A software like a macro needs rules.
        Best regards from an UC/UE/UES for Windows user from Austria

        9

          Re: UnderLine a Word

          Oct 28, 2007#4

          Hi Bego,

          <<Do you know that underlining can only mean another line of "-"signs <<and no formatting?

          I want to do the same as u stated above ..I want a series of "-" character under some specific word which I want to Highlight..

          We can try it as follows :

          Go to Next Line
          Depending on the Length of the word selected,write "-" characters..

          But I need to know how can I do the above using Macros..

          I am using Ultraedit 13.10a+1 version..

          I think I am clear now..

          6,675585
          Grand MasterGrand Master
          6,675585

            Re: UnderLine a Word

            Oct 28, 2007#5

            Okay, now I have understood. You simply want to insert a line with '-' characters depending on the length of the current line. The following macro will do that.

            The IfColNumGt 1 makes sure that the macro does nothing if the cursor is currently on an empty line.

            The red highlighted part is just for security. It makes sure that the macro will also work when the cursor is on the last line of the file and this line has no line ending.

            The rest is the real important part. The macro duplicates the current line, selects the duplicate without the line ending and uses an UltraEdit regular expression replace to replace any character in the selection with a '-'.

            Note: The result will be wrong if the current line contains 1 or more tabs because every tab will be replaced only by 1 '-' instead of correct number of '-' according to current tab stop value(s) for that file.

            ColumnModeOff
            HexOff
            Key END
            IfColNumGt 1
            InsertMode
            UnixReOff
            IfCharIs 13
            Else
            IfCharIs 10
            Else
            InsertLine
            Key UP ARROW
            EndIf
            EndIf

            DupeLine
            Key HOME
            IfColNumGt 1
            Key HOME
            EndIf
            StartSelect
            Key END
            Find RegExp "?"
            Replace All SelectText "-"
            EndSelect
            Key HOME
            EndIf

            Add UnixReOn or PerlReOn (v12+ of UE) at the end of the macro before command EndIf if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.
            Best regards from an UC/UE/UES for Windows user from Austria

            9

              Re: UnderLine a Word

              Oct 29, 2007#6

              Hi Mofi,

              Thanks for your reply.

              But it doesn't suite my need. Basically I select only a particular word, but your macro selects the entire line, duplicates it and replaces it by "-" characters.

              Instead of duplicating the entire line,we need to copy the selected word, paste into next line and replace that word by "-" characters.

              I think we need to get the column no here to paste it exactly below the selected text.

              Any ideas?

              6,675585
              Grand MasterGrand Master
              6,675585

                Re: UnderLine a Word

                Oct 30, 2007#7

                Okay, here is a macro which inserts a line below with preceding spaces to start of the current selection and '-' for every character of the selection.

                Again if there is anywhere 1 or more tabs in the current selection or the line part before the selection, the result will be not correct because every tab will be replaced by only 1 '-' or ' ' instead of correct number of '-' or ' ' according to current tab stop value(s) for that file.

                The macro is quite more complicated as I first thought because I don't know your version of UltraEdit. So I was forced to use no v11+ features.

                Also the macro should work on the last line of the file even when it has no line ending. That requires extra code.

                And last I didn't know if you have actived Configuration - Miscellaneous - Home Key always Goto column 1 or not and some other configuration settings could also have an influence on the result of the macro. Therefore I have written the macro using a method which hopefully works with all possible UltraEdit configurations.

                The macro property Continue if a Find with Replace not found or Continue if search string not found must be checked for this macro.

                IfSel
                InsertMode
                ColumnModeOff
                HexOff
                UnixReOff
                Clipboard 9
                Cut
                "
                "
                Key UP ARROW
                DupeLine
                SelectLine
                Find RegExp "?"
                Replace All SelectText " "
                EndSelect
                Key UP ARROW
                Key DOWN ARROW
                Paste
                "
                "
                Key UP ARROW
                SelectLine
                Find RegExp "?"
                Replace All SelectText "-"
                EndSelect
                Key UP ARROW
                Key DOWN ARROW
                StartSelect
                Key END
                CutAppend
                IfCharIs 13
                Delete
                Else
                IfCharIs 10
                Delete
                EndIf
                EndIf
                Key UP ARROW
                Key BACKSPACE
                Key UP ARROW
                Key END
                Paste
                ClearClipboard
                Clipboard 0
                Key DOWN ARROW
                Key END
                Key UP ARROW
                EndIf

                Add UnixReOn or PerlReOn (v12+ of UE) at the end of the macro before command EndIf if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.
                Best regards from an UC/UE/UES for Windows user from Austria