How to run a macro or script from the command line in a text editor

We are often asked if we can run UltraEdit macros or scripts on files from the command line. The answer is yes, and it is not only possible, but also very simple!

Running scripts or macros on files through the command line can save the time of actually opening the application, opening the file, and then opening and running the macro or script. We will see below how to accomplish this.

ä »Âà ¥ ½ä» ¤è¡Âè¿Âè¡Âà ¥ ®¦ÂÂèÂÂæ¬

Run a macro or script from the command line

You can call UltraEdit from the command line in Windows. This is usually done using the Dos-prompt box, which is usually accessible under Start->Programs->Accessories. Command actions provide you with more functionality and control over standard Windows operations, and provide the required flexibility for tasks that may exceed the user-friendliness of the Windows user interface.

To invoke UltraEdit from the command line, just type "uedit32" and press Enter. This will open UltraEdit, just like clicking the UltraEdit icon in Windows.

To call UltraEdit to open a specific file, type "uedit32" followed by the path of the file to be opened. You can also open multiple files by separating them with spaces. This is an example:

uedit32 c:\ temp \ test.txt c:\ temp \ index.html c:\ temp \ index.php c:\ temp \ stat.js

Note: For long file names, you may need to enclose the file path and name in quotation marks.

To call UltraEdit from the command line and play a macro or script on a specific file, you need to add a parameter "/m" to the macro and a parameter "/s" to the script, followed by an equal sign and path to the macro. Therefore, to play a macro on a file from the command line, you can use the following command:

uedit32 c:\ temp \ test.txt /m="c:\temp\macro.mac“

To play the script, use the following command:

uedit32 c:\ temp \ test.txt /s="c:\temp\script.js“

In addition, you can specify the number of times the macro/script is played through the command line, and whether to close UltraEdit after the macro/script is played. Therefore, the following command line entry:

uedit32 c:\ temp \ test.txt /m,e,2="c:\temp\macro.mac“

Tell UltraEdit to play the macro twice (specified by "2"), and then exit UltraEdit (specified by "e").

ä »Âà ¥ ½ä» ¤è¡Âè¿Âè¡Âà ¥ ®¦ÂÂèÂÂæ¬

For the script, your command line is similar to the following:

uedit32 c:\ temp \ test.txt /s,e="c:\temp\script.js“

ä »Âà ¥ ½ä» ¤è¡Âè¿Âè¡Âà ¥ ®¦ÂÂèÂÂæ¬

Other command line parameters

Use the command line not only to play scripts and macros, but also to do more things. The following are other available command line parameters for UltraEdit:



Guess you like

Origin blog.51cto.com/15078157/2676373