Tapatalk

Using Current File Name for FindInFiles

Using Current File Name for FindInFiles

1
NewbieNewbie
1

    Nov 10, 2005#1

    My goal is to find other application files that reference the file I have open in UE.

    I want to open a source-code file and then run a marco (or tool?) that will search for [Find In Files] the name of that open file in all other files in application directory tree.

    So I think the macro command would be of the form --
    FindInFiles Recursive OutputWin Log "=rootpath=" "*.cfm;*.cfc;" "=filename="
    where
    =filename= is the name of the open file, such a "dis_login.cfm"
    =rootpath= is the top folder to search, such as "Q:\my_app\"

    Is there a way to get the name of the current open file into the macro instruction?
    Is there a way to use a parameter for the root path without hard coding it into the marco?

    Thanks

    6,685587
    Grand MasterGrand Master
    6,685587

      Nov 13, 2005#2

      The root path must be hard coded in the macro. You can only use ".\" for the path specification to let the find in files run on current working directory and below. But using the current working directory is dangerous, because you will not ever know, what is the current working directory for the current instance of UltraEdit at start of the macro. The following 2 settings handles the current working directory:

      Use default directory from shortcut on intial file open
      Use active file directory for file open dialog default


      These settings are at Advanced - Configuration - File Handling - Load.

      But what is the current working directory if you open a file with a double click?

      For the use of the current file name in the find field you can use ^s or ^c (not in a Unix regular expression search!).

      ^s is replaced during execution of find in files with current selection.
      ^c is replaced during execution of find in files with current content in clipboard.

      Both cannot be used for the directory specification!!!

      As example a macro which searches for the current file name in all files starting from current working directory:

      InsertMode
      ColumnModeOff
      HexOff
      Clipboard 9
      CopyFilePath
      NewFile
      Paste
      Find Up "\"
      SelectToTop
      Delete
      SelectAll
      Cut
      CloseFile NoSave
      FindInFiles Recursive OutputWin Log ".\" "*.cfm;*.cfc" "^c"
      ClearClipboard
      Clipboard 0
      Best regards from an UC/UE/UES for Windows user from Austria