Syntax Highlighting (GeSHi) and Codeboxes

Propose new features and changes
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Syntax Highlighting (GeSHi) and Codeboxes

09 Oct 2013, 17:23

I edited and updated the autohotkey.php language file that comes with GeSHi. Since I'm new to this, there may be mistakes (it is untested). I'm interested to hear the community's opinion. Is it useful? Suggestions, corrections etc.? I didn't touch the font colors yet.

I think (untested) a major issue is that the URLs for the built-in variables are of the format http://www.auto-hotkey.com/docs/Variables.htm#Space instead of http://www.auto-hotkey.com/docs/Variables.htm#A_Space. So the "A_" will need to be removed if we want to link to each specific variable instead of http://www.auto-hotkey.com/docs/Variables.htm#BuiltIn for all the BIVs. I could remove the "A_" from all the variables in group 2, but that would mean that the "A_" would not be highlighted. Any suggestions?

Code: Select all

<?php
/*************************************************************************************
 * autohotkey.php
 * --------
 * Author: Naveen Garg (naveen.garg@gmail.com)
 * Copyright: (c) 2009 Naveen Garg and GeSHi and some parts kon
 * Release Version: N/A (Edited version of 1.0.8.11)
 * Date Started: 2009/06/11
 *
 * Autohotkey language file for GeSHi.
 *
 * CHANGES
 * Editor: kon
 * Revised: Oct. 9, 2013
 *
 * Release 1.0.8.5 (2009/06/11)
 * - First Release
 *
 * TODO
 * Update BIVs to link to the exact var
 *
 * Reference: http://www.auto-hotkey.com/docs/
 *************************************************************************************
 *
 *   The original file was part of GeSHi.
 *
 *   GeSHi is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   GeSHi is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with GeSHi; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 ************************************************************************************/

$language_data = array (
    'LANG_NAME' => 'Autohotkey',
    'COMMENT_SINGLE' => array(
        1 => ';'
        ),
    'COMMENT_MULTI' => array('/*' => '*/'),
    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
    'QUOTEMARKS' => array('"'),
    'ESCAPE_CHAR' => '',
    'KEYWORDS' => array(
        1 => array(
            'and','else','false','if',
            'in','is','not','or',
            'return','true'
            ),
        2 => array(
            // built in variables
            'A_AhkPath','A_AhkVersion','A_AppData','A_AppDataCommon',
            'A_AutoTrim','A_BatchLines','A_CaretX','A_CaretY',
            'A_ComputerName','A_ControlDelay','A_Cursor','A_DD',
            'A_DDD','A_DDDD','A_DefaultMouseSpeed','A_Desktop',
            'A_DesktopCommon','A_DetectHiddenText','A_DetectHiddenWindows','A_EndChar',
            'A_EventInfo','A_ExitReason','A_FormatFloat','A_FormatInteger',
            'A_Gui','A_GuiControl','A_GuiControlEvent','A_GuiEvent',
            'A_GuiHeight','A_GuiWidth','A_GuiX','A_GuiY',
            'A_Hour','A_IconFile','A_IconHidden','A_IconNumber',
            'A_IconTip','A_Index','A_IPAddress1','A_IPAddress2',
            'A_IPAddress3','A_IPAddress4','A_Is64bitOS','A_ISAdmin',
            'A_IsCompiled','A_IsCritical','A_IsPaused','A_IsSuspended',
            'A_IsUnicode','A_KeyDelay','A_Language','A_LastError',
            'A_LineFile','A_LineNumber','A_LoopField','A_LoopFileAttrib',
            'A_LoopFileDir','A_LoopFileExt','A_LoopFileFullPath','A_LoopFileLongPath',
            'A_LoopFileName','A_LoopFileShortName','A_LoopFileShortPath','A_LoopFileSize',
            'A_LoopFileSizeKB','A_LoopFileSizeMB','A_LoopFileTimeAccessed','A_LoopFileTimeCreated',
            'A_LoopFileTimeModified','A_LoopReadLine','A_LoopRegKey','A_LoopRegName',
            'A_LoopRegSubkey','A_LoopRegTimeModified','A_LoopRegType','A_MDAY',
            'A_Min','A_MM','A_MMM','A_MMMM',
            'A_Mon','A_MouseDelay','A_MSec','A_MyDocuments',
            'A_Now','A_NowUTC','A_NumBatchLines','A_OSType',
            'A_OSVersion','A_PriorHotkey','A_ProgramFiles','A_Programs',
            'A_ProgramsCommon','A_PtrSize','A_RegView','A_ScreenDPI',
            'A_ScreenHeight','A_ScreenWidth','A_ScriptDir','A_ScriptFullPath',
            'A_ScriptHwnd','A_ScriptName','A_Sec','A_Space',
            'A_StartMenu','A_StartMenuCommon','A_Startup','A_StartupCommon',
            'A_StringCaseSense','A_Tab','A_Temp','A_ThisFunc',
            'A_ThisHotkey','A_ThisLabel','A_ThisMenu','A_ThisMenuItem',
            'A_ThisMenuItemPos','A_TickCount','A_TimeIdle','A_TimeIdlePhysical',
            'A_TimeSincePriorHotkey','A_TimeSinceThisHotkey','A_TitleMatchMode','A_TitleMatchModeSpeed',
            'A_UserName','A_WDay','A_WinDelay','A_WinDir',
            'A_WorkingDir','A_YDay','A_YEAR','A_YWeek',
            'A_YYYY','Clipboard','ClipboardAll','ComSpec',
            'ErrorLevel','ProgramFiles'
            ),
        3 => array(
            // Commands
            'AutoTrim','BlockInput','Break','Catch',
            'Click','ClipWait','ComObjActive','ComObjArray',
            'ComObjConnect','ComObjCreate','ComObjError','ComObjFlags',
            'ComObjGet','ComObjQuery','ComObjType','ComObjValue',
            'Continue','Control','ControlClick','ControlFocus',
            'ControlGet','ControlGetFocus','ControlGetPos','ControlGetText',
            'ControlMove','ControlSend','ControlSendRaw','ControlSetText',
            'CoordMode','Critical','DetectHiddenText','DetectHiddenWindows',
            'DllCall','Drive','DriveGet','DriveSpaceFree',
            'Else','EnvAdd','EnvDiv','EnvGet',
            'EnvMult','EnvSet','EnvSub','EnvUpdate',
            'Exit','ExitApp','FileAppend','FileCopy',
            'FileCopyDir','FileCreateDir','FileCreateShortcut','FileDelete',
            'FileEncoding','FileGetAttrib','FileGetShortcut','FileGetSize',
            'FileGetTime','FileGetVersion','FileInstall','FileMove',
            'FileMoveDir','FileOpen','FileRead','FileReadLine',
            'FileRecycle','FileRecycleEmpty','FileRemoveDir','FileSelectFile',
            'FileSelectFolder','FileSetAttrib','FileSetTime','For',
            'FormatTime','Gosub','Goto','GroupActivate',
            'GroupAdd','GroupClose','GroupDeactivate','Gui',
            'GuiControl','GuiControlGet','Hotkey','IfExist',
            'IfInString','IfMsgBox','IfNotExist','IfNotInString',
            'ImageSearch','IniDelete','IniRead','IniWrite',
            'Input','InputBox','KeyHistory','KeyWait',
            'ListHotkeys','ListLines','ListVars','Loop',
            'Menu','MouseClick','MouseClickDrag','MouseGetPos',
            'MouseMove','MsgBox','OnExit','OnMessage',
            'OutputDebug','PixelGetColor','PixelSearch','PostMessage',
            'Process','Progress','Random','RegDelete',
            'RegExMatch','RegExReplace','RegisterCallback','RegRead',
            'RegWrite','Reload','Repeat','Return',
            'Run','RunAs','RunWait','SendLevel',
            'SendMessage','SendMode','SetBatchLines','SetCapslockState',
            'SetControlDelay','SetDefaultMouseSpeed','SetEnv','SetFormat',
            'SetKeyDelay','SetMouseDelay','SetNumlockState','SetRegView',
            'SetScrollLockState','SetStoreCapslockMode','SetStoreCapslockMode','SetTimer',
            'SetTitleMatchMode','SetWinDelay','SetWorkingDir','Shutdown',
            'Sleep','Sort','SoundBeep','SoundGet',
            'SoundGetWaveVolume','SoundPlay','SoundSet','SoundSetWaveVolume',
            'SplashImage','SplashTextOff','SplashTextOn','SplitPath',
            'StatusBarGetText','StatusBarWait','StringCaseSense','StringGetPos',
            'StringLeft','StringLen','StringLower','StringMid',
            'StringReplace','StringRight','StringSplit','StringTrimLeft',
            'StringTrimRight','StringUpper','Suspend','SysGet',
            'Thread','Throw','ToolTip','Transform',
            'TrayTip','Trim','Try','Until',
            'URLDownloadToFile','VarSetCapacity','While','WinActivate',
            'WinActivateBottom','WinClose','WinGet','WinGetActiveStats',
            'WinGetActiveTitle','WinGetClass','WinGetPos','WinGetText',
            'WinGetTitle','WinHide','WinKill','WinMaximize',
            'WinMenuSelectItem','WinMinimize','WinMinimizeAll','WinMinimizeAllUndo',
            'WinMove','WinRestore','WinSet','WinSetTitle',
            'WinShow','WinWait','WinWaitActive','WinWaitClose',
            'WinWaitNotActive'
            ),
        4 => array(
            // Built in functions
            'Abs','ACos','Asc','ASin',
            'ATan','Ceil','Chr','Cos',
            'Exp','FileExist','Floor','Func',
            'GetKeyName','GetKeyState','InStr','IsByRef',
            'IsFunc','IsLabel','IsObject','Ln',
            'Log','Mod','NumGet','NumPut',
            'Round','SB_SetIcon','SB_SetParts','SB_SetText',
            'Sin','Sqrt','StrLen','StrSplit',
            'SubStr','Tan','WinActive','WinExist'
            ),
        5 => array(
            // #Directives
            'AllowSameLineComments','ClipboardTimeout','CommentFlag','ErrorStdOut',
            'EscapeChar','HotkeyInterval','HotkeyModifierTimeout','Hotstring',
            'If','IfTimeout','InputLevel','InstallKeybdHook',
            'InstallMouseHook','KeyHistory','LTrim','MaxHotkeysPerInterval',
            'MaxMem','MaxThreads','MaxThreadsBuffer','MaxThreadsPerHotkey',
            'MenuMaskKey','NoEnv','NoTrayIcon','Persistent',
            'SingleInstance','UseHook','Warn','WinActivateForce'
            ),
        6 => array(
            // Keys
            'Alt','AltDown','AltUp','AppsKey',
            'BackSpace','Browser_Back','Browser_Favorites','Browser_Forward',
            'Browser_Home','Browser_Refresh','Browser_Search','Browser_Stop',
            'BS','CapsLock','Ctrl','CtrlBreak',
            'CtrlDown','CtrlUp','Del','Delete',
            'Down','End','Enter','Esc',
            'Escape','F1','F10','F11',
            'F12','F13','F14','F15',
            'F16','F17','F18','F19',
            'F2','F20','F21','F22',
            'F23','F24','F3','F4',
            'F5','F6','F7','F8',
            'F9','Home','Ins','Insert',
            'Joy1','Joy10','Joy11','Joy12',
            'Joy13','Joy14','Joy15','Joy16',
            'Joy17','Joy18','Joy19','Joy2',
            'Joy20','Joy21','Joy22','Joy23',
            'Joy24','Joy25','Joy26','Joy27',
            'Joy28','Joy29','Joy3','Joy30',
            'Joy31','Joy32','Joy4','Joy5',
            'Joy6','Joy7','Joy8','Joy9',
            'JoyAxes','JoyButtons','JoyInfo','JoyName',
            'JoyPOV','JoyR','JoyU','JoyV',
            'JoyX','JoyY','JoyZ','LAlt',
            'Launch_App1','Launch_App2','Launch_Mail','Launch_Media',
            'LButton','LControl','LCtrl','Left',
            'LShift','LWin','LWinDown','LWinUp',
            'MButton','Media_Next','Media_Play_Pause','Media_Prev',
            'Media_Stop','NumLock','Numpad0','Numpad1',
            'Numpad2','Numpad3','Numpad4','Numpad5',
            'Numpad6','Numpad7','Numpad8','Numpad9',
            'NumpadAdd','NumpadClear','NumpadDel','NumpadDiv',
            'NumpadDot','NumpadDown','NumpadEnd','NumpadEnter',
            'NumpadHome','NumpadIns','NumpadLeft','NumpadMult',
            'NumpadPgdn','NumpadPgup','NumpadRight','NumpadSub',
            'NumpadUp','Pause','PGDN','PGUP',
            'PrintScreen','RAlt','RButton','RControl',
            'RCtrl','Right','RShift','RWin',
            'RWinDown','RWinUp','ScrollLock','Shift',
            'ShiftDown','ShiftUp','Space','Tab',
            'Up','Volume_Down','Volume_Mute','Volume_Up',
            'WheelDown','WheelLeft','WheelRight','WheelUp',
            'XButton1','XButton2'
            ),
        7 => array(
            // Gui commands
            'Add','Cancel','Color','Default',
            'Destroy','Flash','Flash','Font',
            'GuiClose','GuiContextMenu','GuiDropFiles','GuiEscape',
            'GuiSize','Margin','Menu','New',
            'Show','Submit'
            ),
        8 => array(
            // Gui Controls
            'ActiveX','Button','Checkbox','ComboBox',
            'Custom','DateTime','DDL','DropDownList',
            'Edit','GroupBox','Hotkey','Link',
            'ListBox','ListView','MonthCal','Picture',
            'Progress','Radio','Slider','StatusBar',
            'Tab','Text','TreeView','UpDown'
            ),
        9 => array(
            // List View Functions
            'IL_Add','IL_Create','IL_Destroy','LV_Add',
            'LV_Delete','LV_DeleteCol','LV_GetCount','LV_GetNext',
            'LV_GetText','LV_Insert','LV_InsertCol','LV_Modify',
            'LV_ModifyCol','LV_SetImageList'
            ),
        10 => array(
            // Tree View Functions
            'TV_Add','TV_Delete','TV_Get','TV_GetChild',
            'TV_GetCount','TV_GetNext','TV_GetParent','TV_GetPrev',
            'TV_GetSelection','TV_GetText','TV_Modify','TV_SetImageList'
            ),
        11 => array(
            'StrGet','StrPut'
            ),
        12 => array(
            'IfWinActive','IfWinExist','IfWinNotActive','IfWinNotExist'
            ),
        13 => array(
            'Include','IncludeAgain'
            ),
        14 => array(
            'IfEqual','IfGreater','IfGreaterOrEqual','IfLess',
            'IfLessOrEqual','IfNotEqual'
            ),
        15 => array(
            'IfWinActive','IfWinNotActive'
            ),
        16 => array(
            'IfWinExist','IfWinNotExist'
            ),
        17 => array(
            'Send','SendEvent','SendInput','SendPlay',
            'SendRaw'
            )
        ),
    'SYMBOLS' => array(
        '(',')','[',']',
        '+','-','*','/','&','^',
        '=','+=','-=','*=','/=','&=',
        '==','<','<=','>','>=',':=',
        ',','.'
        ),
    'CASE_SENSITIVE' => array(
        GESHI_COMMENTS => false,
        1 => false,
        2 => false,
        3 => false,
        4 => false,
        5 => false,
        6 => false,
        7 => false,
        8 => false,
        9 => false,
        10 => false,
        11 => false,
        12 => false,
        13 => false,
        14 => false,
        15 => false,
        16 => false,
        17 => false
        ),
    'STYLES' => array(
        'KEYWORDS' => array(
            1 => 'color: #AAAAFF; font-weight: bold;',       // reserved #blue
            2 => 'color: #88FF88;',                         // BIV yellow
            3 => 'color: #FF00FF; font-style: italic;',       // commands purple
            4 => 'color: #888844; font-weight: bold;',       // functions #0080FF
            5 => 'color: #000000; font-style: italic;',    // directives #black
            6 => 'color: #FF0000; font-style: italic;',      // hotkeys #red
            7 => 'color: #000000; font-style: italic;',    // gui commands #black
            8 => 'color: #000000; font-style: italic;',      // gui controls
            9 => 'color: #888844; font-weight: bold;',       // list view functions #0080FF
            10 => 'color: #888844; font-weight: bold;',       // tree view functions #0080FF
            11 => 'color: #888844; font-weight: bold;',       // StrPut/StrGet functions #0080FF
            12 => 'color: #000000; font-style: italic;',     // IfWin directives #black
            13 => 'color: #000000; font-style: italic;',     // Include directives #black
            14 => 'color: #FF00FF; font-style: italic;',       // commands purple
            15 => 'color: #FF00FF; font-style: italic;',       // commands purple
            16 => 'color: #FF00FF; font-style: italic;',       // commands purple
            17 => 'color: #FF00FF; font-style: italic;'       // commands purple
            ),
        'COMMENTS' => array(
            'MULTI' => 'font-style: italic; color: #669900;',
            1 => 'font-style: italic; color: #009933;'
            ),
        'ESCAPE_CHAR' => array(
            0 => ''
            ),
        'BRACKETS' => array(
            0 => 'color: #00FF00; font-weight: bold;'
            ),
        'STRINGS' => array(
            0 => 'font-weight: bold; color: #008080;'
            ),
        'NUMBERS' => array(
            0 => 'color: #0000dd;'
            ),
        'METHODS' => array(
            1 => 'color: #0000FF; font-style: italic; font-weight: italic;'
            ),
        'SYMBOLS' => array(
            0 => 'color: #000000; font-weight: italic;'
            ),
        'REGEXPS' => array(
            0 => 'font-weight: italic; color: #A00A0;',
            1 => 'color: #CC0000; font-style: italic;',
            2 => 'color: #DD0000; font-style: italic;',
            3 => 'color: #88FF88;'
            ),
        'SCRIPT' => array(
            )
        ),
    'OOLANG' => false,
    'OBJECT_SPLITTERS' => array(
        1 => '_'
        ),
    'REGEXPS' => array(
        //Variables
        0 => '%[a-zA-Z_][a-zA-Z0-9_]*%',
        //hotstrings
        1 => '::[\w\d]+::',
        //labels
        2 => '\w[\w\d]+:\s',
        //Built-in Variables
        3 => '\bA_\w+\b(?![^<]*>)'
        ),
    'URLS' => array(
        1 => '',
        2 => 'http://www.auto-hotkey.com/docs/Variables.htm#BuiltIn',
        3 => 'http://www.auto-hotkey.com/docs/commands/{FNAME}.htm',
        4 => 'http://www.auto-hotkey.com/docs/Functions.htm#{FNAME}',
        5 => 'http://www.auto-hotkey.com/docs/commands/_{FNAME}.htm',
        6 => 'http://www.auto-hotkey.com/docs/KeyList.htm',
        7 => 'http://www.auto-hotkey.com/docs/commands/Gui.htm#{FNAME}',
        8 => 'http://www.auto-hotkey.com/docs/commands/GuiControls.htm#{FNAME}',
        9 => 'http://www.auto-hotkey.com/docs/commands/ListView.htm#{FNAME}',
        10 => 'http://www.auto-hotkey.com/docs/commands/TreeView.htm#{FNAME}',
        11 => 'http://www.auto-hotkey.com/docs/commands/StrPutGet.htm',
        12 => 'http://www.auto-hotkey.com/docs/commands/_IfWinActive.htm',
        13 => 'http://www.auto-hotkey.com/docs/commands/_Include.htm',
        14 => 'http://www.auto-hotkey.com/docs/commands/IfEqual.htm',
        15 => 'http://www.auto-hotkey.com/docs/commands/IfWinActive.htm',
        16 => 'http://www.auto-hotkey.com/docs/commands/IfWinExist.htm',
        17 => 'http://www.auto-hotkey.com/docs/commands/Send.htm'
        ),
    'STRICT_MODE_APPLIES' => GESHI_MAYBE,
    'SCRIPT_DELIMITERS' => array(
        ),
    'HIGHLIGHT_STRICT_BLOCK' => array(
        0 => true,
        1 => true,
        2 => true,
        3 => true
        ),
    'PARSER_CONTROL' => array(
        'KEYWORDS' => array(
            5 => array(
                'DISALLOWED_BEFORE' => '(?<!\w)\#'
                )
            )
        )
);

?>
Change Log:
Spoiler
Edit: Everything following has been resolved:

Here is another untested thought, this time on the font size. I posted this in another topic, but this thread is more appropriate:
The GeSHi docs say that GeSHi outputs code that is either in a <div> or a <pre> container. <div> typically results in text which is bigger than <pre>, hence the larger font we are seeing in codeboxes unless we add size tags to compensate.
Calling the set_overall_style method should adjust the font size and type. Something like this:

Code: Select all

$geshi->set_overall_style('font-family:Consolas; font-size: 68%;')
And lastly, when I tried to change the font of a codebox it changed all the "(" to "&#40;". I think others have had this problem also, and I believe it may be (at least partially) due to changing the font.
Last edited by kon on 15 Oct 2013, 13:06, edited 7 times in total.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Syntax Highlighting (GeSHi) and Codeboxes

10 Oct 2013, 01:53

Desired state / Soll-Zustand
Image

Actual state / Ist-Zustand

Code: Select all

typedef struct _MEMORYSTATUSEX {
	DWORD     dwLength;                  //       (0)   The size of the structure, in bytes.
	DWORD     dwMemoryLoad;              // 4  =>  4    A number between 0 and 100 percentage of physical memory that is in use
	DWORDLONG ullTotalPhys;              // 8  =>  8    The amount of actual physical memory, in bytes.
	DWORDLONG ullAvailPhys;              // 8  => 16    The amount of physical memory currently available, in bytes.
	DWORDLONG ullTotalPageFile;          // 8  => 24    The current committed memory limit for the system or the current process, in bytes.
	DWORDLONG ullAvailPageFile;          // 8  => 32    The maximum amount of memory the current process can commit, in bytes.
	DWORDLONG ullTotalVirtual;           // 8  => 40    The size of the user-mode portion of the virtual address space of the calling process, in bytes.
	DWORDLONG ullAvailVirtual;           // 8  => 48    The amount of unreserved and uncommitted memory currently in the user-mode portion of the virtual address space of the calling process, in bytes.
	DWORDLONG ullAvailExtendedVirtual;   // 8  => 56    Reserved. This value is always 0.
} MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
FONT IS TOOOO BIG
Last edited by jNizM on 10 Oct 2013, 01:59, edited 1 time in total.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Syntax Highlighting (GeSHi) and Codeboxes

10 Oct 2013, 01:58

Desired state / Soll-Zustand
Image


Actual state / Ist-Zustand

Code: Select all

GlobalMemoryStatusEx(GMS = 1) {
    VarSetCapacity(MEMORYSTATUSEX, 64, 0)
    NumPut(64, MEMORYSTATUSEX)
    DllCall("GlobalMemoryStatusEx", "ptr", &MEMORYSTATUSEX)
    return, % (GMS = "0") ? NumGet(MEMORYSTATUSEX, 0, "Int")
            : (GMS = "1") ? NumGet(MEMORYSTATUSEX, 4, "Int")
            : (GMS = "2") ? Round((NumGet(MEMORYSTATUSEX,  8, "Int64") / 1024**2), 2)
            : (GMS = "3") ? Round((NumGet(MEMORYSTATUSEX, 16, "Int64") / 1024**2), 2)
            : (GMS = "4") ? Round((NumGet(MEMORYSTATUSEX, 24, "Int64") / 1024**2), 2)
            : (GMS = "5") ? Round((NumGet(MEMORYSTATUSEX, 32, "Int64") / 1024**2), 2)
            : (GMS = "6") ? Round((NumGet(MEMORYSTATUSEX, 40, "Int64") / 1024**2), 2)
            : (GMS = "7") ? Round((NumGet(MEMORYSTATUSEX, 48, "Int64") / 1024**2), 2)
            : (GMS = "8") ? NumGet(MEMORYSTATUSEX, 56, "Int")
            : "FAIL"
}

MsgBox,, GlobalMemoryStatusEx, % "GlobalMemoryStatusEx function /`n"
        . "MEMORYSTATUSEX structure`n`n"
        . "Lenght:`t`t`t"             GlobalMemoryStatusEx(0)  "`n`n"
        . "MemoryLoad:`t`t"           GlobalMemoryStatusEx(1)  " %`n`n"
        . "TotalPhys:`t`t`t"          GlobalMemoryStatusEx(2)  " MB`n"
        . "AvailPhys:`t`t`t"          GlobalMemoryStatusEx(3)  " MB`n`n"
        . "TotalPageFile:`t`t"        GlobalMemoryStatusEx(4)  " MB`n"
        . "AvailPageFile:`t`t"        GlobalMemoryStatusEx(5)  " MB`n`n"
        . "TotalVirtual:`t`t"         GlobalMemoryStatusEx(6)  " MB`n"
        . "AvailVirtual:`t`t"         GlobalMemoryStatusEx(7)  " MB`n`n"
        . "AvailExtendedVirtual:`t`t" GlobalMemoryStatusEx(8)

FONT IS TOOOO BIG
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Syntax Highlighting (GeSHi) and Codeboxes

10 Oct 2013, 02:01

And how about better colors?

Example 1

Example 2
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Syntax Highlighting (GeSHi) and Codeboxes

14 Oct 2013, 14:52

How does everyone feel about changing the color of built in variables? The default theme of SciTE4AutoHotkey uses "CF00CF,bold,italics", but I would be happy with anything that provides more contrast than the current bright green on a white background.
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Syntax Highlighting (GeSHi) and Codeboxes

14 Oct 2013, 15:27

How does everyone feel about changing the font of "commands" to bold? The current navy blue is hard to distinguish from regular black text.
User avatar
tank
Posts: 3130
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: Syntax Highlighting (GeSHi) and Codeboxes

14 Oct 2013, 22:13

ok how about now
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
User avatar
tank
Posts: 3130
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: Syntax Highlighting (GeSHi) and Codeboxes

14 Oct 2013, 22:26

tired goin to bed now
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Syntax Highlighting (GeSHi) and Codeboxes

14 Oct 2013, 22:28

I like the colors, thanks for getting to that so quickly!
The font size of codeboxes seems to have gotten smaller though (at least for me it has - Firefox).
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Syntax Highlighting (GeSHi) and Codeboxes

14 Oct 2013, 23:11

I just noticed that the GeSHi links to the docs are enabled again. Wow. Thanks.
The additions to the docs look great by the way. :) ("Ask for help | IRC Channel | Commands | Tutorial | Download")
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Syntax Highlighting (GeSHi) and Codeboxes

15 Oct 2013, 13:00

The current state of syntax highlighting is great, so fine tuning it is probably not a high priority. That being said, I made a list of the candidate words for syntax highlighting in hopes it will be useful for any future changes to GeSHi. Let me know if I forgot anything or if you have a suggestion and I will edit this post to include it.

Code: Select all

and else false if in is not or return true 

;Built in variables
;Currently links to: http://www.auto-hotkey.com/docs/Variables.htm#{FNAME} <- note that this does not work
;it could be changed to: http://www.auto-hotkey.com/docs/Variables.htm#BuiltIn
;or find a way to remove the "A_" from the URL ex: http://www.auto-hotkey.com/docs/Variables.htm#AhkPath
A_AhkPath A_AhkVersion A_AppData A_AppDataCommon A_AutoTrim A_BatchLines 
A_CaretX A_CaretY A_ComputerName A_ControlDelay A_Cursor A_DD A_DDD A_DDDD 
A_DefaultMouseSpeed A_Desktop A_DesktopCommon A_DetectHiddenText 
A_DetectHiddenWindows A_EndChar A_EventInfo A_ExitReason A_FormatFloat 
A_FormatInteger A_Gui A_GuiControl A_GuiControlEvent A_GuiEvent A_GuiHeight 
A_GuiWidth A_GuiX A_GuiY A_Hour A_IconFile A_IconHidden A_IconNumber A_IconTip 
A_Index A_IPAddress1 A_IPAddress2 A_IPAddress3 A_IPAddress4 A_Is64bitOS 
A_ISAdmin A_IsCompiled A_IsCritical A_IsPaused A_IsSuspended A_IsUnicode 
A_KeyDelay A_Language A_LastError A_LineFile A_LineNumber A_LoopField 
A_LoopFileAttrib A_LoopFileDir A_LoopFileExt A_LoopFileFullPath 
A_LoopFileLongPath A_LoopFileName A_LoopFileShortName A_LoopFileShortPath 
A_LoopFileSize A_LoopFileSizeKB A_LoopFileSizeMB A_LoopFileTimeAccessed 
A_LoopFileTimeCreated A_LoopFileTimeModified A_LoopReadLine A_LoopRegKey 
A_LoopRegName A_LoopRegSubkey A_LoopRegTimeModified A_LoopRegType A_MDAY A_Min 
A_MM A_MMM A_MMMM A_Mon A_MouseDelay A_MSec A_MyDocuments A_Now A_NowUTC 
A_NumBatchLines A_OSType A_OSVersion A_PriorHotkey A_ProgramFiles A_Programs 
A_ProgramsCommon A_PtrSize A_RegView A_ScreenDPI A_ScreenHeight A_ScreenWidth 
A_ScriptDir A_ScriptFullPath A_ScriptHwnd A_ScriptName A_Sec A_Space A_StartMenu 
A_StartMenuCommon A_Startup A_StartupCommon A_StringCaseSense A_Tab A_Temp 
A_ThisFunc A_ThisHotkey A_ThisLabel A_ThisMenu A_ThisMenuItem A_ThisMenuItemPos 
A_TickCount A_TimeIdle A_TimeIdlePhysical A_TimeSincePriorHotkey 
A_TimeSinceThisHotkey A_TitleMatchMode A_TitleMatchModeSpeed A_UserName A_WDay 
A_WinDelay A_WinDir A_WorkingDir A_YDay A_YEAR A_YWeek A_YYYY Clipboard 
ClipboardAll ComSpec ErrorLevel ProgramFiles

;Commands
;Currently links to: http://www.auto-hotkey.com/docs/commands/{FNAME}.htm
;Suggestion: remove "else", "return" and "while" from the first group and add
;them to the this group so that they can be linked to their pages in the docs
;the same way "Loop" is currently. ex: http://www.auto-hotkey.com/docs/commands/While.htm
AutoTrim BlockInput Break Catch Click ClipWait ComObjActive ComObjArray 
ComObjConnect ComObjCreate ComObjError ComObjFlags ComObjGet ComObjQuery 
ComObjType ComObjValue Continue Control ControlClick ControlFocus ControlGet 
ControlGetFocus ControlGetPos ControlGetText ControlMove ControlSend 
ControlSendRaw ControlSetText CoordMode Critical DetectHiddenText 
DetectHiddenWindows DllCall Drive DriveGet DriveSpaceFree Else EnvAdd EnvDiv 
EnvGet EnvMult EnvSet EnvSub EnvUpdate Exit ExitApp FileAppend FileCopy 
FileCopyDir FileCreateDir FileCreateShortcut FileDelete FileEncoding 
FileGetAttrib FileGetShortcut FileGetSize FileGetTime FileGetVersion FileInstall 
FileMove FileMoveDir FileOpen FileRead FileReadLine FileRecycle FileRecycleEmpty 
FileRemoveDir FileSelectFile FileSelectFolder FileSetAttrib FileSetTime For 
FormatTime GetKeyState Gosub Goto GroupActivate GroupAdd GroupClose GroupDeactivate 
Gui GuiControl GuiControlGet Hotkey IfExist IfInString IfMsgBox IfNotExist 
IfNotInString ImageSearch IniDelete IniRead IniWrite Input InputBox KeyHistory 
KeyWait ListHotkeys ListLines ListVars Loop Menu MouseClick MouseClickDrag 
MouseGetPos MouseMove MsgBox OnExit OnMessage OutputDebug PixelGetColor 
PixelSearch PostMessage Process Progress Random RegDelete RegExMatch 
RegExReplace RegisterCallback RegRead RegWrite Reload Repeat Return Run RunAs 
RunWait SendLevel SendMessage SendMode SetBatchLines SetCapslockState 
SetControlDelay SetDefaultMouseSpeed SetEnv SetFormat SetKeyDelay SetMouseDelay 
SetNumlockState SetRegView SetScrollLockState SetStoreCapslockMode 
SetStoreCapslockMode SetTimer SetTitleMatchMode SetWinDelay SetWorkingDir 
Shutdown Sleep Sort SoundBeep SoundGet SoundGetWaveVolume SoundPlay SoundSet 
SoundSetWaveVolume SplashImage SplashTextOff SplashTextOn SplitPath 
StatusBarGetText StatusBarWait StringCaseSense StringGetPos StringLeft StringLen 
StringLower StringMid StringReplace StringRight StringSplit StringTrimLeft 
StringTrimRight StringUpper Suspend SysGet Thread Throw ToolTip Transform 
TrayTip Trim Try Until URLDownloadToFile VarSetCapacity While WinActivate 
WinActivateBottom WinClose WinGet WinGetActiveStats WinGetActiveTitle 
WinGetClass WinGetPos WinGetText WinGetTitle WinHide WinKill WinMaximize 
WinMenuSelectItem WinMinimize WinMinimizeAll WinMinimizeAllUndo WinMove 
WinRestore WinSet WinSetTitle WinShow WinWait WinWaitActive WinWaitClose 
WinWaitNotActive 

;Built in functions
;Currently links to: http://auto-hotkey.com/docs/Functions.htm#BuiltIn
;Could be changed to: http://www.auto-hotkey.com/docs/Functions.htm#{FNAME}
Abs ACos Asc ASin ATan Ceil Chr Cos Exp FileExist Floor Func GetKeyName 
InStr IsByRef IsFunc IsLabel IsObject Ln Log Mod NumGet NumPut Round SB_SetIcon 
SB_SetParts SB_SetText Sin Sqrt StrLen StrSplit SubStr Tan WinActive WinExist

;Built in list view functions
;Could be changed to: http://www.auto-hotkey.com/docs/commands/ListView.htm#{FNAME}
IL_Add IL_Create IL_Destroy LV_Add LV_Delete LV_DeleteCol LV_GetCount LV_GetNext 
LV_GetText LV_Insert LV_InsertCol LV_Modify LV_ModifyCol LV_SetImageList 

;Built in tree view functions
;Could be changed to: http://www.auto-hotkey.com/docs/commands/TreeView.htm#{FNAME}
TV_Add TV_Delete TV_Get TV_GetChild TV_GetCount TV_GetNext TV_GetParent 
TV_GetPrev TV_GetSelection TV_GetText TV_Modify TV_SetImageList 

;Directives
;Currently links to: http://www.auto-hotkey.com/docs/commands/_{FNAME}.htm
#AllowSameLineComments #ClipboardTimeout #CommentFlag #ErrorStdOut #EscapeChar 
#HotkeyInterval #HotkeyModifierTimeout #Hotstring #If #IfTimeout #InputLevel 
#InstallKeybdHook #InstallMouseHook #KeyHistory #LTrim #MaxHotkeysPerInterval 
#MaxMem #MaxThreads #MaxThreadsBuffer #MaxThreadsPerHotkey #MenuMaskKey #NoEnv 
#NoTrayIcon #Persistent #SingleInstance #UseHook #Warn #WinActivateForce

;Keys
;Could be linked to: http://www.auto-hotkey.com/docs/KeyList.htm
Alt AltDown AltUp AppsKey BackSpace Browser_Back Browser_Favorites 
Browser_Forward Browser_Home Browser_Refresh Browser_Search Browser_Stop BS 
CapsLock Ctrl CtrlBreak CtrlDown CtrlUp Del Delete Down End Enter Esc Escape F1 
F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F2 F20 F21 F22 F23 F24 F3 F4 F5 F6 F7 F8 
F9 Home Ins Insert Joy1 Joy10 Joy11 Joy12 Joy13 Joy14 Joy15 Joy16 Joy17 Joy18 
Joy19 Joy2 Joy20 Joy21 Joy22 Joy23 Joy24 Joy25 Joy26 Joy27 Joy28 Joy29 Joy3 
Joy30 Joy31 Joy32 Joy4 Joy5 Joy6 Joy7 Joy8 Joy9 JoyAxes JoyButtons JoyInfo 
JoyName JoyPOV JoyR JoyU JoyV JoyX JoyY JoyZ LAlt Launch_App1 Launch_App2 
Launch_Mail Launch_Media LButton LControl LCtrl Left LShift LWin LWinDown LWinUp 
MButton Media_Next Media_Play_Pause Media_Prev Media_Stop NumLock Numpad0 
Numpad1 Numpad2 Numpad3 Numpad4 Numpad5 Numpad6 Numpad7 Numpad8 Numpad9 
NumpadAdd NumpadClear NumpadDel NumpadDiv NumpadDot NumpadDown NumpadEnd 
NumpadEnter NumpadHome NumpadIns NumpadLeft NumpadMult NumpadPgdn NumpadPgup 
NumpadRight NumpadSub NumpadUp Pause PGDN PGUP PrintScreen RAlt RButton RControl 
RCtrl Right RShift RWin RWinDown RWinUp ScrollLock Shift ShiftDown ShiftUp Space 
Tab Up Volume_Down Volume_Mute Volume_Up WheelDown WheelLeft WheelRight WheelUp 
XButton1 XButton2 

;Gui commands
;Currently Links to: http://www.auto-hotkey.com/docs/commands/Gui.htm#{FNAME}
Add Cancel Color Default Destroy Flash Flash Font GuiClose GuiContextMenu 
GuiDropFiles GuiEscape GuiSize Margin Menu New Show Submit 

;Gui controls
;Currently Links to: http://www.auto-hotkey.com/docs/commands/GuiControls.htm#{FNAME}
ActiveX Button Checkbox ComboBox Custom DateTime DDL DropDownList Edit GroupBox 
Hotkey Link ListBox ListView MonthCal Picture Progress Radio Slider StatusBar 
Tab Text TreeView UpDown 

;------------------------------------------------------------------------------------
;Atypical URLs in docs - ie. the same URL for multiple commands
;http://www.auto-hotkey.com/docs/commands/StrPutGet.htm
StrPut StrGet

;http://www.auto-hotkey.com/docs/commands/_IfWinActive.htm
#IfWinActive #IfWinExist #IfWinNotActive #IfWinNotExist 

;http://www.auto-hotkey.com/docs/commands/_Include.htm
#Include #IncludeAgain 

;http://www.auto-hotkey.com/docs/commands/IfEqual.htm
IfEqual IfGreater IfGreaterOrEqual IfLess IfLessOrEqual IfNotEqual 

;http://www.auto-hotkey.com/docs/commands/IfWinActive.htm
IfWinActive IfWinNotActive 

;http://www.auto-hotkey.com/docs/commands/IfWinExist.htm
IfWinExist IfWinNotExist 

;http://www.auto-hotkey.com/docs/commands/Send.htm
Send SendEvent SendInput SendPlay SendRaw

;http://www.auto-hotkey.com/docs/commands/LoopParse.htm
Parse

;http://www.auto-hotkey.com/docs/commands/LoopReadFile.htm
Read
Edit:
The order and grouping is the same as the autohotkey.php language file that comes with GeSHi with the following exceptions.
  • List view and tree view functons are seperated from the other built in functions because they could optionally be linked to differently.
  • Atypical URLs (ie. the same URL is used for multiple commands) are noted at the end of the list.
The grouping is generally dictated by the URLs of the docs. Similar URLs are grouped together.
User avatar
tank
Posts: 3130
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: Syntax Highlighting (GeSHi) and Codeboxes

03 Nov 2013, 12:32

I am working thru your list Kon and made a few updates will make more next weekend
Thanks for compiling this
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Syntax Highlighting (GeSHi) and Codeboxes

29 Dec 2014, 09:35

Code: Select all

SendMessage    ; ==> http://ahkscript.org/docs/commands/SendMessage.htm (Error 404 - File not found)
PostMessage    ; ==> http://ahkscript.org/docs/commands/PostMessage.htm (For SendMessage too)
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 36 guests