Substitue the currently open file's folder in a macro?

Substitue the currently open file's folder in a macro?

7
NewbieNewbie
7

    Jun 06, 2005#1

    I cannot seem to find any reference to this in the help file. I have tried putting it in a macro, but it will bomb. Does anyone know if you can reference or how to reference the current folder in a macro? For instance, this is what I am trying to do in the macro...

    Psuedo Code....

    Get Path of Currently Open (highlighted) file and save it (or something)
    Now, for every file (recursive) do a search and replace on it

    The actual macro I am using works fine, I just don't like editing it every time... The code looks like this,

    ReplInFiles RegExp Recursive "c:\SomeFolder\CurrentFolder\" "*.htm" "%*DOCTYPE*$"
    ""

    344
    MasterMaster
    344

      Jun 13, 2005#2

      Hi r,

      You can do the following:

      run "dir %d" as a dos-command (F9?) and let the output be prompted in a new window, like:

      Datentraeger in Laufwerk H: ist Vol_home2
      Volumeseriennummer: FE7A-B20A

      Verzeichnis von H:\dat\HTML

      13.06.2005 07:43 <DIR> .
      13.06.2005 07:43 <DIR> ..
      13.06.2005 07:36 901 index.html
      1 Datei(en) 5.213 Bytes
      2 Verzeichnis(se), 122.221.506.560 Bytes frei


      Afterwards you can "grep" for the following of "Verzeichnis von " and close the window. This would be H:\dat\HTML here.
      then just run replace in your code....
      All that can be done via a macro. :)

      Bego
      Normally using all newest english version incl. each hotfix. Win 10 64 bit

      Stephen_Hatton
      Stephen_Hatton

        Jun 15, 2005#3

        Hi rmessier

        I have just recently work out a method for collecting the path name from the current file that one is working on (and saving it to file for future use). I had one complicating issue that required another method because my file names have underscores and hypen's in them. The script is relatively simple.

        So here is my script:

        Save the current file pathname to a file (C:\UEpath.txt) for future use
        ***************************************
        CopyFilePath
        NewFile
        Paste
        Find Up "\"
        Key LEFT ARROW
        "\
        "
        Key DOWN ARROW
        SelectLine
        Key DEL
        Top
        SelectLine
        StartSelect
        Copy
        SaveAs "C:\UEpath.txt"
        EndSelect
        CloseFile
        ***************************************
        This is for an IBM path name. If you have Linux (via FTP), you will need the forward slash for the directory delimiter and you will have to escape it in UltraEdit macros.

        Hope it helps.

        Regards
        Ing. Stephen Hatton
        :idea: