AutoIt plugin/brush for WordPress

Here is the AutoIt plugin (brush as it is called) for the Syntax Highlighter for WordPress plugin,  which uses the Alex Gorbatchev’s SyntaxHighlighter Script..

(After completing this post I found that the post was too untidy to

follow…unless you have tried your hands on hacking or modifying

scripts. If you are a newbie, AND MOST IMPORTANTLY IF THIS IS THE FIRST

HACK for your wordpress, syntax-highlighter, follow method ONE described below (download the codes and then paste them in the folders

mentioned) .. And for the rest of you who wanna get your hands dirty

hacking the script, goto Method TWO ..



Download this zip file. Extract it. It has two files

  • shBrushAutoit.js
  • syntax_highlighter.php

Paste the shBrushAutoit.js file into your js folder located at plugins/syntax-highlighter<latest version number>js ( example plugins/syntax-highlighter3.0.83js )

( Take a BACKUP of the existing syntax_highlighter.php file before you OVERWRITE it ) Paste the syntax_highlighter.php into your pluginssyntax-highlighter folder

Then refresh the page with the Autoit script . The highlighting should be enabled.


Create a new file called shBrushAutoit.js inside the js folder located at plugins/syntax-highlighter<latest version number>js ( example plugins/syntax-highlighter3.0.83js ) of the syntax-highlighter plugin. And paste the following code into it. Or you can Download this zip file and copy paste the contents from it. [javascript]



// CommonJS

typeof(require) != ‘undefined’ ? SyntaxHighlighter = require(‘shCore’).SyntaxHighlighter : null;

function Brush()


var funcs = ‘Abs ACos AdlibRegister AdlibUnRegister Asc AscW ASin Assign ATan AutoItSetOption AutoItWinGetTitle ‘ +

‘AutoItWinSetTitle Beep Binary BinaryLen BinaryMid BinaryToString BitAND BitNOT BitOR BitRotate BitShift ‘ +

‘BitXOR BlockInput Break Call CDTray Ceiling Chr ChrW ClipGet ClipPut ConsoleRead ConsoleWrite ConsoleWriteError ‘ +

‘ControlClick ControlCommand ControlDisable ControlEnable ControlFocus ControlGetFocus ControlGetHandle ‘ +

‘ControlGetPos ControlGetText ControlHide ControlListView ControlMove ControlSend ControlSetText ControlShow ‘ +

‘ControlTreeView Cos Dec DirCopy DirCreate DirGetSize DirMove DirRemove DllCall DllCallbackFree DllCallbackGetPtr ‘ +

‘DllCallbackRegister DllClose DllOpen DllStructCreate DllStructGetData DllStructGetPtr DllStructGetSize ‘ +

‘DllStructSetData DriveGetDrive DriveGetFileSystem DriveGetLabel DriveGetSerial DriveGetType DriveMapAdd ‘ +

‘DriveMapDel DriveMapGet DriveSetLabel DriveSpaceFree DriveSpaceTotal DriveStatus EnvGet EnvSet EnvUpdate Eval ‘ +

‘Execute Exp FileChangeDir FileClose FileCopy FileCreateNTFSLink FileCreateShortcut FileDelete FileExists ‘ +

‘FileFindFirstFile FileFindNextFile FileFlush FileGetAttrib FileGetEncoding FileGetLongName FileGetPos ‘ +

‘FileGetShortcut FileGetShortName FileGetSize FileGetTime FileGetVersion FileInstall FileMove FileOpen ‘ +

‘FileOpenDialog FileRead FileReadLine FileRecycle FileRecycleEmpty FileSaveDialog FileSelectFolder FileSetAttrib ‘ +

‘FileSetPos FileSetTime FileWrite FileWriteLine Floor FtpSetProxy GUICreate GUICtrlCreateAvi GUICtrlCreateButton ‘ +

‘GUICtrlCreateCheckbox GUICtrlCreateCombo GUICtrlCreateContextMenu GUICtrlCreateDate GUICtrlCreateDummy ‘ +

‘GUICtrlCreateEdit GUICtrlCreateGraphic GUICtrlCreateGroup GUICtrlCreateIcon GUICtrlCreateInput GUICtrlCreateLabel ‘ +

‘GUICtrlCreateList GUICtrlCreateListView GUICtrlCreateListViewItem GUICtrlCreateMenu GUICtrlCreateMenuItem ‘ +

‘GUICtrlCreateMonthCal GUICtrlCreateObj GUICtrlCreatePic GUICtrlCreateProgress GUICtrlCreateRadio ‘ +

‘GUICtrlCreateSlider GUICtrlCreateTab GUICtrlCreateTabItem GUICtrlCreateTreeView GUICtrlCreateTreeViewItem ‘ +

‘GUICtrlCreateUpdown GUICtrlDelete GUICtrlGetHandle GUICtrlGetState GUICtrlRead GUICtrlRecvMsg ‘ +

‘GUICtrlRegisterListViewSort GUICtrlSendMsg GUICtrlSendToDummy GUICtrlSetBkColor GUICtrlSetColor GUICtrlSetCursor ‘ +

‘GUICtrlSetData GUICtrlSetDefBkColor GUICtrlSetDefColor GUICtrlSetFont GUICtrlSetGraphic GUICtrlSetImage ‘ +

‘GUICtrlSetLimit GUICtrlSetOnEvent GUICtrlSetPos GUICtrlSetResizing GUICtrlSetState GUICtrlSetStyle GUICtrlSetTip ‘ +

‘GUIDelete GUIGetCursorInfo GUIGetMsg GUIGetStyle GUIRegisterMsg GUISetAccelerators GUISetBkColor GUISetCoord ‘ +

‘GUISetCursor GUISetFont GUISetHelp GUISetIcon GUISetOnEvent GUISetState GUISetStyle GUIStartGroup GUISwitch Hex ‘ +

‘HotKeySet HttpSetProxy HttpSetUserAgent HWnd InetClose InetGet InetGetInfo InetGetSize InetRead IniDelete IniRead ‘ +

‘IniReadSection IniReadSectionNames IniRenameSection IniWrite IniWriteSection InputBox Int IsAdmin IsArray IsBinary ‘ +

‘IsBool IsDeclared IsDllStruct IsFloat IsHWnd IsInt IsKeyword IsNumber IsObj IsPtr IsString Log MemGetStats Mod ‘ +

‘MouseClick MouseClickDrag MouseDown MouseGetCursor MouseGetPos MouseMove MouseUp MouseWheel MsgBox Number ObjCreate ‘ +

‘ObjEvent ObjGet ObjName OnAutoItExitRegister OnAutoItExitUnRegister Ping PixelChecksum PixelGetColor PixelSearch ‘ +

‘PluginClose PluginOpen ProcessClose ProcessExists ProcessGetStats ProcessList ProcessSetPriority ProcessWait ‘ +

‘ProcessWaitClose ProgressOff ProgressOn ProgressSet Ptr Random RegDelete RegEnumKey RegEnumVal RegRead RegWrite ‘ +

‘Round Run RunAs RunAsWait RunWait Send SendKeepActive SetError SetExtended ShellExecute ShellExecuteWait Shutdown ‘ +

‘Sin Sleep SoundPlay SoundSetWaveVolume SplashImageOn SplashOff SplashTextOn Sqrt SRandom StatusbarGetText StderrRead ‘ +

‘StdinWrite StdioClose StdoutRead String StringAddCR StringCompare StringFormat StringFromASCIIArray StringInStr ‘ +

‘StringIsAlNum StringIsAlpha StringIsASCII StringIsDigit StringIsFloat StringIsInt StringIsLower StringIsSpace ‘ +

‘StringIsUpper StringIsXDigit StringLeft StringLen StringLower StringMid StringRegExp StringRegExpReplace ‘ +

‘StringReplace StringRight StringSplit StringStripCR StringStripWS StringToASCIIArray StringToBinary StringTrimLeft ‘ +

‘StringTrimRight StringUpper Tan TCPAccept TCPCloseSocket TCPConnect TCPListen TCPNameToIP TCPRecv TCPSend ‘ +

‘TCPShutdown, UDPShutdown TCPStartup, UDPStartup TimerDiff TimerInit ToolTip TrayCreateItem TrayCreateMenu ‘ +

‘TrayGetMsg TrayItemDelete TrayItemGetHandle TrayItemGetState TrayItemGetText TrayItemSetOnEvent TrayItemSetState ‘ +

‘TrayItemSetText TraySetClick TraySetIcon TraySetOnEvent TraySetPauseIcon TraySetState TraySetToolTip TrayTip UBound ‘ +

‘UDPBind UDPCloseSocket UDPOpen UDPRecv UDPSend VarGetType WinActivate WinActive WinClose WinExists WinFlash ‘ +

‘WinGetCaretPos WinGetClassList WinGetClientSize WinGetHandle WinGetPos WinGetProcess WinGetState WinGetText ‘ +

‘WinGetTitle WinKill WinList WinMenuSelectItem WinMinimizeAll WinMinimizeAllUndo WinMove WinSetOnTop WinSetState ‘ +

‘WinSetTitle WinSetTrans WinWait WinWaitActive WinWaitClose WinWaitNotActive’;

var macros = ‘@AppDataCommonDir @AppDataDir @AutoItExe @AutoItPID @AutoItVersion @AutoItX64 @COM_EventObj @CommonFilesDir ‘ +

‘@Compiled @ComputerName @ComSpec @CPUArch @CR @CRLF @DesktopCommonDir @DesktopDir @DesktopHeight @DesktopWidth ‘ +

‘@DesktopDepth @DesktopRefresh @DocumentsCommonDir @error @exitCode @exitMethod @extended @FavoritesCommonDir ‘ +

‘@FavoritesDir @GUI_CtrlId @GUI_CtrlHandle @GUI_DragId @GUI_DragFile @GUI_DropId @GUI_WinHandle @HomeDrive @HomePath ‘ +

‘@HomeShare @HOUR @HotKeyPressed @IPAddress1 @IPAddress2 @IPAddress3 @IPAddress4 @KBLayout @LF @LogonDNSDomain ‘ +

‘@LogonDomain @LogonServer @MDAY @MIN @MON @MSEC @MUILang @MyDocumentsDir @NumParams @OSArch @OSBuild @OSLang ‘ +

‘@OSServicePack @OSType @OSVersion @ProgramFilesDir @ProgramsCommonDir @ProgramsDir @ScriptDir @ScriptFullPath ‘ +

‘@ScriptLineNumber @ScriptName @SEC @StartMenuCommonDir @StartMenuDir @StartupCommonDir @StartupDir @SW_DISABLE ‘ +



‘@TempDir @TRAY_ID @TrayIconFlashing @TrayIconVisible @UserProfileDir @UserName @WDAY @WindowsDir @WorkingDir @YDAY @YEAR’;

var keywords =   ‘Func EndFunc ContinueCase ContinueLoop Default Dim

Global Local Const Do Until Enum Exit ExitLoop For To Step Next In If ‘


‘Then Else ElseIf EndIf ReDim Select Case EndSelect Static Switch EndSwitch While WEnd With EndWith’;

var r = SyntaxHighlighter.regexLib;

this.regexList = [

{ regex: r.multiLineDoubleQuotedString,        css: ‘string’ },         // double quoted strings

{ regex: r.multiLineSingleQuotedString,        css: ‘string’ },         // single quoted strings

{ regex: r.singleLineCComments,                css: ‘comments’ },         // one line comments

{ regex: r.multiLineCComments,                 css: ‘comments’ },         // multiline comments

{ regex: /^[&nbsp;]*;[^(rn)]+[rn]/gm,

css: ‘comments’ },            // one line comments starting with ;

{ regex: /s*#.*/gm,                           css: ‘comments’ },      // preprocessor tags like #region and #endregion

{ regex: /$w+/g,                              css: ‘variable’ },         // variables

{ regex: new RegExp(this.getKeywords(funcs), ‘gmi’),   css: ‘functions’ },         // documented functions

{ regex: new RegExp(this.getKeywords(keywords), ‘gm’),   css: ‘keyword’ },         // keywords

{ regex: new RegExp(this.getKeywords(macros), ‘gmi’),   css: ‘color1’ }            // documented macros




Brush.prototype   = new SyntaxHighlighter.Highlighter();

Brush.aliases   = [‘au3’, ‘autoit’];

SyntaxHighlighter.brushes.Autoit = Brush;

// CommonJS

typeof(exports) != ‘undefined’ ? exports.Brush = Brush : null;



place it inside the js folder of the syntax-highlighter plugin.

Then goto the “syntax-highlighter” folder inside the “wp-contentplugins” directory. Make the following changes to the “syntax_highlighter.php” file :

Change 1:

Add the following line ,


‘AutoIt’ ,


after the following line,


var $target = array(

‘AS3’ ,


Change 2:

add this line


“autoit”  => array(false, ‘AutoIt’, ‘js/shBrushAutoit.js’, ‘shBrushAutoit’) ,

[/javascript] after the following line


$this->languages = array(

“as3”  => array(false, ‘AS3’, ‘js/shBrushAS3.js’, ‘shBrushAS3’) ,


Change 3:

add this line


// AutoIt

if (isset($this->languages[“autoit”]) && $this->languages[“autoit”][0])

$scripts .= ‘<script type=”text/javascript”


[/javascript] after the following line


// AS3

if (isset($this->languages[“as3”]) && $this->languages[“as3″][0])

$scripts .= ‘<script type=”text/javascript”



Change 4:

add this line


function Shortcode_autoit($atts, $content = null) {return $this->Shortcode_Handler($atts, $content, ‘autoit’);}

[/javascript] before the following line



// parse shortcodes



Leave a comment

Your email address will not be published. Required fields are marked *