3 <implements type="Automation" id="dispatcher">
4 <property name="PluginEvent">
7 <property name="PluginDescription">
10 <method name="MakeUpper"/>
11 <method name="MakeLower"/>
12 <method name="SortAscending"/>
13 <method name="SortDescending"/>
14 <method name="ExecFilterCommand"/>
17 <script language="VBS">
20 Function get_PluginEvent()
21 get_PluginEvent = "EDITOR_SCRIPT"
24 Function get_PluginDescription()
25 get_PluginDescription = "Basic text functions for the context menu"
28 Function IsLangJapanese()
32 languageId = CLng(wsh.RegRead(REGKEY_PATH & "\Locale\LanguageId"))
33 IsLangJapanese = (languageId = 1041)
36 ' transformation functions
37 Function MakeUpper(Text)
38 MakeUpper = UCase(Text)
41 Function MakeLower(Text)
42 MakeLower = LCase(Text)
45 Function ExecFilterCommand(Text)
47 If IsLangJapanese() Then
48 cmd = InputBox("
\8c»
\8dÝ
\82Ì
\91I
\91ð
\94Í
\88Í
\82Ì
\95¶
\8e\9a\97ñ
\82ð
\83t
\83B
\83\8b\83^
\83R
\83}
\83\93\83h
\82Å
\8f\88\97\9d\82µ
\82½
\8c\8b\89Ê
\82Å
\92u
\8a·
\82µ
\82Ü
\82·
\81B
\83R
\83}
\83\93\83h
\82ð
\93ü
\97Í
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B")
50 cmd = InputBox("Enter filter command to replace the selection.")
53 If IsLangJapanese() Then
54 Err.Raise 30001, , "
\83L
\83\83\83\93\83Z
\83\8b\82³
\82ê
\82Ü
\82µ
\82½"
56 Err.Raise 30001, , "Canceled"
65 Set wsh = CreateObject("WScript.Shell")
66 path = wsh.ExpandEnvironmentStrings("%TEMP%\_winmerge_addin_temp_.txt")
70 Set fso = CreateObject("Scripting.FileSystemObject")
71 Set ts = fso.CreateTextFile(path)
79 Set exe = wsh.Exec("cmd /c type """ & path & """ | " & cmd & " 2>&1")
80 If exe Is Nothing Then
81 If IsLangJapanese() Then
82 MsgBox "
\83R
\83}
\83\93\83h " & cmd & "
\82Ì
\8eÀ
\8ds
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½:" & Err.Description
84 MsgBox "Failed to execute the command '" & cmd & "':" & Err.Description
90 ExecFilterCommand = ""
91 Do Until exe.StdOut.AtEndOfStream
92 ExecFilterCommand = ExecFilterCommand & exe.StdOut.ReadLine & vbCrLf
102 <script language="JScript">
104 function SortAscending(Text) {
105 var eol = Text.match(/\r\n|\n|\r/);
106 var lines = Text.split(eol);
108 if (lines.length == 1) {
110 } else if (lines[lines.length - 1] == "") {
112 return lines.sort().join(eol) + eol;
114 return lines.sort().join(eol);
118 function SortDescending(Text) {
119 var eol = Text.match(/\r\n|\n|\r/);
120 var lines = Text.split(eol);
122 if (lines.length == 1) {
124 } else if (lines[lines.length - 1] == "") {
126 lines.sort(function(a, b) { return a < b ? 1 : -1; });
127 return lines.join(eol) + eol;
129 return lines.sort(function(a, b) { return a < b ? 1 : -1; }).join(eol);