User Tools

(Difference between revisions)
Jump to: navigation, search
m (Full RegEx Supported Replace and More!)
(XML Beautifier)
Line 1,533: Line 1,533:
 
stdout.Write(xml.xml.substr(0, xml.xml.length-2));
 
stdout.Write(xml.xml.substr(0, xml.xml.length-2));
 
</pre>
 
</pre>
 +
 +
===Transpose Array===
 +
Description: Swap rows for columns in tab-separated text.  Great for use with a spreadsheet.<br>
 +
Author: jimbo<br>
 +
Command: <tt>cscript //NoLogo "c:\path to file\file.js"</tt><br>
 +
Check: "Run as text filter"<br>
 +
Example:
 +
<pre>
 +
Input:
 +
======
 +
a b c
 +
1 2 3 4
 +
alpha beta gamma
 +
======
 +
 +
Output:
 +
======
 +
a 1 alpha
 +
b 2 beta
 +
c 3 gamma
 +
4
 +
======
 +
</pre>
 +
Code:
 +
<pre>
 +
var stdin  = WScript.StdIn;
 +
var stdout = WScript.StdOut;
 +
 +
var text  = stdin.ReadAll();
 +
var lines = text.split(/\s*\n/g);
 +
var maxcols = lines.length-1;
 +
var maxrows=0;
 +
var line,parts=[], part,out;
 +
 +
// split it out and size it up
 +
for (var i=0;i<lines.length;i++) {
 +
parts[i] = lines[i].split('\t');
 +
maxrows = Math.max(maxrows,parts[i].length);
 +
}
 +
 +
// spit it back out
 +
for (var i=0;i<=maxrows;i++) {
 +
out = '';
 +
for (var j=0;j<=maxcols;j++) { out += ( parts[j][i] || '' )+'\t' }
 +
// trim trailing tabs
 +
stdout.Write(out.replace(/\t+$/,''));
 +
// don't write an extra newline
 +
if (i<=maxrows-1) { stdout.Write('\n') }
 +
}
 +
</pre>
 +
 +
===Natural Sort===
 +
Description: .<br>
 +
Author: jimbo<br>
 +
Command: <tt>cscript //NoLogo "c:\path to file\file.js"</tt><br>
 +
Check: "Run as text filter"<br>
 +
Get File: Get and save javascript natcompare.js via http://sourcefrog.net/projects/natsort/ to whatever directory this script
 +
is in.<br>
 +
Example:
 +
<pre>
 +
Input:
 +
======
 +
04-08-10
 +
04-1-15
 +
05-1-1
 +
======
 +
 +
Output:
 +
======
 +
04-1-15
 +
04-08-10
 +
05-1-1
 +
======
 +
 +
Input:
 +
======
 +
id10TFier.v1.10
 +
id10TFier.v1.10.1
 +
id10TFier.v1.9.3
 +
======
 +
 +
Output:
 +
======
 +
id10TFier.v1.9.3
 +
id10TFier.v1.10
 +
id10TFier.v1.10.1
 +
======
 +
</pre>
 +
Code:
 +
<pre>
 +
var stdin  = WScript.StdIn;
 +
var stdout = WScript.StdOut;
 +
 +
eval(new ActiveXObject("Scripting.FileSystemObject").OpenTextFile("natcompare.js",1).ReadAll());
 +
 +
var text  = stdin.ReadAll();
 +
var lines = text.split(/\s*\n/g);
 +
 +
stdout.Write(lines.sort(natcompare).join('\n'));
 +
</pre>
 +
 
===Alternate Function List With JS===
 
===Alternate Function List With JS===
 
Description: It show function list like "Search in files" command: You can see the line number, and click it on.<br>
 
Description: It show function list like "Search in files" command: You can see the line number, and click it on.<br>

Revision as of 04:56, 3 November 2011

This page exists a resource for user tool configurations frequently used in EditPlus.

For information on writing your own user tool to act as a text filter, see writing a text filter.

Contents

HTML

Color Cop

Website: http://www.prall.net/tools/colorcop/
Description: This is the best tool for determining what color is being used via a color picker. I use this all the time!
Posted By: Dean Householder

FontLister

Website: http://www.theill.com/fl/
Description: Compares all the fonts on my system visually on the screen. (More useful for working with graphics than coding) I'm using version 2.0 which is freeware and does what I want.
Posted By: Dean Householder

Google Search (selection)

Description: Search's Google for the current selection.
Command: Maxthon.exe (Maxthon is found at http://www.maxthon.com/) Similar command can be used for other browsers.
Command: C:\Program Files\Mozilla Firefox\firefox.exe (for firefox)
Argument: http://www.google.com/search?q=$(CurSel)
Posted By: Brett Batie
Additional Info: If this fails to work for you, try putting $(CurSel) in quotes, like "$(CurSel)"

External Browser Preview UserTool

Website: http://www.maxthon.com/
Description: Save current file, then Launch it in Maxthon tabbed browser.
Menu text: Maxthon Browser
Command: C:\Program Files\Maxthon\Maxthon.exe
Argument: file:///"$(FilePath)"
Initial directory: [leave blank]
Check: "Save open files"
Posted By: John Morse
Additional Info: This command is good for keeping the internal browser preview enabled in EditPlus, but still having the extra functionality of previewing your file in other browsers.

HTML Tidy

Website: http://tidy.sourceforge.net/
Description: This will automatically clean up your HTML code to whatever standards you designate in the tidyconfig.txt file.
Command: tidy.exe -config tidyconfig.txt
Argument: "$(FilePath)"
Check: "Run as text filter"
Posted By: Dean Householder

Note: If tidy.exe is not in the Window's Path, and you installed it to "C:\Program Files\Tidy", set initial directory to C:\Program Files\Tidy. Also, in the tidyconfig.txt file, make sure you don't have the line write-back: yes, as it will write the changes to the underlying file instead of to the EditPlus window. Either change it to write-back: no or delete the line, as no is the default setting.

Here's an example config file for Tidy:

 // sample config file for HTML tidy (XHTML formating)
 indent: auto
 indent-spaces: 4
 wrap: 80
 markup: yes
 output-xml: no
 input-xml: no
 output-xhtml: yes
 show-warnings: yes
 numeric-entities: yes
 quote-marks: yes
 quote-nbsp: yes
 quote-ampersand: yes
 break-before-br: no
 uppercase-tags: no
 uppercase-attributes: no
 char-encoding: latin1
 new-inline-tags: cfif, cfelse, math, mroot,
     mrow, mi, mn, mo, msqrt, mfrac, msubsup, munderover,
     munder, mover, mmultiscripts, msup, msub, mtext,
     mprescripts, mtable, mtr, mtd, mth
     new-blocklevel-tags: cfoutput, cfquery
 new-empty-tags: cfelse
 logical-emphasis: yes
 enclose-text: yes
 write-back: no

--NOSLOW 07:17, 20 February 2008 (PST)

DotNet

Compile NAnt Projects

Website: http://nant.sourceforge.net
Description: Compiles NAnt project for DotNet.
Command: nant.exe
Argument: $(CurSel) -find
Initial Directory: $(FileDir)
Check: "Capture Output", "Save open files"
Output Pattern:

  • Regular Expression: ^[\t ]*(\[.+\] )?([^(]+)\(([0-9]+),([0-9]+)\)
  • File Name: Tagged Expression 2
  • Line: Tagged Expression 3
  • Column: Tagged Expression 4

Tips: What you have selected when launching this tool would be treated as the target name of the build file. For instance, given that you have a "default.build" file located in the same folder as the active file, and you have selected "debug", then launch this tool. NAnt will compile the "debug" target of the "default.build" file. Please notice that there's a "-find" argument in the command line which enables Nant to search for build files in parent folders of the active file in case of no build file exists in the directory.

Posted By: Welman Jordan

Compile A Single C# File to Console EXE

Description: Compile c# code to a console executable file (for quick testing or very-light-weight application development purpose)
Command: %systemroot%\Microsoft.NET\Framework\v1.1.4322\csc
Argument: "$(FileName)" /r:System.dll /r:System.data.dll /nologo /debug
Initial Directory: $(FileDir)
Check: "Capture Output", "Save open files"
Tips:

  1. "v1.1.4322" in "command" should be the version number of the Microsoft .Net Framework;
  2. If you need to reference more assemblies, please add more "/r" stuff in the "arguments"
  3. Please refer to the .Net Framework SDK Documentation on CSC (C Sharp Compiler) for more information about how to compile C# files. You may also consider using a "Responding File". However, NAnt Build files should be preferred if your project goes to be complex that you need to use "responding files".

Posted By: Welman Jordan

C/C++

C/C++: Compiler

Website: http://nuwen.net/mingw.html (one of the better distributions available)
Description: Compiles your C or C++ project using a makefile and lets you jump to problematic lines by clicking in the output window.
Command: C:\MinGW\bin\make.exe (or just 'make.exe' if you edited your environment variables)
Argument: -f makefile (if your makefile is named 'makefile' without an extension)
Initial Directory: $(FileDir)
Check: "Capture output", "Save open files"
Output Pattern:

  • Regular Expression: ^([^:]+)\:([0-9]+)\:
  • File Name: Tagged Expression 1
  • Line: Tagged Expression 2
  • Column: Not Defined


SCons

  • Command:C:\Python24\Scripts\scons.bat
  • Argument:-D
  • Initial directory:$(DirWin)
  • Capture Output : Yes
  • Save : All Files

This allows you to auto-save, compile, and then double-click to goto the error line

"-D" option traverses up the current Directory tree to find the SConstruct file

Java

Java: to HTML converter (current file)

Website: http://www.java2html.de/
Description: Converts the source code of the current Java file to HTML.
Command: java -jar c:\path\to\java2html.jar -srcfile
Argument: $(FileName) -converter HTML -tabs 2 -style KAWA
Initial Directory: $(FileDir)
Check: "Close window on exit", "Save open files"
Posted By: Brett Batie

Java: to HTML converter (run program)

Website: http://www.java2html.de/
Description: Runs the Java to HTML program.
Command: java -jar c:\path\to\java2html.jar
Posted By: Brett Batie

Java: to HTML converter (all source in directory)

Website: http://www.java2html.de/
Description: converts all the source files in the files current directory to HTML.
Command: java -jar c:\programming\java2html\java2html.jar
Argument: -srcdir "$(FileDir)" -converter HTML -tabs 2 -style KAWA
Check: "Close window on exit", "Save open files"
Posted By: Brett Batie

Java: Compiler

Website: http://java.sun.com/
Description: Compiles Java source code.
Command: c:\path\to\javac.exe
Argument: $(FileName)
Check: "Capture output", "Save open files"
Posted By: Brett Batie

Java: Decompiler

Website: http://www.varaneckas.com/jad
Description: Decompiles Java class files.
Command: c:\path\to\jad.exe
Argument: -p "$(FilePath)"
Check: "Run as text filter"
Posted By: Maximilian Stangel

Java: JVM Runtime

Website: http://java.sun.com/
Description: Java Virtual Machine runtime that lets you execute your Java class files.
Command: c:\path\to\java.exe
Argument: $(FileNameNoExt)
Check: "Capture output"
Posted By: Brett Batie

Java: compile $package.$classname

Description: java compile keeping my .class files seperate from my .java files.
Command: C:\Program Files\Java\jdk1.6.0\bin\javac.exe
Argument: -Xlint -d c:\java\home\classes -cp c:\java\home\src;. $(FileName)
Check: "Capture output", "Save open files"
See Also: I use this conjunction with the "Java: run $package.$classname" usertool documented below.
Posted By: Keith Corlett

Java: run $package.$classname

FOR WINDOWS ONLY - Requires perl
Description: this perl script works out the package name of the current file (relative to my c:\java\home\src directory) and executes java.exe on $package.$(FileNameNoExt)... allowing me to keep my .class files separate from my .java files
The Script:C:\Program Files\EditPlus 2\UserTools\Java\run.pl

#!/perl/bin/perl -w
$package = $ARGV[0] || die "read the script!";
$fileNameNoExt = $ARGV[1] || die "read the script!";
$package =~ s/c:\\java\\home\\src\\//i;
$package =~ s/\\/./g;
$command='"C:\\Program Files\\Java\\jdk1.6.0\\bin\\java"';
$args = "-classpath \"c:\\java\\home\\classes;.\" $package.$fileNameNoExt";
print "$command $args\n";
print `$command $args`;

Command: C:\Perl\bin\perl.exe
Argument: "C:\Program Files\EditPlus 2\UserTools\Java\run.pl" $(FileDir) $(FileNameNoExt)
Check: "Capture output", "Save open files"
See Also: I use this in conjunction with the "Java: compile $package.$classname" usertool documented above.
Posted By: Keith Corlett

Java: JavaDoc

Website: http://java.sun.com/
Description: Generates HTML documentation on classes by extracting comments from the Java source code files.
Command: c:\path\to\javadoc.exe
Argument: -d "$(FileDir)\documentation" -quiet -public -version -author -linksource -link http://java.sun.com/j2se/1.4.2/docs/api/ $(FileName)
Initial Directory: $(FileDir)
Check: "Capture output"
Posted By: Brett Batie

Java: Applet Viewer

Website: http://java.sun.com/
Description: Runs the applet viewer on the current file.
Command: c:\path\to\appletviewer.exe
Argument: $(FileName)
Initial Directory: $(FileDir)
Check: "Capture output"
Posted By: Brett Batie

Java: API via CHM

Website: http://java.sun.com/docs/windows_format.html
Description: Looks up the current word in the Java API CHM help file. Make sure when adding this you click Add Tool → HTML help file (*.chm)
Command: c:\path\to\jdk142.chm
Posted By: Brett Batie

Java: API Online

Website: http://java.sun.com/j2se/1.4.2/download.html#docs
Description: Opens the Java API web page. You can also download the API so you can view it without an internet connection.
Command: c:\path\to\Maxthon.exe (Maxthon is found at http://www.maxthon.com/) Similar command can be used for other browsers.
Argument: file:///C:/java_api_1.4.2/api/index.html
Posted By: Brett Batie

Java: google "java API ${SelectedText}"

http://google.com/
http://www.mozilla.com/en-US/firefox/
Description: runs a Google search for "java API ${SelectedText}" using firefox for results in English
Note: this is useful for finding third party (non-sun) API doco. Command: C:\path\to\firefox.exe
Argument: http://www.google.com.au/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&hl=en&q=java+API+$(CurSel)&meta=&btnG=Google+Search
Initial Directory: $(FileDir) but this doesn't really matter
Posted By: Keith Corlett

Java: Source Format (Current File)

Website: http://jalopy.sourceforge.net/
Description: Formats Java source code.
Command: cmd.exe /c type
Argument: $(FileName) | java -jar c:\path\to\jalopy-console-1.0.4.jar 2>nul
Check: "Run as text filter"
Posted By: Brett Batie

Java: Source Format (All Directories)

Website: http://jalopy.sourceforge.net/
Description: Formats Java source code.
Command: java.exe -jar c:\programming\jalopy\lib\jalopy-console-1.0.4.jar -r
Argument: "$(FileDir)"
Check: "Capture output"
Posted By: Brett Batie

Perl

Perl: Syntax Check

Description: Check perl syntax.
Command: c:\path\to\perl.exe -c
Argument: "$(FilePath)"
Check: "Capture output"
Posted By: James Kelly

Perl: Perltidy

Website: http://perltidy.sourceforge.net/ Description: Runs Perltidy on the current file.
Command: c:\path\to\perl.exe "c:\path\to\perltidy"
Argument: "$(FilePath)" -st
Check: "Run as text filter"
Posted By: James Kelly
Note: You must copy Perltidy\lib\Perl to Perl\site\lib


Groovy

website: http://groovy.codehaus.org/ Description: Runs your groovy scripts
Command: C:\path\to\groovy.bat Argument: "$(FilePath)"
Check: "Capture output", "Save open files"
Note: leave Initial Directory blank
Posted by: Kasim Tuman

Liberty Basic

website: http://www.libertybasic.com/
Description: Compiles Libery Basic programs
Command: C:\path\to\liberty.exe
Argument: "-R -A $(FilePath)"
Initial Directory: $(FileDir)
Check: "Save open files"
Posted by: Michael Jones, based on information from Peter Anderson

PHP

PHP: syntax checker

Description: Checks php syntax.
Command: c:\path\to\php.exe -l
Argument: $(FileName)
Check: "Capture output", "Save open files"
Posted By: Brett Batie

Hint : it's better to use "$(FilePath)" (with the quotes) for the Argument.
Posted By: Alex Mathieu

PHP: syntax checker (remove HTML from error message)

Description: Checks php syntax.
Command: "c:\path\to\php.exe" -l -d html_errors=off
Argument: $(FileName)
Check: "Capture output", "Save open files"
Posted By: Stephen Ball

Hint : it's better to use "$(FilePath)" (with the quotes) for the Argument.
Posted By: Alex Mathieu

PHP: syntax checker (use output pattern to go to line)

Description: Click on error message to go to line in source file.
First: set up the syntax checker as above.
Select: Output Pattern
Uncheck: Use default output pattern
Regular Expression: ^.+ in (.+) on line ([0-9]+)
File name: Tagged Expression 1
Line: Tagged Expression 2
Column: None
Posted By: Peter Lafferty

PHP: The Online Manual

Website: http://www.php.net/docs.php Description: Looks up current word in the online manual for PHP
Command: "c:\path\to\browser\"
Argument: http://php.net/$(CurWord)
Check: "Save open files"
Posted By: Peter Lafferty
Hint : It can be faster to use the URL PHP.net resolves to for your country, like "ie.php.net", "uk.php.net", "it.php.net".

PHP: External Browser Preview

Website: N/A
Description: PHP Development Aide - Preview current file, server-side, source code parsed by PHP engine
Command: "c:\Program Files\Your\Browser.exe"
Argument: http://localhost/$(CurSel)
Check: "Save open files"
Posted By: Jeff Sabarese
Hint : the EditPlus Argument "$(CurSel)" is key here, but requires adopting a source-code commenting convention. Comment each file after the opening PHP tag to indicate the current file name and path (for example: // ./MySiteDev/Location/current.php ). When ready to preview, highlight this path info before executing the User Tool (as configured above). The magic of the "$(CurSel)" Argument will effectively preview the current file, without the inherent problem of the Browser prompting to "Open File With...". NOTE: LocalHost may be substituted for any server name-- very useful when using the FTP edit / save / upload option.

PHP: Function Prototype for built-in functions

Description: Show currently selected function's prototype in the output window. Poor man's Intellisense.
Step 1: Download "funcsummary.txt" file from PHP.net source repository [1]
Step 2: Create and save a php_func_hint.js file using the JScript below
Command: cscript.exe
Argument: //Nologo C:\path\to\php_func_hint.js $(CurWord)
Check: Capture output, Save open files
Posted By: DV
JScript Code:

var lookup = WScript.Arguments(0);
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.OpenTextFile("C:\\path\\to\\funcsummary.txt", 1);
while(!f.AtEndOfStream)
{
  line = f.ReadLine();
  if(line.indexOf(' '+lookup+'(') > -1)
  {
    WScript.Echo(line+"\n"+f.ReadLine());
    break;
  }
}
f.close();



PHP: Run PHP Code from command line

Description: Uses the "-r" option to run a snippet of PHP code, e.g.

c:>php -r "echo 'foo';"

Command: C:\path\to\php-win.exe
Argument: -r "$(Prompt)"
Check: Capture output, Save open files
Posted By: DV

Python

Python: Python Runtime

Website: http://www.python.org/ Description: Python runtime that lets you execute your Python scripts.
Command: C:\path\to\python.exe
Argument: "$(FilePath)"
Initial Directory: $(FileDir)
Check: "Capture output", "Save open files"
Output Pattern:

  • Regular Expression: File \"(.+)\", line ([0-9]+)
  • Regular Expression File name tag: Tagged Expression 1
  • Regular Expression Line: Tagged Expression 2

LSL - Linden Scripting Language

LSL: syntax checker

Website: http://w-hat.com/lslint
Description: Checks the syntactic and semantic validity of Second Life LSL scripts.
Command: c:\path\to\lslint.exe
Argument: "$(FilePath)"
Initial Directory: $(FileDir)
Check: "Capture Output", "Save open files"
Output Pattern:

  • Regular Expression: ^[^(]+\(\ *([0-9]+),\ *([0-9]+)
  • File Name:
  • Line: Tagged Expression 1
  • Column: Tagged Expression 2


NOTE: Remember to specify the quotes for Argument, as shown above. Otherwise you'll get "Couldn't open file" errors for filenames with spaces.
NOTE: Click on error message in the output window to go to line in source file.
Posted By: Sami Salin (aka. Lecalat Starbrook @Second Life)

Ruby

Website: http://www.ruby-lang.org/ Description: Runs your ruby scripts
Command: C:\path\to\ruby.exe (Assume you have ruby on windows installed)
Argument: "$(FilePath)"
Check: "Capture output", "Save open files"
Note: leave Initial Directory blank
Posted by: Kasim Tuman

Scripting

VBScript

Description: Executes your VBScript script
Command: cscript.exe
Argument: "$(FilePath)" //nologo
Initial directory: $(FileDir)
Posted by: John Röthlisberger

Description: Debugs your VBScript script
Command: cscript.exe
Argument: "$(FilePath)" //nologo //d //x
Initial directory: $(FileDir)
Posted by: Michael Jones

File Management

DOS (Current Location)

Description: Opens DOS in the directory of the currently open file.
Command: cmd.exe (or if on W95/98/ME, command.com)
Initial Directory: $(FileDir)
Posted By: Brett Batie

DOS (Executing current file)

Description: Execute current opened file in a DOS (cmd.exe) window.
Command: cmd.exe
Argument: /c "$(FileNameNoExt)"
Initial Directory: $(FileDir)
Posted By: PIT

ExamDIFF

http://www.prestosoft.com/ps.asp?page=edp_examdiff (freeware version)
Description: This compares the differences between two versions of a file. Answers the question: These look similar but which lines are different?
Command: c:\path\to\ExamDiff.exe
Argument: $(WindowList)
Upon running, it will open the window list. Simply hold CTRL and select the two files you would like to compare.
If you are comparing Remote FTP files, make sure to check the box next to "Create temp file of remote file", and hit OK.
Posted By: Dean Householder

BeyondCompare (2.x)

Scooter Software
Description: BeyondCompare compares two versions of a file in a graphical interface, highlighting their differences.
Command: c:\path\to\BC.exe
Argument: $(WindowList)
Notes: Upon running, it will open the window list. Simply hold CTRL and select the two files you would like to compare.
If you are comparing Remote FTP files, make sure to check the box next to "Create temp file of remote file", and hit OK. If you select more than two files, only the first two will be opened in BeyondCompare.
Posted By: DZ-Jay

Explorer (Current Location)

Description: Opens windows explorer in the location of the current open file. Works great for programs like Tortoise SVN.
Command: %systemroot%\explorer.exe /e,/root,\local disk,
Argument: $(FileDir)
Posted By: Brett Batie

Explorer (Current Selection)

Description: Opens windows explorer in the location of the path currently selected.
Command: %systemroot%\explorer.exe
Argument: /select, $(FilePath)
Posted By: Carlos Rivas

WinMerge: Compare two open files

Website: http://winmerge.org/ Description: Shows the difference between two open files.
Command: C:\Program Files\WinMerge\WinMergeU.exe
Argument: $(WindowList)
Posted By: Brett Batie

Run Selection

Description: Runs (ShellExec) the currently selected text. It is equivallent to entering the selected text in the Windows "run" dialog.
This tool also works to launch URLs, explore folder paths or launch a file (with with a registered extension).
Examples:

  1. If "regedit.exe" is selected, the Registry Editor application is launched (assumes %systemroot% is in your path).
  2. If "C:\EditPlus\editplus.hlp" is selected, the EditPlus help file is opened.

Command: %systemroot%\system32\RunDLL32.exe
Argument: shell32.dll,ShellExec_RunDLL "$(CurSel)"
Close Window on Exit: On
Initial Directory: $(FileDir)
Posted By: Carlos Rivas

Jump To File in Project

Author: Mark Kahn
Description: Gives a type-able input that allows you to jump directly to any file in a given project.
Repository: http://code.google.com/p/editplus-user-tools/source/browse/trunk/JumpToFile/
Limitations:

  • Can only be used in a project
  • The project MUST be local
  • The first time you load the tool, it will take anywhere from several seconds to minutes to load depending on the number of files in your project. After this, it caches the files in the project and will load much faster
  • The tool will re-scan the project folders every 30 seconds, so files added or deleted will not instantly show up
  • The tool will not take note of any changes to files or folders included in the project (via Project-->Edit Projects) until it is re-launched
  • The tool must be re-launched after switching projects
  • Must have internet access. If this is a problem download the .hta from google code, then download the .js and .css files that are linked

Note:

  • Under Arguments below, the INI directory can be found under Tools-->Set Directories

Security:

  • Please note that .hta applications have a LARGE amount of control over your computer and that running one directly from the SVN repository is risky -- if someone else adds malicious code, it will run on your computer directly -- and that downloading the .hta is preferred

Command: mshta "http://editplus-user-tools.googlecode.com/svn/trunk/JumpToFile/jumpToFile.hta"
Arguments: "c:\Path\To\INI\Directory" "$(AppDir)" "$(ProjectName)"
Check: "Run Hidden"
Save: None

Version Control

Microsoft Visual SourceSafe

EditPlus user tool commands to interface with command-line version of Microsoft Visual SourceSafe

Description: Display name of current VSS project
Menu text: Current Project
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: project
Initial directory: $(FileDir)
Check: "Capture output"

Description: Set current VSS project
Menu text: Set Project
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: cp
Initial directory: $(FileDir)
Check: "Capture output", "Prompt for arguments"

Description: Create a new VSS project and set as current
Menu text: Create / Set Project
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: create -c- -s
Initial directory: $(FileDir)
Check: "Capture output", "Prompt for arguments"

Description: Set VSS project working folder
Menu text: Set Working Folder
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: workfold "$(FileDir)"
Initial directory: $(FileDir)
Check: "Capture output"

Description: List files in VSS project
Menu text: Directory
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: dir -c
Initial directory: $(FileDir)
Check: "Capture output"

Description: Display status of current file in VSS
Menu text: Status
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: status "$(FileName)"
Initial directory: $(FileDir)
Check: "Capture output"

Description: Get a file from VSS to working folder
Menu text: Get File
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: get
Initial directory: $(FileDir)
Check: "Capture output", "Prompt for arguments"

Description: Get latest version of current EditPlus file from VSS, overwriting existing file on disk
Menu text: Get Latest Version
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: get "$(FileName)"
Initial directory: $(FileDir)
Check: "Capture output", "Save open files"

Description: Check out current EditPlus file from VSS, overwriting existing file on disk
Menu text: Check Out
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: checkout "$(FileName)" -c-
Initial directory: $(FileDir)
Check: "Capture output", "Save open files"

Description: Display differences between current EditPlus file and version in VSS
Menu text: Difference
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: diff "$(FileName)" -ds
Initial directory: $(FileDir)
Check: "Capture output", "Save open files"

Description: Undo checkout of current EditPlus file from VSS
Menu text: Undo Checkout
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: undocheckout "$(FileName)" -p
Initial directory: $(FileDir)
Check: "Capture output", "Save open files"

Description: Check current EditPlus file into VSS
Menu text: Check In
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: checkin "$(FileName)" -c- -p
Initial directory: $(FileDir)
Check: "Capture output", "Save open files"

Description: Check current EditPlus file into VSS but keep checked out
Menu text: Check In / Keep Checked Out
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: checkin "$(FileName)" -c- -k -p
Initial directory: $(FileDir)
Check: "Capture output", "Save open files"

Description: Add current EditPlus file into VSS
Menu text: Add File
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: add "$(FileName)" -c-
Initial directory: $(FileDir)
Check: "Capture output", "Save open files"

Description: Add current EditPlus file into VSS and check out
Menu text: Add File / Check Out
Command: C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.EXE
Argument: add "$(FileName)" -c- -k
Initial directory: $(FileDir)
Check: "Capture output", "Save open files"

Posted By: Michael Jones

CS-RCS

EditPlus user tool commands to interface with CS-RCS

Description: Create current EditPlus file in CS-RCS
Menu text: Create
Command: D:\Program Files\ComponentSoftware\CS-RCS\System\csrcs.exe
Argument: Create $(FilePath)
Check: "Capture output", "Save open files"

Description: Display status of current EditPlus file in CS-RCS
Menu text: Status
Command: D:\Program Files\ComponentSoftware\CS-RCS\System\csrcs.exe
Argument: Status $(FilePath)
Check: "Capture output"

Description: Display status of current EditPlus file in CS-RCS
Menu text: History
Command: D:\Program Files\ComponentSoftware\CS-RCS\System\csrcs.exe
Argument: History $(FilePath)
Check: "Capture output"

Description: Check out current EditPlus file from CS-RCS, overwriting existing file on disk
Menu text: Check Out
Command: D:\Program Files\ComponentSoftware\CS-RCS\System\csrcs.exe
Argument: CheckOut $(FilePath)
Check: "Capture output", "Save open files"

Description: Check current EditPlus file into CS-RCS
Menu text: Check In
Command: D:\Program Files\ComponentSoftware\CS-RCS\System\csrcs.exe
Argument: CheckIn $(FilePath)
Check: "Capture output", "Save open files"

Posted By: Michael Jones

Subversion

Description: Compare differences of current file to base SVN repository, using WinMerge.
Menu text: SVN Diff
Command: C:\path\to\file\svndiff.bat
Argument: $(FileDir) $(FileName)
Check: "Capture output", "Save open files"
Depends: WinMerge, this batch file:

@echo off

set WC="%1\%2"
set REP="%1\.svn\text-base\%2.svn-base"

IF NOT EXIST %WC% goto missing
IF NOT EXIST %REP% goto missing

"C:\Program Files\WinMerge\WinMerge.exe" %REP% %WC%
goto end

:missing
echo File(s) missing, not diffing.

:end

Subversion Commit

Description: Commit Files to Server with TortoiseSVN
Prerequesits: Files should be in Working Copy (previous checkout with TortoiseSVN)

Menu text: SVN Commit
Command: C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe (or similar)
Argument: /command:commit /path:"$(FilePath)" /notempfile /closeonend:0 (use "$(FileDir)" if you want to commit the current file's directory)
Initial Directory: $(FileDir) Check: "Capture output", "Save open files"
Depends: [tortoisesvn.tigris.org/ TortoiseSVN]

Subversion Update, Delete, Rename, Checkout etc

Replace /command:<command> with one of the following commands:

:about Shows the About-dialog. This is also shown if no command is given.  
:log Opens the log dialog. The path specifies the file or folder for which the log should be shown. Three additional options can be set: /revstart:xxx, /revend:xxx and /strict  
:checkout Opens the checkout dialog. The /path specifies the target directory and the /url specifies the URL to checkout from.  
:import Opens the import dialog. The path specifies the directory with the data to import.  
:update Updates the working copy in /path to HEAD. If the option /rev is given then a dialog is shown to ask the user to which revision the update should go.  
:commit Opens the commit dialog. The path specifies the target directory or the list of files to commit. You can also specify the /logmsg switch to pass a predefined log message to the commit dialog. Or, if you don't want to pass the log message on the command line, use /logmsgfile:path, where path points to a file containing the log message.  
:add Adds the files in /path to version control.  
:revert Reverts local modifications of a working copy. The /path tells which items to revert.  
:cleanup Cleans up interrupted or aborted operations and unlocks the working copy in /path.  
:resolve Marks a conflicted file specified in /path as resolved. If /noquestion is given, then resolving is done without asking the user first if it really should be done.  
:repocreate Creates a repository in /path  
:switch Opens the switch dialog. The path specifies the target directory.  
:export Exports the working copy in /path to another directory. If the /path points to an unversioned directory, a dialog will ask for an URL to export to the dir in /path.  
:merge Opens the merge dialog. The path specifies the target directory.  
:copy Brings up the branch/tag dialog. The /path is the working copy to branch/tag from.  
:settings Opens the settings dialog.  
:remove Removes the file(s) in /path from version control.  
:rename Renames the file in /path. The new name for the file is asked with a dialog.  
:diff Starts the external diff program specified in the TortoiseSVN settings. The /path specifies the first file. If the option /path2 is set, then the diff program is started with those two files. If /path2 is ommitted, then the diff is done between the file in /path and its BASE.  
:conflicteditor Starts the conflicteditor specified in the TortoiseSVN settings with the correct files for the conflicted file in /path.  
:relocate Opens the relocate dialog. The /path specifies the working copy path to relocate.  
:help Opens the help file.  
:repostatus Opens the check-for-modifications dialog. The path specifies the working copy directory.  
:repobrowser Starts the repository browser dialog, pointing to the URL of the working copy given in /path or /path points directly to an URL. An additional option /rev:xxx can be used to specify the revision which the repository browser should show. If the /rev:xxx is omitted, it defaults to HEAD.  
:ignore Adds all targets in /path to the ignore list, i.e. adds the svn:ignored property to those files.  
:blame Opens the blame dialog for the file specified in /path.  
:cat Saves a file from an URL or working copy path given in /path to the location given in /savepath:path. The revision is given in /revision:xxx. This can be used to get a file with a specific revision.  
:createpatch Creates a patch file for the path given in /path.  
:revisiongraph Shows the revision graph for the path given in /path.  
:lock Locks a file. The 'lock' dialog is shown so the user can enter a comment for the lock. /path  
:rebuildiconcache Rebuilds the windows icon cache. Only use this in case the windows icons are corrupted. A side effect of this (which can't be avoided) is that the icons on the desktop get rearranged. /noquestion  

Databases

SQL Server: sqlcmd / isql

Description: Execute SQL commands using sqlcmd or isql utility and capture output.
Command: sqlcmd.exe (MSSQL 2005) or isql.exe (previous versions)
Argument: -S HOST -U USERNAME -P PASSWORD -e -d $(Prompt) -Q "$(CurSel)"
Check: "Capture output"
Notes: Prompts for a database name and executes the selected (highlighted) statement
Posted By: Kai Hilton-Jones

Oracle: SQL*Plus

Description: Execute SQL commands using SQL*Plus utility and capture output.

First create and save a DOS batch file (sqlplus.bat):

@echo off
SET SQL=%1
SET SQL=%SQL:"=%
echo %SQL%; | sqlplus USERNAME/PASSWORD@SCHEMA

Command: c:\path\to\sqlplus.bat
Argument: "$(CurSel)"
Check: "Capture output"
Notes: The batch file pipes the selected statement to SQL*Plus and outputs the result.
Posted By: Kai Hilton-Jones

Oracle: Compile PL\SQL

Description: Compile PL\SQL Procedure, function, packages and triggers.

Create and save a DOS batch file (compilsql.bat):

@echo off
echo exit;|echo show errors; |sqlplus -S %1 @%2

Command: c:\(Your Path)\compilsql.bat
Argument: $(Prompt) $(FileName)
Initial Directory : $(FileDir)
Check: "Capture output" and "Save open files"
Notes: The batch file prompts for the username, password and Database, compiles the current file and shows the compilation errors
The username, password and database should be passed like this: USER/PASSWORD@DATABASE
Posted By: Raed Jribi

Miscellaneous

Function List

Description: I use this to show functions and classes in the output window. This will work on winXP or win2000. The regular expression may also need modified to your preference. Note: The function window Ctrl+F11 can also be used but this tool will allow you to view both your code and the functions at the same time.
Command: findstr /R /I /N "public.*{$ protected.*{$ private.*{$ static.*{$" $(FileName)
Argument: $(FileName)
Check: "Capture output"
Output Pattern:

  • Regular Expression: ^([0-9]+):
  • Regular Expression Line: Tagged Expression 1

Posted By: Brett Batie

Python Function List

Based on the above:

Command: findstr /n /o /r "\<def\>"
Argument: $(FilePath)
Check: "Capture output"
Output Pattern:

  • Regular Expression: ^([0-9]+):([0-9]+):
  • File name: None
  • Line: Tagged Expression 1
  • Column: Tagged Expression 2

Posted By: Igor Kogan

JRuler

Website: http://www.spadixbd.com/freetools/jruler.htm Description: I use the standard free ruler to measure the size of images, tables, content area, etc. It adds a ruler to your screen to measure anything!
Posted By: Dean Householder

CoolRuler

Website: http://www.fabsoft.com/products/ruler/ruler.html Description: A Free full featured pixel/inch/etc. Ruler. Much like JRuler, but with more features.
Posted By: John Morse

Markdown Syntax

Website: http://daringfireball.net/projects/downloads/Markdown_1.0.1.zip Description: Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML). Great for writing blog posts.
Command: perl Markdown.pl
Check: "Run as text filter"
Posted by: Ankit Solanki.

N.B. You will need to specify the location of both perl and Markdown.pl - EditPlus will not find them if they are in the path.

Make file writeable

Description: clears the read-only file attribute on the current file.
Command: attrib.exe
Argument: -R "$(FilePath)"
Check: "Close window on exit"

Parse 1-n ranges into text, ie [0-9]

Description: Parses an unlimited number of numeric, alpha, alphanumeric, hex or octal ranges into text.
Author: Mark Kahn
Command: cscript //NoLogo "c:\path to file\file.js"
Check: "Run as text filter"
Notes: Take the code and save it as a .js file. Returns 1 copy of exactly what you send it for each replacement necessary. So if you want it to return 1 entry per line, make sure you select a linebreak when running this tool.
Example:

Input:  [0x00-0x20] 
Output: 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20

Input:  Option #[1-5][A-B], or reversed: [\1][\0]
Output:
Option #1A, or reversed: A1
Option #1B, or reversed: B1
Option #2A, or reversed: A2
Option #2B, or reversed: B2
Option #3A, or reversed: A3
Option #3B, or reversed: B3
Option #4A, or reversed: A4
Option #4B, or reversed: B4
Option #5A, or reversed: A5
Option #5B, or reversed: B5

Input:  [ZX-102]
Output:
ZX
ZY
ZZ
100
101
102

Code:

var stdin   = WScript.StdIn;
var stdout  = WScript.StdOut;

Array.prototype.exists=function(e){return this.find(e)>=0;}
Array.prototype.find  =function(e){for(var i=0;i<this.length;i++)if(this[i]==e)return i;return -1;}

var input, results, matches;

var bases = [
	'0123456789ABCDEF',
	'01234567',
	'0123456789',
	'abcdefghijklmnopqrstuvwxyz',
	'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
	'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
	'0123456789abcdefghijklmnopqrstuvwxyz',
	'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',
	'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
];

function baseToNum(str, base){
	var tbase = bases[base];
	var cnt   = tbase.length;
	var out   = 0;
	var zeros = tbase.substr(0, 1)=='0';
	if(!zeros) tbase = ' '+tbase;

	for(var i=0, j=str.length; i<j; i++){
		var dataVal = tbase.indexOf(str.charAt(i));
		out         = out * cnt + dataVal;
	}

	return out-(zeros?0:1);
}

function numToBase(num, base){
	var tbase = bases[base];
	var cnt   = tbase.length;
	var out   = '';
	var zeros = tbase.substr(0, 1)=='0';

	if(num==0) return tbase.substr(0, 1);

	if(zeros){
		while(num){
			out = tbase.substr(num % cnt, 1) + out;
			num = Math.floor(num / cnt);
		}
	} else {
		var root=1, check=1, check2=0, rttl = 0;
		while(num>=rttl){
			check2 = Math.pow(cnt, root++);
			out    = tbase.substr(Math.floor((num-rttl)/check)%cnt, 1) + out;
			check  = check2;
			rttl  += check;
		}
	}

	return out;
}

function getMode(str){
	if(str.length==0) return -1;
	if((str.indexOf('0x')==0) && /^[0-9A-F]+$/.test(str.substr(2))){                     return 0;
	}else if((str.indexOf('0')==0) && (str.length>1) && /^[0-7]+$/.test(str.substr(1))){ return 1;
	}else if(/^[0-9]+$/      .test(str)){                                                return 2;
	}else if(/^[a-z]+$/      .test(str)){                                                return 3;
	}else if(/^[A-Z]+$/      .test(str)){                                                return 4;
	}else if(/^[A-Za-z]+$/   .test(str)){                                                return 5;
	}else if(/^[a-z0-9]+$/   .test(str)){                                                return 6;
	}else if(/^[A-Z0-9]+$/   .test(str)){                                                return 7;
	}else if(/^[A-Za-z0-9]+$/.test(str)){                                                return 8;
	}
	return -1;
}

function strip(num){
	while((num.indexOf('0')==0)&&(num.length>1)) num=num.substr(1);
	if   ((num.indexOf('x')==0)&&(num.length>1)) num=num.substr(1);
	return num;
}

function decNumber(num, mode){
	switch(mode){
		case 0: return parseInt(strip(num), 16); break;
		case 1: return parseInt(strip(num), 8);  break;
		case 2: return eval(strip(num));         break;
		case 3: return baseToNum(num, 3);        break;
		case 4: return baseToNum(num, 4);        break;
		case 5: return baseToNum(num, 5);        break;
		case 6: return parseInt(num, 36);        break;
		case 7: return parseInt(num, 36);        break;
		case 8: return baseToNum(num, 8);        break;
	}
}

function modeNumber(num, mode){
	switch(mode){
		case 0: return num.toString(16);               break;
		case 1: return num.toString(8);                break;
		case 2: return num;                            break;
		case 3: return numToBase(num, 3);              break;
		case 4: return numToBase(num, 4);              break;
		case 5: return numToBase(num, 5);              break;
		case 6: return num.toString(36);               break;
		case 7: return num.toString(36).toUpperCase(); break;
		case 8: return numToBase(num, 8);              break;
	}
}

function readMode(str1, str2){
	var mode1 = getMode(str1);
	var mode2 = getMode(str2);
	if((mode1==-1)||(mode2==-1)) return -1;
	mode  = mode1>mode2?mode1:mode2;
	if(mode>1){
		var lc = [3,5,6,8].exists(mode1)||[3,5,6,8].exists(mode2);
		var uc = [4,5,7,8].exists(mode1)||[4,5,7,8].exists(mode2);
		var nm = [2,6,7,8].exists(mode1)||[2,6,7,8].exists(mode2);

		mode = lc?uc?nm?8:5:nm?6:3:uc?nm?7:4:nm?2:1;
		if(mode==-1) return;
	}

	i1    = decNumber(str1, mode);
	i2    = decNumber(str2, mode);

	return {mode:mode, start:i1, end:i2};
}

function parseData(input, depth){
	var out = '';
	var rx  = /(\[(&?[0-9A-Za-z]+)-(&?[0-9A-Za-z]+)\])/gi;
	var rx2 = /(\[(&?[0-9A-Za-z]+)-(&?[0-9A-Za-z]+)\])/gi;
	if(!rx.test(input)) return input;

	var matches = rx2.exec(input);
	var match   = matches[1];
	var start   = matches[2];
	var end     = matches[3];

	var sett    = readMode(start, end);

	for(var i=sett.start, j=sett.end; i<=j; i++){
		var mn = modeNumber(i, sett.mode);
		out+=parseData(input.replace(match, mn).replace(new RegExp('\\[\\\\'+depth+'\\]', 'g'), mn), depth+1);
	}
	return out;
}

stdout.Write(parseData(stdin.ReadAll(), 0));

Full RegEx Supported Replace and More!

Description: Does a full regular expression replace based on the file or expression.
Author: Mark Kahn
Command: cscript //NoLogo "c:\path to file\file.js"
Check: "Run as text filter"
Notes: The first line of whatever you send has to be the regular expression you want parsed. The 2nd line is what you want it replaced with. Anything on the replace line between { and } sets is eval'd in JavaScript, meaning if you can do TONS of stuff that isn't possible with normal Regular Expressions, like {$1*$2} which will multiple the first match times the second.
Example:

Input:
══════
/([0-9])([0-9]+)/gi
{Math.pow($1, {$2})}
26
55
12
21
222
555
---123---
══════

Output:
══════
64
3125
1
2
4194304
2.77555756
---1---
══════



Input:
══════
/(id=")([0-9]+)(")/gi
$1{$2+1}$3
<xml>
    <row id="5" />
    <row id="6" />
    <row id="7" />
</xml>
══════

Output:
══════
<xml>
    <row id="6" />
    <row id="7" />
    <row id="8" />
</xml>
══════



Input:
══════
/([\w ]+)/gi
{'$1'.length+' - '+'$1'}
this is a test
this is the 2nd line of code
3rd line
4th
══════

Output:
══════
14 - this is a test
28 - this is the 2nd line of code
8 - 3rd line
3 - 4th
══════



Add Numbers to Input:
══════
/(.+)/gi
{1+j++}: $1
a
b
c
══════

Output:
══════
1: a
2: b
3: c
══════



Renumber Input:
══════
/(\d)\s+(.+)/gi
{1+j++}        $2
1        a
5        e
4        d
══════

Output:
══════
1        a
2        e
3        d
══════


Code:

var stdin  = WScript.StdIn;
var stdout = WScript.StdOut;

var j = 0;

function RepText(text){
	if(/.*({[^{}]+}).*/gi.test(text)){
		var match = text.replace(/.*({[^{}]+}).*/gi, "$1");
		text      = text.replace(match, eval(match.substr(1, match.length-2)));
		return text;
	}else{
		return -1;
	}
}
function parseText(text, RX2, RP){
	var matches, results=[], res
	var RX = eval(RX2), text2=text;

	while(matches = RX.exec(text2)){
		if(matches[0]=='') continue;
		text = text.replace(matches[0], "{{MATCH}}");
		results.push(matches[0]);
	}

	for(var i=0; i<results.length; i++){
		res  = results[i].replace(RX, RP);
		while((result=RepText(res))!=-1) res=result;
		text = text.replace("{{MATCH}}", res);
	}
	return text;
}
var text  = stdin.ReadAll();
var lines = text.split("\n");

var RX = eval(lines[0]);
var RP = lines[1].replace(/\r\n/, '');
text   = lines.splice(2, lines.length).join('\n');
RP     = RP.substr(0, RP.length-1)

text   = (/.*({[^{}]+}).*/gi.test(RP))?parseText(text, RX, RP):text.replace(RX, RP)

stdout.Write(text);

Fix Code Spacing

Description: "Fixes" code spacing by aligning = signs, :'s, etc. Makes code much easier to read.
Author: Mark Kahn
Command: cscript //NoLogo "c:\path to file\file.js"
Check: "Run as text filter"
Example:

Input:
══════
.text_blue_small {
	font-size:11px;
	color:#4C82D8;
	text-decoration:none;
	padding-left:10px;
}
#wrapper {
	background:white;
	width:800px;
	margin:0 auto;
	border:1px solid #999999;
	padding:0px;
}
══════

Output:
══════
.text_blue_small {
	font-size       : 11px;
	color           : #4C82D8;
	text-decoration : none;
	padding-left    : 10px;
}
#wrapper {
	background      : white;
	width           : 800px;
	margin          : 0 auto;
	border          : 1px solid #999999;
	padding         : 0px;
}
══════



Input:
══════
$someArray = array(
	'field'=>'data',
	'another field'=>'some more data',
	'etc'=>'etc'
);
══════

Output:
══════
$someArray = array(
	'field'         => 'data',
	'another field' => 'some more data',
	'etc'           => 'etc'
);
══════



Input:
══════
a=5;
b=20;
dog=30;
some_really_really_long_variable_name=40;
══════

Output:
══════
a                                     = 5;
b                                     = 20;
dog                                   = 30;
some_really_really_long_variable_name = 40;
══════

Code:

// settings

var ignore      = ['<%', '%>', '<?', '?>'];
var splitVals   = ['===', '!==', '==', '=>', '!=', '+=', '-=', '*=', '/=', '->', '=', ':', '?'];
var noPreSpace  = ['?'];
var noPostSpace = ['?'];
var quoteChars  = ['"', "'"];
var escapeChar  = '\\';

// do not edit below this line

var stdin       = WScript.StdIn;
var stdout      = WScript.StdOut;
var input       = stdin.ReadAll();

var maxSplit    = 0;
var splits      = [];
var lines       = input.split('\n');
var output      = '';
var currentLine, currentSplit, inQuote, spaces, j, currentLineString, i, isSplit;

String.prototype.trim  = function() {return this.replace(/^ +/,'').replace(/ +$/,'');}
Array.prototype.exists = function(e){return this.find(e)>=0;}
Array.prototype.find   = function(e){for(var i=0;i<this.length;i++)if(this[i]==e)return i;return -1;}

for(var i=0; i<splitVals.length; i++) if(splitVals[i].length>maxSplit) maxSplit = splitVals[i].length;

function doLoop(mid, end){
	for(i=0; i<lines.length; i++){
		currentLine  = lines[i];
		currentSplit = splits;
		inQuote      = '';
		curStr       = '';
		spaces       = 0;

		loop2:
		for(j=0; j<currentLine.length; j++){
			currentLineString = currentLine.substr(j, maxSplit);

			for(var k=0; k<ignore.length; k++){
				var splitValue = ignore[k];
				if(currentLineString.indexOf(splitValue)==0){
					j      += splitValue.length-1;
					curStr += splitValue;
					continue loop2;
				}
			}

			if(currentLineString.substr(0, 1) == escapeChar){
				j++;
				curStr += currentLineString.substr(0, 2);
				continue;
			}
			if((inQuote=='') && (quoteChars.exists(currentLineString.substr(0, 1)))){
				inQuote = currentLineString.substr(0, 1);
				curStr += currentLineString.substr(0, 1);
				continue;
			}
			if(currentLineString.substr(0, 1)==inQuote){
				inQuote = '';
				curStr += currentLineString.substr(0, 1);
				continue;
			}
			if(inQuote!=''){
				curStr += currentLineString.substr(0, 1);
				continue;
			}

			isSplit = false;

			if(mid) mid();

			if(!isSplit) curStr += currentLineString.substr(0, 1);
		}

		if(end) end();
	}
}

function x(){
	for(var k=0; k<splitVals.length; k++){
		var splitValue = splitVals[k];
		if(currentLineString.indexOf(splitValue)==0){
			j += splitValue.length-1;
			if(!currentSplit[splitValue]){
				currentSplit[splitValue] = {max:curStr.trim().length, ary:[]};
			} else {
				if(curStr.trim().length>currentSplit[splitValue].max) currentSplit[splitValue].max = curStr.trim().length;
			}
			curStr       = '';
			currentSplit = currentSplit[splitValue].ary;
			isSplit      = true;
			break;
		}
	}
}

function y(){
	for(var k=0; k<splitVals.length; k++){
		var splitValue = splitVals[k];
		if(currentLineString.indexOf(splitValue)==0){
			var preSpace  = ' ';
			var postSpace = ' ';
			for(var l=0; l<noPreSpace.length;  l++) if(noPreSpace[l] ==splitValue) preSpace  = '';
			for(var l=0; l<noPostSpace.length; l++) if(noPostSpace[l]==splitValue) postSpace = '';

			j      += splitValue.length-1;
			var aLen = currentSplit[splitValue].max - curStr.trim().length + 1;
			if(aLen<0) alert(currentLine.substr(j));
			output += curStr.trim() + new Array(aLen).join(' ') + preSpace + splitValue + postSpace
			if(!currentSplit[splitValue]){
				currentSplit[splitValue] = {max:curStr.trim().length, ary:[]};
			} else {
				if(curStr.trim().length>currentSplit[splitValue].max) currentSplit[splitValue].max = curStr.trim().length;
			}
			currentSplit = currentSplit[splitValue].ary;
			isSplit      = true;
			curStr       = '';
			break;
		}
	}
}

function z(){ output += curStr.trim() + '\n'; }

doLoop(x);
doLoop(y, z);

stdout.Write(output.substr(0, output.length-1));

Fix Code Indentation

Description: "Fixes" JavaScript/PHP/C++/etc code indentation by throwing away most starting indentation and replacing it based on braces & parenthesis. The script will ignore spacing that is inside sets of parenthesis, i.e. function variables that are aligned.
Known Bugs: Does not ignore PHP "heredoc" strings: e.g. "<<<EOF .... EOF;" blocks. It will format these as it would any other block of code.
Author: Mark Kahn
Command: cscript //NoLogo "c:\path to file\file.js"
Check: "Run as text filter"
Example:

Input:
══════
function foo(a,
             b,
             c){
while(bar){
       if(x){
for(i=0; i<10; i++){
//do stuff;
}
}
    }
}
══════

Output:
══════
function foo(a,
             b,
             c){
	while(bar){
		if(x){
			for(i=0; i<10; i++){
				//do stuff;
			}
		}
	}
}
══════

Code:

var stdin        = WScript.StdIn;
var stdout       = WScript.StdOut;
var input        = stdin.ReadAll();

var lines        = input.split('\n');
var output       = [];

String.prototype.trim  = function() {return this.replace(/^[ \t]+/,'').replace(/[ \t]+$/,'');}

var countParen   = 0;
var countIndent  = 0;
var startSpaces  = [];

for(var i=0, m=lines.length; i<m; i++){
	var lineTrimmed  = lines[i].trim();
	if(lineTrimmed==''){ output.push(''); continue; }

	var line         = lineTrimmed.replace(/(\'[^\']*\'|\"[^\"]*\")/g, '');
	while(/\([^\)\(]*\)/g.test(line)){ line = line.replace(/\([^\)\(]*\)/g,  ''); }
	while(/\{[^\}\{]*\}/g.test(line)){ line = line.replace(/\{[^\}\{]*\}/g, '');  }
	while(/\/\//g.test(line)){         line = line.replace(/\/\/.*/g, '');        }

	var openParen   = line.split('(').length - 1;
	var closeParen  = line.split(')').length - 1;
	var openIndent  = line.split('{').length - 1;
	var closeIndent = line.split('}').length - 1;

	if(lineTrimmed.indexOf('}')==0) { // starts with }
		var startingClose = 0;
		while(lineTrimmed.substr(startingClose, 1)=='}'){ startingClose++; }
		var start = new Array(countIndent+1-startingClose).join('\t');
	}else{
		addSpaces = 0;
		if(countParen>0){
			var addSpaces    = countOpeningSpaces(lines[i]) - startSpaces[0];
			if(addSpaces<0){ addSpaces = 0; };
		}
		var start        = (new Array(countIndent+1).join('\t'))+(addSpaces?(new Array(addSpaces+1).join(' ')):'');
	}

	output.push(start+lineTrimmed);

	for(var j=0; j<closeParen; j++){ startSpaces.pop(); }
	for(var j=0; j<openParen; j++){
		startSpaces.push(j<openParen-1?0:countOpeningSpaces(lines[i]));
	}

	countParen  += openParen - closeParen;
	countIndent += line.split('{').length - line.split('}').length;
}

function countOpeningSpaces(str){
	str = str.replace(/\t/g, '   ');
	return str.length - str.replace(/^ +/, '').length;
}

stdout.Write(output.join('\n'));

Full Prompted RegEx Replace

Description: Full reg-ex support for a normal find/replace. It prompts you for two arguments, the first being the regex in a linux style syntax, the second being what to replace the regex with. The first argument should look like: "/[re][ge]x/gi", without the quotes. Your regular expression goes between the two /'s and the "gi" at the end mean: "g" means global - you will almost always want this as it allows multiple replaces. Without "g", the regex will stop after the first match. "i" means "ignore case".
Author: Mark Kahn
Command: cscript //NoLogo "c:\path to file\file.js"
Check: "Run as text filter"
Code:

var stdin  = WScript.StdIn;
var stdout = WScript.StdOut;
var arg1   = WScript.arguments(0);
var arg2   = WScript.arguments(1);
var text   = stdin.ReadAll().replace(eval(arg1), arg2);
stdout.Write(text);

XML Beautifier

Description: Simply formats an XML document by stripping whitespace and adding it back in.
Author: Mark Kahn
Command: cscript //NoLogo "c:\path to file\file.js"
Check: "Run as text filter"
Code:

var stdin  = WScript.StdIn;
var stdout = WScript.StdOut;

var xml = WScript.createObject("MSXML2.DomDocument");
xml.loadXML(stdin.ReadAll().replace(/\t/g, '').replace(/\r|\n/g, '').replace(/\>\</g, '>\n<'));

stdout.Write(xml.xml.substr(0, xml.xml.length-2));

Transpose Array

Description: Swap rows for columns in tab-separated text. Great for use with a spreadsheet.
Author: jimbo
Command: cscript //NoLogo "c:\path to file\file.js"
Check: "Run as text filter"
Example:

Input:
======
a	b	c
1	2	3	4
alpha	beta	gamma
======

Output:
======
a	1	alpha
b	2	beta
c	3	gamma
	4
======

Code:

var stdin  = WScript.StdIn;
var stdout = WScript.StdOut;

var text  = stdin.ReadAll();
var lines = text.split(/\s*\n/g);
var maxcols = lines.length-1;
var maxrows=0;
var line,parts=[], part,out;

// split it out and size it up
for (var i=0;i<lines.length;i++) {
	parts[i] = lines[i].split('\t');
	maxrows = Math.max(maxrows,parts[i].length);
}

// spit it back out
for (var i=0;i<=maxrows;i++) {
	out = '';
	for (var j=0;j<=maxcols;j++) { out += ( parts[j][i] || '' )+'\t' }
	// trim trailing tabs
	stdout.Write(out.replace(/\t+$/,''));
	// don't write an extra newline
	if (i<=maxrows-1) { stdout.Write('\n') }
}

Natural Sort

Description: .
Author: jimbo
Command: cscript //NoLogo "c:\path to file\file.js"
Check: "Run as text filter"
Get File: Get and save javascript natcompare.js via http://sourcefrog.net/projects/natsort/ to whatever directory this script is in.
Example:

Input:
======
04-08-10
04-1-15
05-1-1
======

Output:
======
04-1-15
04-08-10
05-1-1
======

Input:
======
id10TFier.v1.10
id10TFier.v1.10.1
id10TFier.v1.9.3
======

Output:
======
id10TFier.v1.9.3
id10TFier.v1.10
id10TFier.v1.10.1
======

Code:

var stdin  = WScript.StdIn;
var stdout = WScript.StdOut;

eval(new ActiveXObject("Scripting.FileSystemObject").OpenTextFile("natcompare.js",1).ReadAll());

var text  = stdin.ReadAll();
var lines = text.split(/\s*\n/g);

stdout.Write(lines.sort(natcompare).join('\n'));

Alternate Function List With JS

Description: It show function list like "Search in files" command: You can see the line number, and click it on.
Author: Laszlo Szalai
Command: cscript //NoLogo "c:\path to file\file.js"
Argument: $(FilePath) "^[ \t]*([A-Za-z0-9_]*[ \t]*function[ \t]*[A-Za-z0-9_]+\([^;]*)$"
Check: "Text filter to Output Window"
Click on Output Pattern... button
UnCheck: Use default output pattern
Regular expression: ^\(([0-9]+)\)[ \t]*:
Regular expression tags:
File name: Not Defined
Line: Tagged Expression 1
Column: Not Defined
Code:

var stdin        = WScript.StdIn;
var stdout       = WScript.StdOut;
var input        = stdin.ReadAll();
var rexp         = WScript.arguments(0);

var sorok        = input.split('\n');
var ret          = [];

for(var i=0, m=sorok.length; i<m; i++){
	var sor = new String(sorok[i]);

	xpr = new RegExp(rexp, "i");
	r  = xpr.exec(sor);
	if(r != null) {
		ret.push('('+(i+1)+') \t:\t'+sor);
	}

}
stdout.Write(ret.join('\n'));

Full PHP RegEx

Description: You can use all php regex and function.
Author: Jean Pierre DAviau
Command: pathTo/php.exe -f "C:\yourPath\test.php"</tt>
Check: "Run as text filter"
Disclaimer: It does work for me.


Editregphp.jpg

Example:


Input:
<p><strong>Author:</strong><a href="http://jeanpierredaviau.com" target="_blank">
Jean Pierre Daviau</a></p>
<p><center><div id="final">
<img src="images/snowtransparentmin.png" width="92" height="250" alt="-" />
<a href="images/final.png" target="_blank">full resolution on black background</a><br />
<a href="images/snow.zip">Get the zipped files</a></td>
<td><img src="images/snowbgImages256.gif" width="90" height="250" alt="-" /></td>

Output:
--------------------
 0  final.png
 1  jeanpierredaviau.com
 2  snow.zip">Get
 3  snowbgImages256.gif
 4  snowtransparentmin.png

</pre> Code:

<?php
if($ligne = file_get_contents('php://STDIN'))
{}else{echo "There is a file_get_contents";}
$searchfor  = '# (?: src|href ) = ["\'\s]? [^"\'\s]*? ([^/\s]*?) ["\'\s]? (?:\s|/>) #ismx';
echo  "\n";

preg_match_all($searchfor, $ligne, $matches);

$doubles = array_unique ($matches[1]);
sort($doubles);
$buffer = "";

echo "--------------------\n";

	foreach($doubles as $key=>$value){
		printf("%2.0f",  $counter++);
		echo   '  ' . $value. "\n";
		}

echo  "\n";
 ?>
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox