UltraEdit 脚本命令

脚本命令      
UltraEdit/UEStudio 的脚本通过嵌入 JavaScript 引擎启用。 这允许用户在享受完整 JavaScript 语言的强大和灵活的同时使用以下指定的命令与编辑器(应用程序对象命令),或在编辑器中打开的文档(文档对象命令)进行特别交互。 脚本可以在 UltraEdit/UEStudio 中编辑,在默认词语文件中带有内置 JavaScript 的语法加亮:


 






 


脚本引擎支持 JavaScript 1.7 的核心功能。 有关 JavaScript 的更多信息,请参考相关的 Mozilla 网站 (http://developer.mozilla.org/en/docs/JavaScript)。  


 


例如,该脚本将生成一系列数字并将其写入活动的文档:


 


function recall(num) {


  UltraEdit.activeDocument.write(num + "\r\n");


}


function num() {


  var i = 0, j = 1, n = 0;


  while (n < 10) {


    recall(i);


    var t = i;


    i = j;


    j += t;


    n++;


  }


}


num();


 


更多演示脚本位于安装目录的“scripts”子目录下。要查看简短的脚本指南,请点击这里。


 


在脚本中包含脚本


需要的话,用户可以在脚本中包含一个外部脚本,参考以下的方法:


 


// include externalScript.js


 





 


// include C:\full path\to external\script\externalScript.js


 


这个包含命令必须在前面加上行注记符。如果一个用户因调试的原因要排除这个包含的脚本,所包含的内容可以以两个行注记排除,如:


 


// // include externalScript.js


 


预设变量值


UltraEdit 支持一些变量值,当每次 UltraEdit 有脚本启动时它们会被初始化为预设值:


 


区块模式均为关闭。


十六进制模式均为关闭。


插入模式均为打开。


正则表达式引擎均设置为 Perl。


 


这些项会在每次运行一个脚本时被设置。


 


应用程序对象命令


UltraEdit 是全部 UltraEdit 操作所基于的应用程序对象。以下命令作用于编辑器而非活动文档。 除非注明其他参数,否则所有应用程序对象命令都必须使用下列格式调用:


  
UltraEdit.commandName();


 


下表说明了应用程序对象命令:


命令
 参数*
 说明
 
clearClipboard
   清除活动的剪贴板。
 
clipboardContent
 ** 这是只读属性。
 返回当前剪贴板内容。例如:


var clip = UltraEdit.clipboardContent;
 
clipboardIdx
 ** 这是只读属性。
 返回当前剪贴板的索引。例如:


var clip = UltraEdit.clipboardIdx;
 
closeFile
 文件路径


保存模式


  0 - 提示保存


  1 - 保存并关闭


  2 - 关闭不保存
 关闭活动的文件。例如:


 


UltraEdit.closeFile("C:\\temp\\test.txt",2);


 


*注意:在参数中使用的任何反斜线必须按以上显示进行换码(即使用“\\”而非“\”)。
 
columnMode
 ** 这是只读属性。
 返回布尔值说明列模式是否活动。例如:


var columnActive = UltraEdit.columnMode;
 
columnModeOff
  
 关闭列模式。例如:


UltraEdit.columnModeOff();


*注意:脚本处理完成后当前列模式状态将恢复。
 
columnModeOn
  
 打开列模式。例如:


UltraEdit.columnModeOn();
 
decryptFilePrompt
  
 显示解密文件对话框。 例如:


UltraEdit.decryptFilePrompt();
 
encryptFilePrompt
  
 显示加密文件对话框。 例如:


UltraEdit.encryptFilePrompt();
 
frInFiles
 .directoryStart 字符串 搜索开始的 
完整路径 
.filesToSearch 整数 值: 
 
    0 - 列出的文件
   1 - 打开的文件
   2 - 收藏的文件
   3 - 项目文件
   4 - 解决方案文件 
.matchCase 布尔值 true/false 
.matchWord 布尔值 true/false 
.regExp 布尔值 true/false 
.searchSubs 布尔值 true/false 
.unicodeSearch 布尔值 true/false 
.searchInFilesTypes   字符串 搜索的文件/类型 
 
 范围 
.find ("要搜索的字符串"); 
.replace ("要搜索的字符串", "替换字符串"); 
  
** 仅在替换中使用 ** 
.logChanges 布尔值 true/false 
.preserveCase 布尔值 true/false 
  
** 仅无法在替换中使用 ** 
.useOutputWindow 布尔值 true/false 
 在指定的文件中搜索,基于指定的参数查找引号 "" 中的字符串。 


在文件中查找示例:


UltraEdit.frInFiles.directoryStart = "c:\\temp\\";


UltraEdit.frInFiles.searchInFilesTypes = "*.txt";


UltraEdit.frInFiles.useOutputWindow = true;


UltraEdit.frInFiles.find("3939");


 


在文件中替换示例:


UltraEdit.frInFiles.directoryStart = "c:\\temp\\";


UltraEdit.frInFiles.searchInFilesTypes = "*.txt";


UltraEdit.frInFiles.useOutputWindow = true;


UltraEdit.frInFiles.replace("3939", "7878");


 


 
 
getString
 在提示对话框中使用的引号 ("") 中的字符串


 


可选参数:


0     int  


1     int     返回值
 提示用户在当前位置插入的字符串。 “提示”是指脚本运行时显示给用户的提示或问题。例如: 


 


UltraEdit.getString("What is your name?");


 





 


var str = UltraEdit.getString("What is your name?",1);


 


如果使用 int 值“1”,则输入的字符串将不会写入活动文件,但会另存为变量值并在运行的脚本中使用。
 
getValue
 在提示对话框中使用的引号 ("") 中的字符串


 


可选参数:


0     int  


1     int     返回值
 提示用户在当前位置插入的值。 “提示”是指脚本运行时显示给用户的提示或问题。例如: 


 


UltraEdit.getValue("How old are you?");


 





 


var str = UltraEdit.getValue("How old are you?",1);


 


如果使用 int 值“1”,则输入的字符串将不会写入活动文件,但会另存为变量 int 值并在运行的脚本中使用。
 
insertMode
  
 更改文本编辑模式中的字符输入为插入模式。
 
insOvrMode
 ** 这是只读属性。
 返回布尔值说明插入模式是否打开。例如:


var insertActive = UltraEdit.insOvrMode;
 
messageBox
 消息文本位于引号 ("") 中


标题文本位于引号 ("") 中(可选)
 显示带有“确定”按钮的消息对话框。例如:


UltraEdit.messageBox("Can't complete process", "Process Abort");
 
newFile
  
 打开新的空白文件。
 
open
 文件名在引号("")中 
 打开指定的文件。文件名必须在引号中。可以使用“^c”且 UltraEdit 会将其替换为剪贴板中的内容。例如:


UltraEdit.open("c:\\temp\\test.txt");





UltraEdit.open('^c');





UltraEdit.open("c:\\temp\\^c");





UltraEdit.open("FTP::myserver.com\\/home/mypath/


public_html|index.html"); 
 
overStrikeMode
  
 将文本编辑模式更改为输入字符的改写模式。
 
perlReOn
  
 将正则表达式切换为符合 Perl 样式的正则表达式。
 
regexMode
 ** 这是只读属性。
 返回数值表示活动的正则表达式类型。  


0 = UltraEdit 表达式


1 = Unix 表达式


2 = Perl 表达式


例如:


var regexType = UltraEdit.regexMode;
 
runTool
 引号 ("") 中的字符指定要运行的工具的区分大小写的菜单名。
 运行一个工具。该工具必须从高级菜单中的工具配置进行配置。例如:


UltraEdit.runTool("Script Tool");
 
save
  
 保存活动文件
 
saveAll
  
 保存所有活动文件
 
saveAs
 文件名在引号("")中 
 将活动文件用指定的文件名保存。文件名必须在引号中。文件名中可以使用“^s”。UltraEdit 将其取代为活动窗口中当前选中的文本。同样可以使用“^c”且 UltraEdit 会将其替换为剪贴板中的内容。


UltraEdit.saveAs("c:\\temp\\test.txt");





UltraEdit.saveAs("^s");





UltraEdit.saveAs("^c");
 
selectClipboard
 剪贴板号码 (0-9) 
 选择指定的剪贴板 0 = Windows 剪贴板,1-9 表示用户剪贴板。例如:


UltraEdit.selectClipboard(2);
 
ueReOn
  
 将正则表达式切换为 UltraEdit 样式的正则表达式。
 
unixReOn
  
 将正则表达式切换为 Unix 样式的正则表达式。
 


 


文档对象命令


document 是 JavaScript 阵列对象,阵列对象是 UltraEdit 应用程序对象的属性。 这是所有当前同时打开文档的阵列。activeDocument 参数可以用来指定要写入活动文件的输出,或者用户可以根据文件选项卡顺序指定文件的索引(即文档 [0], ... 文档 [8])。 例如:


 


UltraEdit.activeDocument.write("test");


 


将“test”写入当前文档,同时以下:


 


UltraEdit.document[4].write("test");


 


将允许用户打开多个文件并将指定的文本写入打开待编辑的第五个文件(根据文件标签的顺序)。


 


脚本中可以使用“//”进行注释,用于测试和文档。


 


脚本一旦创建后便可以编辑。请注意,“^c”和“^s”可能在很多脚本中应用,使用时将取代剪贴板中的内容(^c)和当前选中的内容(^s)。这允许用户创建引用特定字符串的脚本,并将字符串用 ^c 或 ^s 取代,以便在脚本运行时动态地“指定”字符串。以下命令作用于当前打开的文档进行编辑。 除非注明其他参数,否则所有文档对象命令都必须使用下列格式调用:


  
UltraEdit.activeDocument.commandName();


 


下表说明了文档对象命令:


命令
 参数*
 说明
 
ansiToOem
   将文件从 ANSI 转换为 OEM。例如:


UltraEdit.activeDocument.ansiToOem();
 
ASCIIToUnicode
  
 转换 ASCII 文件到 Unicode
 
bottom
  
 跳转到文件结尾。
 
codePage
 ** 这是一个活动/指定文件的属性。
 回传活动文件的页码值。例如:


var cp = UltraEdit.activeDocument.codePage;


可用来设置活动文件要使用的页码。例如:


UltraEdit.open("C:\\temp\\korean_file.txt")


UltraEdit.activeDocument.codePage = 949;
 
collapseAll
  
 折叠活动文件中所有可折叠的文本。 例如:


UltraEdit.activeDocument.collapseAll();
 
columnCenterJustify
  
 将选中的列居中调整。
 
columnCut
 要剪切的列编号数值
 在列模式中剪切选中的列或从当前光标位置到文件末尾的指定数量的列。要剪切选中的列必须使用值“0”。
 
columnDelete
 要删除的列编号数值
 在列模式中删除选中的列或从当前光标位置到文件末尾的指定数量的列。要删除选中的列必须使用值“0”。
 
columnInsert
 字符串位于引号 ("") 中 
 将引号中的字符串插入选中的列。
 
columnInsertNum
 起始数字 整数  
 
增量 整数  
 
列首补零 布尔值 true/false 
十六进制 布尔值 true/false 
 将数字插入选中的列。  如果没有选中的内容,则插入将从光标位置移至文件的最后一行。例如:


UltraEdit.activeDocument.columnInsertNum(2, 3 , false, true);
 
columnLeftJustify
  
 将选中的列居左调整。
 
columnRightJustify
  
 将选中的列居右调整。
 
copy
  
 将选中的文本复制到剪贴板。如果没有选中的内容,如果配置了当没有活动的选择时,启用当前行复制/追加选项,当前光标位置所在的行将被复制。
 
copyAppend
  
 复制选中的文本并将其追加到剪贴板。 如果没有选中的内容,如果配置了当没有活动的选择时,启用当前行复制/追加选项,当前光标位置所在的行将被复制。 
 
copyFilePath
  
 将活动文件的路径/名称复制到剪贴板。
 
currentChar
 ** 这是活动/指定文档的只读属性。
 返回光标处字符的值。例如:


var char = UltraEdit.activeDocument.currentChar;
 
currentColumnNum
 ** 这是活动/指定文档的只读属性。
 返回当前列号的值。 第一列编号为“0”。例如:


var col = UltraEdit.activeDocument.currentColumnNum;
 
currentLineNum
 ** 这是活动/指定文档的只读属性。
 返回当前行号的值。例如:


var lineNum = UltraEdit.activeDocument.currentLineNum;
 
currentPos
 ** 这是活动/指定文档的只读属性。
 返回值为当前位置到文件开头的字节数。例如:


var pos = UltraEdit.activeDocument.currentPos;
 
cut
  
 将选中内容从文件剪切到剪贴板。 如果没有选中的内容,则将剪切光标位置目前所在的行。
 
cutAppend
  
 将选中内容从文件中剪切并追加到剪贴板。 如果没有选中的内容,则将剪切光标位置目前所在的行。
 
deleteText
  
 删除当前字符或选中的文本。
 
deleteLine 
   删除当前的行。
 
deleteToEndOfLine 
   将从光标位置开始删除一直到行的结尾。
 
deleteToStartOfLine 
   将从光标位置开始删除一直到行的开始。
 
dosToMac 
   将文件(行终止符)转换为 MAC 格式。
 
dosToUnix 
   将文件(行终止符)转换为 UNIX 格式。
 
dupeLine
   在光标下插入活动行的复制。
 
encoding
 ** 这是一个活动/指定文件的唯读属性。 回传活动文件的编码值。例如:


var enc = UltraEdit.activeDocument.encoding;
 
endSelect 
   停止选择文本(详细信息请参见 startSelect)。
 
expandAll
  
 展开活动文件中所有折叠的文本。 例如:


UltraEdit.activeDocument.expandAll();
 
fileSize
 ** 这是活动/指定文档的只读属性。
 返回引用文件的字节数大小。例如:


var size = UltraEdit.activeDocument.fileSize;
 
findReplace 
 .matchCase 布尔值 true/false 
.matchWord 布尔值 true/false 
.mode 整数 值: 
 
    0 - 当前文件
   1 - 在选择中
   2 - 所有打开的文件 
.regExp 布尔值 true/false 
.searchAscii 布尔值 true/false 
.searchDown 布尔值 true/false 
.searchInColumns 布尔值 true/false 
.fromCol 整数 default: 0 
.toCol 整数 default:
-1 
.find ("要搜索的字符串"); 
.replace ("要搜索的字符串", "替换字符串"); 
  
** 仅在替换中使用 ** 
.preserveCase   布尔值 true/false 
.replaceAll 布尔值 true/false 
.replaceInAllOpen 布尔值 true/false 
   *在替换中取代 .mode 
.selectText 布尔值 true/false 
  *仅替换选中的文本 
 根据指定的参数查找引号 "" 中的字符串。例如:


 


UltraEdit.activeDocument.findReplace.matchWord = true;


UltraEdit.activeDocument.findReplace.find("3939");


 





 


UltraEdit.document[0].findReplace.matchWord = true;


UltraEdit.document[0].findReplace.matchCase = true;


UltraEdit.document[0].findReplace.replace("Copper", "Silver");


请注意:所有属性一旦设定便应用于之后的所有查找和替换,直到再次被设置为其他值。
 
fromEBCDIC
   将文本转换为 EBCDIC 格式。
 
gotoBookmark
 跳转到的书签索引或 -1 转到下一个书签
 跳转到下一个/指定的书签。索引从 0 开始。如果用户输入大于实际书签数的索引,则将自动引导到第一个书签(索引 0)。例如:


UltraEdit.activeDocument.gotoBookmark(0);
 
gotoBookmarkSelect
 跳转到的书签索引或 -1 转到下一个书签 


 
 跳转到下一个/指定的书签并选择从光标位置到书签的文本。索引从 0 开始。如果用户输入大于实际书签数的索引,则将自动引导到第一个书签(索引 0)。例如:


UltraEdit.activeDocument.gotoBookmarkSelect(0);
 
gotoLine
 要跳转到的行和列数的数值
 跳转到指定的行和列号。使用行号 0 跳转到当前行的指定列。例如:


UltraEdit.activeDocument.gotoLine(1,5);
 
gotoLineSelect 
 要跳转到的行和列数的数值
 跳转到指定的行号和列号并选择从光标位置到行/列的文本。选择文本时使用行号 0 跳转到当前行的指定列。例如:


UltraEdit.activeDocument.gotoLineSelect(1,5);
 
gotoPage
 要跳转到页面的编号
 跳转到指定的页号。例如:


UltraEdit.activeDocument.gotoPage(5);
 
gotoPageSelect 
 要跳转到页面的编号
 跳转到指定的页号并选择从光标位置到页的文本。例如:


UltraEdit.activeDocument.gotoPageSelect(5);
 
hexDelete
 指定要删除的字节数的数值
 从文件中删除指定数量的字节。
 
hexInsert 
 指定要插入字节大小的数字值
 将指定数量的字节插入文件。这将插入空格 (HEX 20)。
 
hexMode
 ** 这是活动/指定文档的只读属性。
 返回布尔值说明十六进制模式是否活动。例如:


var hexActive = UltraEdit.activeDocument.hexMode;
 
hexOff 
   
 关闭十六进制模式——切换到文本模式。
 
hexOn 
   打开十六进制模式。
 
hideOrShowLines 
   隐藏选中的行,或如果隐藏则显示在光标行处隐藏的行。
 
insertLine
  
 在光标当前位置的下面插入空白行。
 
insertPageBreak
  
 在文件光标目前所在位置插入换页/分页符。
 
insertTemplate
 模版索引
 将指定的模版插入文件。例如:


UltraEdit.activeDocument.insertTemplate(0);
 
invertCase
  
 转换所选文本的大小写。
 
isCharGt 
 "字符"
 检查当前光标位置所在的字符是否大于指定的字符。例如:


   
if (UltraEdit.document[1].isCharGt('k')){


 //do these commands...


} else {


 //do these commands...


}  
 
isChar
 "字符串"
 检查当前光标位置所在的字符是否为指定的字符。 例如:
  


if (UltraEdit.document[1].isChar('k')){


 //do these commands...


} else {


 //do these commands...


}
 
isColNum 
 数字
 检查当前光标位置是否为指定的列号。 例如:
   
if (UltraEdit.activeDocument.isColNum(13)){


 //do these commands...


} else {


 //do these commands...


}
 
isColNumGt
 数字
 检查当前光标位置是否大于指定的列号。 例如:
   
if (UltraEdit.activeDocument.isColNumGt(13)){


 //do these commands...


} else {


 //do these commands...


}
 
isEof 
   检查当前光标位置是否为文件的结尾。 例如:
 


if (UltraEdit.document[1].isEof()){


 //do these commands...


} else {


 //do these commands...


}
 
isExt
 "字符串"
 检查活动文件的文件扩展名是否与指定字符串匹配。例如:
  


if (UltraEdit.document[1].isExt("txt")){


 //do these commands...


} else {


 //do these commands...


}
 
isFound 
   检查脚本中上次找到的命令结果,并根据结果有条件地执行其他命令。例如: 
  


UltraEdit.activeDocument.findReplace.find("string");


if (UltraEdit.activeDocument.isFound()){


 //do these commands...


} else {


 //do these commands...


}
 
isFTP 
   检查当前文件是否为通过 FTP/SFTP 加载的文件,而不是本地/网络文件。 
  


if (UltraEdit.document[1].isFTP()){


 //do these commands...


} else {


 //do these commands...


}
 
isHexModeOn
  
 检查当前文件是否设置为十六进制/二进制模式。




if (UltraEdit.activeDocument.isHexModeOn()){


 //do these commands...


} else {


 //do these commands...


}
 
isName 
 "字符串"
 检查活动文件的文件名(不是路径或扩展名)是否与指定字符串匹配。例如:


if (UltraEdit.document[1].isName("foo")){


 //do these commands...


} else {


 //do these commands...


}
 
isNotFound 
   检查脚本中上次找到的命令结果,并根据结果有条件地执行其他命令。例如: 
  


UltraEdit.activeDocument.findReplace.find("string");


if (UltraEdit.activeDocument.isNotFound()){


 //do these commands...


} else {


 //do these commands...


}
 
isSel 
   检查活动文件中当前有没有选中的文本。 例如:
  
if (UltraEdit.document[1].isSel()){


 //do these commands...


} else {


 //do these commands...


}
 
key
 BACKSPACE
DEL
DOWN ARROW
END
HOME
LEFT ARROW
PGDN
PGUP
RIGHT ARROW
UP ARROW
CTRL+END
CTRL+HOME
CTRL+LEFT ARROW
CTRL+RIGHT ARROW
 将键盘命令插入活动文件。通常用于在文件中导航以及退格或删除。“CTRL+”修改符可以用于常规编辑修改命令。 
  
如果要输入文本,则使用“write”命令而非“key”命令。 例如:


 


UltraEdit.activeDocument.key("BACKSPACE");


UltraEdit.activeDocument.key("CTRL+RIGHT ARROW");
 
length
 ** 这是活动/指定文档的只读属性。
 返回活动文档的数量。 例如:


var num_of_docs = UltraEdit.document.length;
 
lineTerminator
 ** 这是一个活动/指定文件的唯读属性。
 回传一个活动文件用来表示行终止字符的数值。例如:


var lt = UltraEdit.activeDocument.lineTerminator;


0 = DOS


1 = UNIX


2 = MAC
 
matchBrace 
   
 查找下一个匹配的括号并选择括号中的文本。
 
moveLineDown
  
 在活动文档中将当前行下移一行。 例如:


UltraEdit.activeDocument.moveLineDown();
 
moveLineUp
  
 在活动文档中将当前行上移一行。 例如:


UltraEdit.activeDocument.moveLineUp();
 
oemToAnsi 
  
 将文件从 OEM 转换为 ANSI。
 
paste 
   将剪贴板中的内容粘贴到文件中。
 
path
 ** 这是活动/指定文档的只读属性。
 返回指定文件的完整路径。例如:


var text = UltraEdit.activeDocument.path;
 
previousBookmark
  
 跳到上一个书签。例如:


UltraEdit.activeDocument.previousBookmark();
 
previousBookmarkSelect
  
 跳转到上一个书签并选择从光标位置到书签的文本。例如:


UltraEdit.document[1].previousBookmarkSelect();
 
reIndentSelection
  
 重新缩进当前选中的文本。 例如:


UltraEdit.activeDocument.reIndentSelection();
 
returnToWrap 
   
 将当前选中的硬回车转换为自动换行。
 
selectAll 
   选中文件中的全部文本。
 
selection
 ** 这是活动/指定文档的只读属性。


 
 返回当前选中的文本。例如:


var text = UltraEdit.activeDocument.selection;
 
selectLine
   
 选择活动行中的所有文本。
 
selectToBottom 
   选择从当前位置到文件末尾的所有文本。
 
selectToTop 
   选择从当前位置到文件开头的所有文本。
 
selectWord
   选中当前词语(与双击词的作用相同)。
 
setActive
  
 将指定文档设置为活动文档。例如:


UltraEdit.document[1].setActive();
 
sort
 .ascending boolean   true/false 
.col1Start int   start column key 1 
.col1End int   end column key 1 
.col2Start int   start column key 2 
.col2End int   end column key 2 
.col3Start int   start column key 3 
.col3End int   end column key 3 
.col4Start int   start column key 4 
.col4End int   end column key 4 
.ignoreCase boolean   true/false 
.removeDuplicates   int    0 - false
   1 - all keys match
   2 - any keys match 
 
.remKey1 boolean   true/false 
.remKey2 boolean   true/false 
.remKey3 boolean   true/false 
.remKey4 boolean   true/false 
.type int    0 - character order
   1 - numeric sort
   2 - use locale
   3 - alt. sort 
 
 Sort the file, or selected text according to specified parameters.


Example:


UltraEdit.activeDocument.sort.ascending = true;


UltraEdit.activeDocument.sort.ignoreCase = false;


UltraEdit.activeDocument.sort.removeDuplicates = 1;


UltraEdit.activeDocument.sort.remKey1 = true;


UltraEdit.activeDocument.sort.remKey2 = true;


UltraEdit.activeDocument.sort.type = 0;


UltraEdit.activeDocument.sort.col1Start = 1;


UltraEdit.activeDocument.sort.col1End = 15;


UltraEdit.activeDocument.sort.col2Start = 35;


UltraEdit.activeDocument.sort.col2End = 50;


UltraEdit.activeDocument.sort.sort();
 
sortAsc 


 


sortDes
 类型归类


0 - 根据字符顺序归类。


1- 根据数字值而非字符顺序归类。 


2 - 指定归类必须针对现场。 


3 - 指定归类应使用其他归类方法。使用其他归类方法只需使用一个归类键。 


忽略大小写               布尔值 true/false


删除重复 布尔值 true/false


归类键    int   可以指定多达四对开始/结束键。
 用升序或降序方式排序文件或选定的文本。


例如:


UltraEdit.activeDocument.sortAsc(0, true, true, 1, -1);


 


例如:


UltraEdit.activeDocument.sortDes(1, true, false, 4, 8);
 
spacesToTabs 
   将文件中的空格转换为制表符。这基于配置-自动换行/制表符设置中定义的制表符空格值。 如果制表符空格值设置为 3,则转换为一个制表符需要一组连续的三个空格。小于三个的连续空格都无法转换。
 
spacesToTabsAll 
   将文件中的所有空格转换为制表符。这基于配置-自动换行/制表符设置中定义的制表符空格值。 如果制表符空格值设置为 3,则转换为一个制表符需要一组连续的三个空格。小于三个的连续空格都无法转换。
 
startSelect 
   开始选择。这将打开选择模式运行。任何光标的移动或放置都伴随选择并选中文本。endSelect 将停止选择模式。已选文本将保持选中状态直到正常编辑时其他命令导致其不被选中。
 
tabsToSpaces 
   将文件中的所有制表符转换为空格。
 
timeDate 
   将时间和日期插入文件的光标位置。
 
toCaps 
   选定文本中的每个词语首字大写。
 
toEBCDIC
   将文本转换为 EBCDIC 格式。
 
toggleBookmark 
   在当前行设置或删除书签。
 
toLower 
   将选中文本转换为小写。
 
top 
   跳转到文件开头。
 
toUpper 
   将选中文本转换为大写。
 
trimTrailingSpaces
   切掉当前文件每行尾部的空格。
 
unicodeToASCII
   转换 Unicode 文件到 ASCII。 
 
unixMacToDos 
   将活动文件(行终止符)从 Mac/Unix 转换为 DOS 格式。
 
wrapToReturn 
 执行换行时所在列的列号。列号为 0 则表示换行发生在窗口边缘
 将选中内容从换行转换为硬回车。例如:


UltraEdit.activeDocument.wrapToReturn(60);
 
write


 
 写入的文本位于引号 ("") 中


 
 将指定的文本写入光标位置。例如:


 


UltraEdit.activeDocument.write("This is a test.");


 


或 


 


UltraEdit.activeDocument.write("^c");


 


将在 write 命令中使用剪贴板内容。


 
 
xmlConvertToCRLF
  
 将单行的 XML 文件转换为缩进的 XML 格式。
 


 


输出窗口对象命令


outputWindow 是 JavaScript 阵列对象,阵列对象是 UltraEdit 应用程序对象的属性。 除非注明其他参数,否则所有输出窗口对象命令都必须使用下列格式调用:


  
UltraEdit.outputWindow.commandName();


 


下表说明了输出窗口对象命令:


命令
 参数*
 说明
 
clear
   清除输出窗口内容。例如:


UltraEdit.outputWindow.clear();
 
copy
  
 复制输出窗口的内容到活动剪贴板。例如:


UltraEdit.outputWindow.copy();
 
showOutput
 布尔值    true/false
 确定是否显示写入输出窗口中的针对用户数据。 现在只包含 outputWindow.write()。例如:


UltraEdit.outputWindow.showOutput=false;
 
showStatus
 布尔值    true/false
 确定是否在输出窗口中显示所有状态信息(脚本名称、脚本成功/失败和错误信息)。例如:


UltraEdit.outputWindow.showStatus=true;
 
showWindow
 布尔值    true/false
 切换输出窗口是否可见。例如:


UltraEdit.outputWindow.showWindow(true);
 
visible
 ** 这是只读属性。
 返回布尔值表示输出窗口是否可见。例如:


UltraEdit.outputWindow.visible;
 
write
 写入的文本位于引号 ("") 中
 向输出窗口中写入指定的文本。 这将每次仅支持一行且不包含行终止符。例如:


UltraEdit.outputWindow.write("This is a test.");
 


 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值