Macro to save new files?

Macro to save new files?

40
Basic UserBasic User
40

    Apr 27, 2006#1

    Is there a way to make a macro that will automatically save all the new files to a specified fixed location, like C:\tmp, without prompting for a name for each file?

    When you create new files, UE names them Edit1, Edit2, .. etc.
    I want the macro to automatically save all such files as C:\tmp\Edit1, C:\tmp\Edit2 etc. without asking for names. No extension is fine.

    I need this because I very often need to compare pieces of data I get from the clipboard. To do this I create new files and paste inside. UE can not compare non-saved files, and manually saving each one is just too tedious so I want to somehow automate it.

    Thanks.

    6,686585
    Grand MasterGrand Master
    6,686585

      Apr 27, 2006#2

      That was not really difficult for me. Here is the "SaveAllNewFiles" macro. This macro needs the macro property Continue if a Find with Replace not found checked.

      It does not modify named files except if a named file is the current file on start of the macro. But even if the first file is a named file, the content of the named file is not really modified.

      If you want the new files also closed automatically by this macro, insert the command CloseFile after the 2 SaveAs commands.

      InsertMode
      ColumnModeOff
      HexOff
      Clipboard 9
      "FIRST FILE OF SAVE ALL NEW FILES MACRO"
      Loop 38
      Key LEFT ARROW
      EndLoop
      Loop
      NextWindow
      Find MatchCase "FIRST FILE OF SAVE ALL NEW FILES MACRO"
      IfNotFound
      IfNameIs ""
      Top
      "C:\tmp\"
      CopyFilePath
      Paste
      StartSelect
      Key HOME
      Cut
      EndSelect
      SaveAs "^c"
      EndIf
      Else
      Delete
      IfNameIs ""
      Top
      "C:\tmp\"
      CopyFilePath
      Paste
      StartSelect
      Key HOME
      Cut
      EndSelect
      SaveAs "^c"
      EndIf
      ExitLoop
      EndIf
      EndLoop
      ClearClipboard
      Clipboard 0
      Best regards from an UC/UE/UES for Windows user from Austria

      40
      Basic UserBasic User
      40

        Apr 28, 2006#3

        Thank you very much Mofi !!

        Works fine.
        I wish it was that difficult for me :)

        1
        NewbieNewbie
        1

          Aug 01, 2007#4

          Hi Mofi,

          Found your macro very useful. I have modified it a bit so that it will not modify the current file if the current file is already a saved file; it will search for the first unnamed file (up to 50):

          InsertMode
          ColumnModeOff
          HexOff
          Loop 50
          IfNameIs ""
          ExitLoop
          EndIf
          NextWindow
          EndLoop
          IfNameIs ""
          Clipboard 9
          "FIRST FILE OF SAVE ALL NEW FILES MACRO"
          Loop 38
          Key LEFT ARROW
          EndLoop
          Loop
          NextWindow
          Find MatchCase "FIRST FILE OF SAVE ALL NEW FILES MACRO"
          IfNotFound
          IfNameIs ""
          CopyFilePath
          SaveAs "C:\Tmp\^c"
          EndIf
          Else
          Delete
          IfNameIs ""
          CopyFilePath
          SaveAs "C:\Tmp\^c"
          EndIf
          ExitLoop
          EndIf
          EndLoop
          ClearClipboard
          Clipboard 0
          EndIf

          I use it to save temp files for comparison as well. Did wish that UE had direct support for comparing unnamed temp files. I think it once did, when the UltraCompare product was 'not born yet' as a separate product... :) Oh well...

          Edit: Comparing text snippets in not saved files was added later as feature of UltraCompare and UltraEdit.

          6,686585
          Grand MasterGrand Master
          6,686585

            Aug 01, 2007#5

            Very good modification. I have marked always the first file to avoid an endless loop if there is no unnamed file. You solved that problem better with searching maximal 50 times for first unnamed file and do nothing if no unnamed file is found in fifty trials. Thanks, for that very useful improvement.
            Best regards from an UC/UE/UES for Windows user from Austria