Macro Sprache unverständlich / Macro language incomprehensible for me vs. Ultra Edit
-
Hallo zusammen. Mein Arbeitgeber wechselt von Ultra Edit auf Notepad++. Ich habe viele Makros in UE, die ich nun umschreiben muss. Einfaches Beispiel:
Open “M:\TOMAS\TRF0011\TRF0011P.txt”
StartSelect
Key END
EndSelect
Key DEL
Key DEL
Key Ctrl+END
Key BACKSPACE
Key BACKSPACE
StartSelect
Key HOME
Key BACKSPACE
EndSelect
Key BACKSPACE
Key Ctrl+HOME
Save
CloseFileÖffnen eines Textfiles, letzte beiden Zeielen löschen, erste Zeile löschen, speichern, schließen.
Das habe ich in NP++ aufgezeichnet. Aber wenn ich das Makro ausführe, passiert einfach nichts.
Was mache ich falsch?In try in english exept UE language:
Hello everyone. My employer is switching from Ultra Edit to Notepad++. I have a lot of macros in UE that I now need to rewrite. Simple example:see above
Open text file, delete the last two lines, delete the first line, save, close.
I recorded this in NP++. But when I run the macro, nothing just happens.
What am I doing wrong? -
You might try this sequence after you’ve opened your file (no way to macroize opening a file into a tab):
- Ctrl+End (move to end of file)
- Shift+Ctrl+L (delete line of caret)
- Backspace¹ (delete line-ending from previous line)
- Shift+Ctrl+L (delete line of caret)
- Ctrl+Home (move to beginning of file)
- Shift+Ctrl+L (delete line of caret)
- Ctrl+S (save file)
- Ctrl+W (close file)
¹ : The only part that is a little strange is the Backspace, but this is needed because Shift+Ctrl+L (SCI_DELETELINE) won’t delete a “line” that has no line-ending character on its far right. In fact, depending on how you want your end-of-file to be, you may want TWO Backspace presses in place of the single one I have in the above sequence.
-
@Alan-Kilborn said in Macro Sprache unverständlich / Macro language incomprehensible for me vs. Ultra Edit:
no way to macroize opening a file into a tab
Ohha, you say ‘no way to macroize opening a file into a tab’. I got daily a few hundred. So I have to switch to MS Word with vba. It’s s l o w needs lots of ressources and a certifcate.
But thank you very much for your answer. -
If it is possible/desirable for you to use a scripting plugin, then a script could provide a Notepad++ based solution to your problem.
For more info on scripting, see HERE for general automation information and HERE for further specifics about one such scripting option.
With scripting, some pseudocode for the solution becomes:
- iterate over a list of filename strings to act upon (
for f in filename_list:
) - open current filename (
notepad.open(f)
) - get line count (N) (
n = editor.getLineCount()
) - delete line N (
editor.deleteLine(n-1)
) - delete line N-1 (
editor.deleteLine(n-2)
) - delete line 1 (
editor.deleteLine(0)
) - save (
notepad.save()
) - close (
notepad.close()
)
Each of those (except the “iterate” at the top) translates directly (one-for-one) into available N++ script commands.
EDIT: I’ve turned the pseudocode into pretty much a real (PythonScript) script by adding the commands off to the right in the above list of actions.
- iterate over a list of filename strings to act upon (
-
@Alan-Kilborn
Cool! Thank you :)
I will try :)