EmEditor (text editor) Forum Index Questions and Answers about Macros
save files with a custom name | Register To Post |
| Threaded | Newest First | Previous Topic | Next Topic | Bottom |
| Poster | Thread |
|---|---|
| nickb | Posted on: 12/20/2008 12:11 pm |
Just popping in ![]() ![]() Joined: 3/18/2008 From: Posts: 20 |
save files with a custom name I have 100 html files that I want to save with the word between <h1> and </h1> as name.
ex. 1. I have 0001.html with inside <h1>emeditor help</h1> 2. result: emeditor-help.html other example with just one word 1. I have hello.html with inside <h1>screenshots</h1> 2. result: screenshots.html I know editor.ExecuteCommandByID(4100); stands for 'save as' in a jsee file. But anyone with a good example? gr. |
| dreftymac | Posted on: 12/22/2008 9:51 am |
Not too shy to talk ![]() ![]() Joined: 10/1/2008 From: Posts: 39 |
Re: save files with a custom name Save the following example to h1_rename.jsee in your macro directory. Then open an html file that you want to rename. Run h1_rename.jsee while that file is open and the output file will be saved (copied) with the new name in the same directory.
NOTE: Using this script could be cumbersome and annoying. The reason is because it would be tedious to open 100 files, one at a time, and then run this macro against the file. Therefore, you may want to modify this macro to loop through the directory, grab all the names and save the files. Another problem, however, is it may be annoying and cumbersome to have a script open EmEditor to do this. Therefore, the easiest way to accomplish this task may be simply to write a WSH script file and have it process the files in a without using EmEditor to do it. That's probably how I would do it anyway. Nevertheless, you asked for an example and there it is! |
| nickb | Posted on: 12/22/2008 4:33 pm |
Just popping in ![]() ![]() Joined: 3/18/2008 From: Posts: 20 |
Re: save files with a custom name Dreftymac , you really made my day (again)!
I made some small changes to fit my needs, like Thanks again gr. |
| Threaded | Newest First | Previous Topic | Next Topic | Top |
| Register To Post | |



