UltraEdit Command
UltraEdit Command
Page 1 of 10
Scriptingcommands
ScriptinginUltraEdit/UEStudioisenabledthroughembeddingoftheJavaScriptengine.ThisallowsuserstoenjoythepowerandflexibilityofthefullJavaScriptlanguagewhileusingthecommands
specifiedbelowtospecificallyinteractwiththeeditor(ApplicationObjectcommands)ordocumentsopenintheeditor(DocumentObjectcommands).ScriptsmaybeeditedinUltraEdit/UEStudio
withintegratedsyntaxhighlightingforJavaScriptinthedefaultwordfile:
ThescriptingenginesupportsthecorefunctionalityofJavaScript1.7.FurtherinformationonJavaScriptmaybefoundontheassociatedMozillasite
(http://developer.mozilla.org/en/docs/JavaScript).
Forexample,thisscriptwillgenerateasequenceofnumbersandwritethemtotheactivedocument:
functionrecall(num){
UltraEdit.activeDocument.write(num+"\r\n");
}
functionnum(){
vari=0,j=1,n=0;
while(n<10){
recall(i);
vart=i;
i=j;
j+=t;
n++;
}
}
num();
Furtherdemoscriptsmaybefoundintheinstallationdirectoryinthe"scripts"subdirectory.Forashortscriptingtutorialpleaseclickhere.
Includingscriptsinscripts
Ifdesired,usersmayincludeanexternalscriptinascriptbyreferenceasshownbelow:
//includeexternalScript.js
or
//includeC:\fullpath\toexternal\script\externalScript.js
Theincludecommandmustbeprecededbyalinecomment.Ifauserswishestoexcludetheincludedscriptfordebuggingpurposes,theincludeshouldbeprecededbyadoubledlinecomment,
i.e.:
////includeexternalScript.js
Pleasenotethatscriptsareexecutedassoonastheinclusionisprocessed,butinclusionsareprocessedpriortotheactivescript.Ifanincludeisinsertedintothemiddleofascriptfile,itwill
actuallyexecutepriortothescriptitisincludedin.Whereusersdesiretobuildcomplexscriptsinamodularfashionfromsmallerscripts,thebestpracticewouldbetocreateamasterscriptfilethat
callstheincludedscripts,i.e.:
//includescript1.js
//includescript2.js
//includescript3.js
var_dump
ThisfunctionisincludedoutsidetheotherobjectsdefinedforscriptinginUltraEdit.Itdisplaysstructuredinformationaboutthereferencedinformationincludingtypeandvalue.Arraysandobjects
areexploredrecursivelywithvaluesindentedtoshowstructure.
Example:
var_dump(UltraEdit.frInFiles);
DefaultVariableValues
UltraEditsupportsseveralvariablevaluesthatareinitializedbydefaulteverytimeascriptstartsinUltraEdit:
ColumnModeisalwaysoff.
HexModeisalwaysoff.
InsertModeisalwayson.
TheregularexpressionengineisalwayssettoPerl.
Theseitemsareseteverytimeascriptruns.
ApplicationObjectcommands
UltraEditistheapplicationobjectthatallUltraEditoperationswillbebasedon.Thefollowingcommandsactontheeditoritselfratherthantheactivedocument.Unlessotherparametersarenoted,
allApplicationObjectcommandsmustbeinvokedusingthefollowingformat:
UltraEdit.commandName();
ThetablebelowshowstheApplicationObjectcommands:
Commands
activeDocumentIdx
Parameters*
**ThisisaREADONLYproperty.
Description
Returnsindexofactivedocumentinthedocumentarray.
Example:
varadI=UltraEdit.activeDocumentIdx;
clearClipboard
clipboardContent
Clearsactiveclipboard.
Textinquotes("")ifusedtosetclipboard
content.
Returnscontentofactiveclipboard.Example:
varclip=UltraEdit.clipboardContent;
MayalsobeusedtoSETthecontentoftheactive
clipboard.Example:
UltraEdit.clipboardContent="HelloWorld!";
clipboardIdx
**ThisisaREADONLYproperty.
Returnsindexofactiveclipboard.Example:
closeFile
FilePath
Closesactivefile.Example:
SaveMode
varclip=UltraEdit.clipboardIdx;
mk:@MSITStore:C:\Program%20Files\IDM%20Computer%20Solutions\UltraEdit\uedit3...
5/19/2015
Scripting commands
columnMode
Page 2 of 10
SaveMode
0-prompttosave
1-saveandclose
2-closewithoutsave
UltraEdit.closeFile("C:\\temp\\test.txt",2);
**ThisisaREADONLYproperty.
ReturnsBOOLEANvalueindicatingifcolumnmodeis
active.Example:
*Note:Anybackslashusedinparametersmustbe
escapedasshownabove(i.e."\\"ratherthan"\").
varcolumnActive=UltraEdit.columnMode;
columnModeOff
Turncolumnmodeoff.Example:
UltraEdit.columnModeOff();
*Note:Thecurrentcolumnmodestatewillberestored
oncethescripthascompletedprocessing.
columnModeOn
Turncolumnmodeon.Example:
UltraEdit.columnModeOn();
decryptFilePrompt
PresentDecryptFiledialog.Example:
UltraEdit.decryptFilePrompt();
encryptFilePrompt
PresentEncryptFiledialog.Example:
UltraEdit.encryptFilePrompt();
frInFiles
getString
.directoryStart
string
fullpathof
directorywheresearchshouldbegin
.encoding
int
value:
Encodingvaluetobe
usedforsearch
.filesToSearch
int
value:
0-FilesListed
1-OpenFiles
2-FavoriteFiles
3-ProjectFiles
4-SolutionFiles
.ignoreHiddenSubs boolean true/false
.matchCase
boolean
true/false
.matchWord
boolean
true/false
.openMatchingFiles boolean
true/false
.regExp
boolean
true/false
.searchSubs
boolean
true/false
.unicodeSearch
boolean
true/false
.useEncoding
boolean
true/false
.searchInFilesTypesstring
files/types
tosearchin
.find("stringtofind");
.replace("stringtofind","stringtoreplace");
**Onlyusedwithreplace**
.logChanges
boolean
true/false
.preserveCase
boolean
true/false
**Onlyusedwithoutreplace**
.displayLinesDoNotMatch
boolean
true/false
.reverseSearch
boolean
true/false
.useOutputWindow boolean
true/false
Searchesthroughspecifiedfilestofindthestringinquotes
""basedontheparametersspecified.
Stringinquotes("")usedintheprompt
dialog
Promptsuserforstringtoinsertatcurrentlocation.The
"prompt"isthepromptorquestionthatisdisplayedtothe
userwhenthescriptisrun.Examples:
Optionalflags:
0int
1intreturnvalue
FindinFilesExample:
UltraEdit.frInFiles.directoryStart="c:\\temp\\";
UltraEdit.frInFiles.searchInFilesTypes="*.txt";
UltraEdit.frInFiles.useOutputWindow=true;
UltraEdit.frInFiles.find("3939");
ReplaceinFilesExample:
UltraEdit.frInFiles.directoryStart="c:\\temp\\";
UltraEdit.frInFiles.searchInFilesTypes="*.txt";
UltraEdit.frInFiles.useOutputWindow=true;
UltraEdit.frInFiles.replace("3939","7878");
UltraEdit.getString("Whatisyourname?");
or
varstr=UltraEdit.getString("Whatisyourname?",1);
Iftheintvalue"1"isusedthestringenteredwillnotbe
writtentotheactivefile,butwillbesavedasthevariable
valueandusedintherunningscript.
getValue
Stringinquotes("")usedinpromptdialog
Optionalflags:
0int
1intreturnvalue
Promptsuserforavaluetoinsertatcurrentlocation.The
"prompt"isthepromptorquestionthatisdisplayedtothe
userwhenthescriptisrun.Examples:
UltraEdit.getValue("Howoldareyou?");
or
varstr=UltraEdit.getValue("Howoldareyou?",1);
Iftheintvalue"1"isusedthestringenteredwillnotbe
writtentotheactivefile,butwillbesavedasthevariable
intvalueandusedintherunningscript.
insertMode
Changetexteditingmodetoinsertmodeforcharacters
typed.
insOvrMode
**ThisisaREADONLYproperty.
ReturnsBOOLEANvalueindicatingifinsertmodeison.
Example:
messageBox
Messagetextinquotes("")
Presentsmessagedialogwith"OK"button.Example:
Titletextinquotes("")(optional)
UltraEdit.messageBox("Can'tcompleteprocess","Process
Abort");
varinsertActive=UltraEdit.insOvrMode;
newFile
Openanewblankfile.
mk:@MSITStore:C:\Program%20Files\IDM%20Computer%20Solutions\UltraEdit\uedit3...
5/19/2015
Scripting commands
Openanewblankfile.
newFile
open
Page 3 of 10
Filenameinquotes("")
Openthespecifiedfile.Thefilenamemustbeinquotes.
"^c"maybeusedandUltraEditwillreplacethiswiththe
contentsoftheclipboard.Example:
UltraEdit.open("c:\\temp\\test.txt");
or
UltraEdit.open('^c');
or
UltraEdit.open("c:\\temp\\^c");
or
UltraEdit.open("FTP::myserver.com\\/home/mypath/
public_html|index.html");
overStrikeMode
perlReOn
regexMode
Changetexteditingmodetooverstrikemodefor
characterstyped.
SwitchregularexpressionstoPerlcompatiblestyleregular
expressions.
**ThisisaREADONLYproperty.
Returnsanumberindicatingactiveregularexpression
type.
0=UltraEditexpressions
1=Unixexpressions
2=Perlexpressions
Example:
varregexType=UltraEdit.regexMode;
runTool
Stringinquotes("")specifyingthecase
sensitivemenunameoftooltorun.
Runatool.ThetoolmustbeconfiguredfromTool
ConfigurationintheAdvancedmenu.Example:
UltraEdit.runTool("ScriptTool");
save
saveAll
saveAs
Saveactivefile.
Saveallactivefiles.
Filenameinquotes("")
Savetheactivefileasthefilenamespecified.Thefilename
mustbeinquotes."^s"maybeusedinthefilename.
UltraEditwillreplacethiswiththecurrentlyselectedtextin
theactiveWindow.Likewise,"^c"maybeusedand
UltraEditwillreplacethiswiththecontentsoftheclipboard.
UltraEdit.saveAs("c:\\temp\\test.txt");
or
UltraEdit.saveAs("^s");
or
UltraEdit.saveAs("^c");
selectClipboard
Clipboardnumber(0-9)
Selectthespecifiedclipboard0=Windowsclipboardand
1-9specifiesuserclipboards.Example:
UltraEdit.selectClipboard(2);
ueReOn
unixReOn
SwitchregularexpressionstoUltraEditstyleregular
expressions.
SwitchregularexpressionstoUnixstyleregular
expressions.
DocumentObjectcommands
documentisaJavaScriptarrayobjectwhichisapropertyoftheUltraEditapplicationobject.Thisisanarrayofallcurrentlyopeneddocuments.TheactiveDocumentparametermaybeusedto
specifythatoutputshouldbewrittentotheactivefileorusersmayspecifyafile'sindexbasedonfiletaborder(i.e.document[0],...document[8]).Forexample:
UltraEdit.activeDocument.write("test");
wouldwritetheword"test"totheactivefile,whilethefollowing:
UltraEdit.document[4].write("test");
wouldallowtheusertohavemultiplefilesopenandwritethespecifiedtexttothefifthfile(basedonfiletaborder)currentlyopenforediting.
Scriptsmaybecommentedfortestingordocumentationusing"//".
Onceascripthasbeencreated,itmaybeedited.Pleasenote,that"^c"and"^s"maybeusedwithmanyscriptcommandsandwillbereplacedwiththecontentsoftheclipboard(^c)andthetext
currentlyselected(^s)whenused.Thisallowsuserstocreateascriptthatmayreferenceaspecificstringandreplacethiswithoneofthesetwoitemstoallowthestringtobedynamically
"specified"asthescriptisrun.Thefollowingcommandsactonadocumentcurrentlyopenforediting.Unlessotherparametersarenoted,allDocumentObjectcommandsmustbeinvokedusing
thefollowingformat:
UltraEdit.activeDocument.commandName();
ThetablebelowshowstheDocumentObjectcommands:
Commands
Parameters*
Description
ansiToOem
ConvertfilefromANSItoOEM.Example:
UltraEdit.activeDocument.ansiToOem();
ASCIIToUnicode
ASCIIToUTF8
bottom
cancelSelect
clearAllBookmarks
codePage
**Thisisapropertyoftheactive/specified
ConvertfilefromASCIItoUnicode.
ConvertfilefromASCIItoUTF-8.
Jumptoendoffile.
Clearsanyselectioninactivedocument.Example:
UltraEdit.activeDocument.cancelSelect();
Clearsallbookmarksinactivedocument.Example:
UltraEdit.activeDocument.clearAllBookmarks();
Returnsvalueofcodepageforactivedocument.Example:
mk:@MSITStore:C:\Program%20Files\IDM%20Computer%20Solutions\UltraEdit\uedit3...
5/19/2015
Scripting commands
codePage
Page 4 of 10
**Thisisapropertyoftheactive/specified
document.
Returnsvalueofcodepageforactivedocument.Example:
varcp=UltraEdit.activeDocument.codePage;
Maybeusedtosetcodepagetobeusedforactive
document.Example:
UltraEdit.open("C:\\temp\\korean_file.txt")
UltraEdit.activeDocument.codePage=949;
collapseAll
Collapseallfoldabletextinactivefile.Example:
UltraEdit.activeDocument.collapseAll();
columnCenterJustify
Centerjustifyselectedcolumns.
columnCut
Numericvalueofcolumnstocut
Cutincolumnmodetheselectedcolumnsorthespecified
numberofcolumnsfromcurrentcursorpositiontobottom
ofthefile.Value"0"mustbeusedtocuttheselected
columns.
columnDelete
Numericvalueofcolumnstodelete
Deleteincolumnmodetheselectedcolumnsorthe
specifiednumberofcolumnsfromcurrentcursorposition
tobottomofthefile.Value"0"mustbeusedtodeletethe
selectedcolumns.
columnInsert
Stringinquotes("")
Insertstringbetweenquotesintoselectedcolumns.
columnInsertNum
StartNumber
int
Increment
int
LeadingZero
booleantrue/false
HEX
boolean true/false
columnLeftJustify
columnRightJustify
commentAdd
commentRemove
CommentSelectionAdd
CommentSelectionRemove
copy
copyAppend
copyFilePath
currentChar
Insertnumberinselectedcolumns.Ifthereisnoselection
theinsertionwillrunfromthecursorlocationtothelastline
ofthefile.Example:
UltraEdit.activeDocument.columnInsertNum(2,3,false,
true);
Leftjustifyselectedcolumns.
Rightjustifyselectedcolumns.
Insertthelinecommentstringasdefinedinthesyntax
highlightinglanguageusedtohighlightthecurrentfileat
startofeveryselectedlineorthecurrentlineifthereisno
selection.Thiscommandhasnoaffectonafilenot
highlightedwithasyntaxhighlightinglanguageorwhenthe
languagehasnolinecommentdefinition.Thecursor
positiondoesnotchangeandtheselectionremains.
Removethelinecommentstringasdefinedinthesyntax
highlightinglanguageusedtohighlightthecurrentfileat
startofeveryselectedlineorthecurrentlineifthereisno
selection.Thiscommandhasnoaffectonafilenot
highlightedwithasyntaxhighlightinglanguageorwhenthe
languagehasnolinecommentdefinition.Theline
commentstringmustbeatstartoftheline(column1)
withoutprecedingwhitespace.Alinecommentstringafter
oneormorespacesortabsisignoredandnotremoved.
Thecursorpositiondoesnotchangeandtheselection
remains.
Insertthe"blockcommenton"stringatstartandthe"block
commentoff"stringatendofaselectionasdefinedinthe
syntaxhighlightinglanguageusedtohighlightthecurrent
file.Ifnothingisselectedonexecutionofthecommand,
bothstringsareinsertedatcurrentcursorposition.This
commandhasnoaffectonafilenothighlightedwitha
syntaxhighlightinglanguageorwhenthelanguagehasno
blockcommentdefinition.Iftheselectedblockcontains
alreadyablockcommentandthelanguagedoesnot
supportnestedblockscomments,commandCommentAdd
isautomaticallyexecutedinsteadofthiscommandfor
insertingthelinecommentstringatstartofeveryselected
lineifthelanguagesupportsalinecomment.Thecursor
movestostartoftheinserted"blockcommenton"string
andtheselectionisremovedafterexecutionwhenthe
blockcommentstringsareinserted.
Removethe"blockcommenton"stringatstartandthe
"blockcommentoff"stringatendofaselectionasdefined
inthesyntaxhighlightinglanguageusedtohighlightthe
currentfile.Thecommandhasnoaffectifnothingis
selectedonexecutionofthecommand.Andthecommand
worksonlyifthecurrentselectionstartswiththe"block
commenton"stringandendswiththe"blockcommentoff"
string.Whitespaceinsidetheselectionbefore"block
commenton"stringorafter"blockcommentoff"stringare
notignoredandresultinnotremovingtheblockcomment
strings.Thecursormovestostartoftheselectionandthe
selectionisremovedafterexecutionwhentheblock
commentstringsareremoved.
Copyselectedtexttotheclipboard.Ifthereisnoselection,
thelineatthecurrentcursorlocationwillbecopiedif
Enablecopy/appendofcurrentlinewhennoselectionis
activeisconfigured.
Copyselectedtextandappendittotheclipboard.Ifthere
isnoselectionthelineatthecurrentcursorlocationwillbe
copiedifEnablecopy/appendofcurrentlinewhenno
selectionisactiveisconfigured.
Copytheactivefilepath/nametotheclipboard.
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
Returnsvalueofcharacteratcursor.Example:
currentColumnNum
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
Returnsvalueofcurrentcolumnnumber.Thefirstcolumn
isnumberedas"1".Example:
currentLineNum
**ThisisaREADONLYpropertyofthe
varchar=UltraEdit.activeDocument.currentChar;
varcol=UltraEdit.activeDocument.currentColumnNum;
Returnsvalueofcurrentlinenumber.Example:
mk:@MSITStore:C:\Program%20Files\IDM%20Computer%20Solutions\UltraEdit\uedit3...
5/19/2015
Scripting commands
Page 5 of 10
currentLineNum
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
Returnsvalueofcurrentlinenumber.Example:
currentPos
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
Returnsvalueofcurrentpositioninbytesfromthe
beginningofthefile.Example:
varlineNum=UltraEdit.activeDocument.currentLineNum;
varpos=UltraEdit.activeDocument.currentPos;
cut
cutAppend
decodeBase64
Cuttheselectedtextfromthefiletotheclipboard.Ifthere
isnoselectionthelineatthecurrentcursorlocationwillbe
cut.
Cuttheselectedtextfromthefileandappendittothe
clipboard.Ifthereisnoselectionthelineatthecurrent
cursorlocationwillbecut.
ConvertselectedtextfromBase64.Example:
UltraEdit.activeDocument.decodeBase64();
delAllBookmarkLines
delAllHiddenLines
deleteText
Deletecurrentlybookmarkedlinesinactivedocument.
Example:UltraEdit.activeDocument.delAllBookmarkLines
();
Deletelinescurrentlyhidden/foldedinactivedocument.
Example:UltraEdit.activeDocument.delAllHiddenLines();
Deletecurrentcharacterorselectedtext.
deleteLine
deleteToEndOfLine
deleteToStartOfLine
dosToMac
Convertthefile(lineterminators)toMACformat.
dosToUnix
Convertthefile(lineterminators)toUNIXformat.
dupeLine
Insertsduplicateofactivelinebelowcursor.
encodeBase64
ConvertselectedtexttoBase64.Example:
Deletethecurrentline.
Deletefromthecurrentcursorpositiontotheendofthe
line.
Deletefromthecurrentcursorpositiontothestartofthe
line.
UltraEdit.activeDocument.encodeBase64();
encoding
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
Returnsvalueofencodingforactivedocument.Example:
endSelect
Stopselectingtext(seestartSelectfordetails).
expandAll
Expandsallfoldedtextinactivefile.Example:
fileSize
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
varenc=UltraEdit.activeDocument.encoding;
UltraEdit.activeDocument.expandAll();
findReplace
.matchCase
.matchWord
.mode
Returnssizeofreferencedfileinbytes.Example:
varsize=UltraEdit.activeDocument.fileSize;
int
value:
0-CurrentFile
UltraEdit.activeDocument.findReplace.matchWord=true;
1-InSelection
2-AllOpenFiles
UltraEdit.activeDocument.findReplace.find("3939");
.regExp
boolean
true/false
.searchAscii
boolean
true/false
.searchDown
boolean
true/false
.searchInColumn
boolean
true/false
.fromCol
int
default:0
.toCol
int
default:-1
.find("stringtofind");
or
UltraEdit.document[0].findReplace.matchWord=true;
UltraEdit.document[0].findReplace.matchCase=true;
UltraEdit.document[0].findReplace.replace("Copper",
"Silver");
Pleasenote:allpropertiesoncesetareactiveforall
.replace("stringtofind","stringtoreplace"); followingfindsandreplacesuntilthepropertyissetagain
toadifferentvalue.
**Onlyusedwithreplace**
.preserveCase
boolean
true/false
.replaceAll
boolean
true/false
.replaceInAllOpen
boolean
true/false
*supersedes.modeinreplace
.selectText
boolean
true/false
*replacesonlyinselectedtext
fromEBCDIC
gotoBookmark
ConverttextfromEBCDICformat.
Indexofbookmarktojumptoor-1togoto
nextbookmark
Jumptothenext/specifiedbookmark.Theindexesstart
with0.Ifauserentersanindexthatisgreaterthanthe
actualnumberofbookmarksthencaretisautomaticallyset
tothenextbookmarklikewhenusing-1asbookmark
number.
Example:
UltraEdit.activeDocument.gotoBookmark(0);
gotoBookmarkSelect
Indexofbookmarktojumptoor-1togoto
nextbookmark
Jumptothenext/specifiedbookmarkandselecttextfrom
thecursorpositiontobookmark.Theindexesstartwith0.If
auserentersanindexthatisgreaterthantheactual
numberofbookmarksthencaretisautomaticallysettothe
nextbookmarklikewhenusing-1asbookmarknumber.
Example:
UltraEdit.activeDocument.gotoBookmarkSelect(0);
mk:@MSITStore:C:\Program%20Files\IDM%20Computer%20Solutions\UltraEdit\uedit3...
5/19/2015
Scripting commands
gotoEndOfNextWord
Page 6 of 10
Jumptoendofnextword.Example:
UltraEdit.activeDocument.gotoEndOfNextWord();
gotoEndOfNextWordSelect
Jumptoendofnextwordandselectalltextfromcurrent
caretposition.Example:
UltraEdit.activeDocument.gotoEndOfNextWordSelect();
gotoEndOfPrevWord
Jumptoendofpreviousword.Example:
UltraEdit.activeDocument.gotoEndOfPrevWord();
gotoEndOfPrevWordSelect
Jumptoendofpreviouswordandselectalltextfrom
currentcaretposition.Example:
UltraEdit.activeDocument.gotoEndOfPrevWordSelect();
gotoLine
Numericvalueoflineandcolumnnumberto Jumptothespecifiedlineandcolumnnumber.Useline
jumpto
number0tojumptothespecifiedcolumninthecurrent
line.Example:
gotoLineSelect
Numericvalueoflineandcolumnnumberto Jumptospecifiedlinenumberandcolumnnumberand
jumpto
selecttextfromcursorpositiontoline/column.Useline
number0tojumptothespecifiedcolumninthecurrentline
whileselectingtext.Example:
gotoPage
Numericvalueofpagetojumpto
gotoPageSelect
Numericvalueofpagetojumpto
gotoPos
Numericvaluespecifyingpositionin
numberofcharsfrombeginningoffile
Jumptospecifiedposition
gotoPosSelect
Numericvaluespecifyingpositionin
numberofcharsfrombeginningoffile
Jumptospecifiedposition(passedasparameterinnumber
ofcharsfrombeginningoffile)whilemakingaselection
hexDelete
Numericvaluespecifyingnumberofbytesto Deletethespecifiednumberofbytesfromthefile.
delete
hexInsert
Numericvaluespecifyingnumberofbytesto Insertthespecifiednumberofbytesintothefile.Thiswill
insert.
insertspaces(HEX20).
hexMode
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
UltraEdit.activeDocument.gotoLine(1,5);
UltraEdit.activeDocument.gotoLineSelect(1,5);
Jumptospecifiedpagenumber.Example:
UltraEdit.activeDocument.gotoPage(5);
Jumptospecifiedpagenumberandselecttextfromcursor
positiontopagenumber.Example:
UltraEdit.activeDocument.gotoPageSelect(5);
ReturnsaBOOLEANvalueindicatingifHexmodeis
active.Example:
varhexActive=UltraEdit.activeDocument.hexMode;
hexOff
TurnHexmodeoff-switchtotextmode.
hexOn
hideOrShowLines
insertLine
Insertsblanklinebelowcurrentcursorposition.
insertPageBreak
Insertaformfeed/pagebreakcharacteratthecurrent
cursorpositioninthefile.
insertTemplate
Nameoftemplategroupinquotesfollowed Insertthespecifiedtemplateintothefile.Globaltemplates
byadot("glo.")(optional)
maybeinsertedbyspecifyingthetemplatenamewithor
withoutatemplategroupname.Example:
Nameoftemplateinquotes
("templateName")
UltraEdit.activeDocument.insertTemplate("userTime");
Indexofglobaltemplate(legacy)
TurnHexmodeon.
Hidetheselectedlines,orifhidden,showthelineshidden
atthelineofthecursor.
Ifdesired,usersmayspecifyGlobal("glo"or"global"),
Layout("env"or"environment",formerlyEnvironment),
Language("lng"or"language")andProject("prj"or
"project")groupsaswellastemplatenames.Examples:
UltraEdit.activeDocument.insertTemplate("glo.userTime");
UltraEdit.activeDocument.insertTemplate
("global.userTime");
UltraEdit.activeDocument.insertTemplate("env.Power1");
UltraEdit.activeDocument.insertTemplate
("environment.Power1");
UltraEdit.activeDocument.insertTemplate("lng.class");
UltraEdit.activeDocument.insertTemplate
("language.class");
UltraEdit.activeDocument.insertTemplate("prj.noDesc");
UltraEdit.activeDocument.insertTemplate
("project.noDesc");
Ifpreferred,usersmayspecifyglobaltemplatesbasedon
theirindex.Example:
UltraEdit.activeDocument.insertTemplate(0);
invertCase
isChar
Invertthecaseofselectedtext.
"string"
Thischecksifthecurrentcharacteratthecursorpositionis
thecharacterspecified.Example:
if(UltraEdit.document[1].isChar('k')){
//dothesecommands...
mk:@MSITStore:C:\Program%20Files\IDM%20Computer%20Solutions\UltraEdit\uedit3...
5/19/2015
Scripting commands
Page 7 of 10
}else{
//dothesecommands...
}
isCharGt
"character"
Thischecksifthecurrentcharacteratthecursorpositionis
greaterthanthespecifiedcharacter.Example:
if(UltraEdit.document[1].isCharGt('k')){
//dothesecommands...
}else{
//dothesecommands...
}
isColNum
number
Thischecksifthecurrentcursorpositionisthespecific
columnnumber.Example:
if(UltraEdit.activeDocument.isColNum(13)){
//dothesecommands...
}else{
//dothesecommands...
}
isColNumGt
number
Thischecksifthecurrentcursorpositionisgreaterthanthe
specificcolumnnumber.Example:
if(UltraEdit.activeDocument.isColNumGt(13)){
//dothesecommands...
}else{
//dothesecommands...
}
isEof
Thischecksifthecurrentcursorpositionisattheendof
file.Example:
(UltraEdit.document[1].isEof()){
//dothesecommands...
}else{
//dothesecommands...
}
isExt
"string"
Thischecksifthefileextensionoftheactivefilematches
thespecifiedstring.Example:
if(UltraEdit.document[1].isExt("txt")){
//dothesecommands...
}else{
//dothesecommands...
}
isFound
Thischeckstheresultsfromthelastfindcommandinthe
scriptandwillconditionallyexecutefurthercommands
basedontheresult.Example:
UltraEdit.activeDocument.findReplace.find("string");
if(UltraEdit.activeDocument.isFound()){
//dothesecommands...
}else{
//dothesecommands...
}
isFTP
ThischecksifthecurrentfileisafileloadedviaFTP/SFTP
andnotalocal/networkfile.
if(UltraEdit.document[1].isFTP()){
//dothesecommands...
}else{
//dothesecommands...
}
isHexModeOn
ThischecksiftheactivefileiscurrentlysettoHex/binary
mode.
if(UltraEdit.activeDocument.isHexModeOn()){
//dothesecommands...
}else{
//dothesecommands...
}
isName
"string"
Thischecksiftheactivefilename(notpathorextension)
matchesthespecifiedstring.Example:
if(UltraEdit.document[1].isName("foo")){
//dothesecommands...
}else{
//dothesecommands...
mk:@MSITStore:C:\Program%20Files\IDM%20Computer%20Solutions\UltraEdit\uedit3...
5/19/2015
Scripting commands
Page 8 of 10
}
isNotFound
Thischeckstheresultsfromthelastfindcommandinthe
scriptandwillconditionallyexecutefurthercommands
basedontheresult.Example:
UltraEdit.activeDocument.findReplace.find("string");
if(UltraEdit.activeDocument.isNotFound()){
//dothesecommands...
}else{
//dothesecommands...
}
isReadOnly
Thiscommandchecksiftheactivedocumentissettoread
only.Example:
if(UltraEdit.activeDocument.isReadOnly()){
//dothesecommands...
}else{
//dothesecommands...
}
isSel
Thischecksifthereiscurrentlyanyselectedtextwithinthe
activefile.Example:
if(UltraEdit.document[1].isSel()){
//dothesecommands...
}else{
//dothesecommands...
}
isWordWrap
Thiscommandchecksthewordwrapstateoftheactive
document.Example:
if(UltraEdit.activeDocument.isWordWrap()){
//dothesecommands...
}else{
//dothesecommands...
}
key
BACKSPACE
DEL
DOWNARROW
END
HOME
LEFTARROW
PGDN
PGUP
RIGHTARROW
UPARROW
CTRL+END
CTRL+HOME
CTRL+LEFTARROW
CTRL+RIGHTARROW
Insertakeycommandintotheactivefile.Generallyused
fornavigationinthefileandforbackspaceordelete.The
"CTRL+"modifiermaybeusedaswithnormaleditingto
modifythecommand.
Fortextinputthe"write"commandisused,notthe"key"
command.Examples:
length
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
Returnsnumberofactivedocuments.Example:
lineTerminator
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
Returnsanumericvalueindicatinglineterminatortypein
activedocument.Example:
UltraEdit.activeDocument.key("BACKSPACE");
UltraEdit.activeDocument.key("CTRL+RIGHTARROW");
varnum_of_docs=UltraEdit.document.length;
varlt=UltraEdit.activeDocument.lineTerminator;
Supportedvalues:
-2=MACbutcontentoffilecontainscurrentlyDOSline
terminators
-1=UNIXbutcontentoffilecontainscurrentlyDOSline
terminators
0=DOS
1=UNIX
2=MAC
matchBrace
moveLineDown
moveLineUp
oemToAnsi
ConvertactivefilefromOEMtoANSI.
paste
Pastethecontentsoftheclipboardintothefile.
path
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
Returnsfullpathofspecifiedfile.Example:
Findnextmatchingbraceandselectthetextbetween
them.
Movecurrentlinedownwardonelineinactivedocument.
Example:
UltraEdit.activeDocument.moveLineDown();
Movecurrentlineupwardonelineinactivedocument.
Example:
UltraEdit.activeDocument.moveLineUp();
previousBookmark
vartext=UltraEdit.activeDocument.path;
Jumptothepreviousbookmark.Example:
UltraEdit.activeDocument.previousBookmark();
previousBookmarkSelect
Jumptopreviousbookmarkandselecttextfromcursor
positiontobookmark.Example:
mk:@MSITStore:C:\Program%20Files\IDM%20Computer%20Solutions\UltraEdit\uedit3...
5/19/2015
Scripting commands
Page 9 of 10
positiontobookmark.Example:
UltraEdit.document[1].previousBookmarkSelect();
readOnlyOff
Setsactivedocumentaswriteable
readOnlyOn
Setsactivedocumentasreadonly
reIndentSelection
Re-indentscurrentlyselectedtext.Example:
returnToWrap
Converthardreturnstowordwrapincurrentselection.
selectAll
Selectalltextinthefile.
**ThisisaREADONLYpropertyofthe
active/specifieddocument.
Returnscurrentlyselectedtext.Example:
UltraEdit.activeDocument.reIndentSelection();
selection
vartext=UltraEdit.activeDocument.selection;
selectLine
Selectalltextonactiveline.
selectToBottom
Selectalltextfromthecurrentpositiontotheendoffile.
selectToTop
Selectalltextfromthecurrentpositiontothetopoffile.
selectWord
Selectthecurrentword(sameasdoubleclickingaword).
setActive
Setsspecifieddocumentasactivedocument.Example:
sort
.ascending
booleantrue/false
.col1Start
intstartcolumnkey1
.col1End
intendcolumnkey1
.col2Start
intstartcolumnkey2
.col2End
intendcolumnkey2
.col3Start
intstartcolumnkey3
.col3End
intendcolumnkey3
.col4Start
intstartcolumnkey4
.col4End
intendcolumnkey4
.ignoreCase
booleantrue/false
UltraEdit.document[1].setActive();
.removeDuplicatesint0-false
1-allkeysmatch
2-anykeysmatch
.remKey1
booleantrue/false
.remKey2
booleantrue/false
.remKey3
booleantrue/false
.remKey4
booleantrue/false
.type
int0-characterorder
1-numericsort
2-uselocale
3-alt.sort
sortAsc
SortType
0-Sortbasedoncharacterorder.
sortDes
1-Sortbasedonnumericvalue,not
characterorder.
2-Specifiesthatthesortshouldbelocale
specific.
3-Specifiesthatthesortshouldusethe
alternatesortmethod.Withthealternate
sortmethodonlyasinglesortkeymaybe
used.
Sortthefile,orselectedtextaccordingtospecified
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();
Sortthefile,orselectedtextinascendingordescending
order.
Example:
UltraEdit.activeDocument.sortAsc(0,true,true,1,-1);
Example:
UltraEdit.activeDocument.sortDes(1,true,false,4,8);
IgnoreCasebooleantrue/false
RemoveDuplicatesbooleantrue/false
SortKeysintUptofourpairsof
start/endkeysmaybespecified.
spacesToTabs
spacesToTabsAll
startSelect
tabsToSpaces
Convertalltabswithinthefiletospaces.
timeDate
Insertthetimeanddateintothefileatcursorlocation.
toCaps
Capitalizeeachwordintheselectedtext.
toEBCDIC
ConverttexttoEBCDICformat.
toggleBookmark
Setorremoveabookmarkatthecurrentline.
Convert(leading)spaceswithinthefiletotabs.Thisis
basedontheTabStopValuedefinedunderWord
Wrap/TabSettingsinConfiguration.IftheTabStopValue
issettothree,agroupofthreespacestogetherwouldbe
requiredtoconverttoatab.Fewerthanthreespaces
togetherwouldnotbeconverted.
Convertallspaceswithinthefiletotabs.Thisisbasedon
theTabStopValuedefinedunderWordWrap/TabSettings
inConfiguration.IftheTabStopValueissettothree,a
groupofthreespacestogetherwouldberequiredto
converttoatab.Fewerthanthreespacestogetherwould
notbeconverted.
Startselection.Thisturnstheselectionmodeon.Any
cursormovementorpositioningwillbewithselectionon
andthetextisselected.endSelectwillstoptheselection
mode.Theselectedtextwillremainselecteduntilanother
commandcausesitnottobeselectedaswithnormal
editing.
mk:@MSITStore:C:\Program%20Files\IDM%20Computer%20Solutions\UltraEdit\uedit3...
5/19/2015
Scripting commands
Page 10 of 10
Setorremoveabookmarkatthecurrentline.
toggleBookmark
toLower
Converttheselectedtexttolowercase.
top
Jumptotopoffile.
toUpper
Converttheselectedtexttouppercase.
trimTrailingSpaces
Trimtrailingspacesfromeachlineofcurrentfile.
unicodeToASCII
ConvertfilefromUnicodetoASCII.
unixMacToDos
UTF8ToASCII
ConvertfilefromUTF-8toASCII.
wordWrapOff
Turnsoffwordwrapforactivedocument
wordWrapOn
Turnsonwordwrapforactivedocument
wrapToReturn
Columnnumberatwhichwrapisperformed. Convertselectionfromwordwraptohardreturns.
Zeroforthecolumnnumberindicatesthe
Example:
wrapistooccuratthewindowboundary.
UltraEdit.activeDocument.wrapToReturn(60);
Converttheactivefile(lineterminators)fromMac/Unixto
DOSformat.
write
Texttowriteinquotes("")
Writespecifiedtextatcursorlocation.Example:
UltraEdit.activeDocument.write("Thisisatest.");
or
UltraEdit.activeDocument.write("^c");
Thiswouldusethecontentsoftheclipboardforthewrite
command.
xmlConvertToCRLF
Convertsingle-lineXMLfiletoindentedXMLformat.
OutputWindowObjectcommands
outputWindowisaJavaScriptarrayobjectwhichisapropertyoftheUltraEditapplicationobject.Unlessotherparametersarenoted,allOutputWindowObjectcommandsmustbeinvokedusing
thefollowingformat:
UltraEdit.outputWindow.commandName();
ThetablebelowshowstheOutputWindowObjectcommands:
Commands
Parameters*
clear
Description
copy
showOutput
booleantrue/false
showStatus
booleantrue/false
showWindow
booleantrue/false
Togglesvisibilityofoutputwindow.Example:
visible
**ThisisaREADONLYproperty.
ReturnsaBOOLEANvalueindicatingifoutput
windowisvisible.Example:
write
Texttowriteinquotes("")
Writespecifiedtexttooutputwindow.Thiswillonly
supportonelineatatimeandmaynotincludeline
terminators.Example:
Clearscontentsofoutputwindow.Example:
UltraEdit.outputWindow.clear();
Copiescontentsofoutputwindowtoactive
clipboard.Example:
UltraEdit.outputWindow.copy();
Determinesvisibilityofuserspecificdatathatiswrittento
theoutputwindow.Currentlythatonlyincludes
outputWindow.write().Example:
UltraEdit.outputWindow.showOutput=false;
Determinesvisibilityofallstatusinformationinoutput
window(scriptname,success/failureofscript,anderrror
information).Example:
UltraEdit.outputWindow.showStatus=true;
UltraEdit.outputWindow.showWindow(true);
UltraEdit.outputWindow.visible;
UltraEdit.outputWindow.write("Thisisatest.");
mk:@MSITStore:C:\Program%20Files\IDM%20Computer%20Solutions\UltraEdit\uedit3...
5/19/2015