Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[Wrapper] Scintilla Wrapper v1.4.2.4


  • Please log in to reply
122 replies to this topic
hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006
I performed a git pull. updating to 1.4.2.4

-> Example 9 does still not work
-> Adding msgbox % a_scriptdir "\SciLexer.dll" to Example 3 shows, that the scilexer.dll is taken from the directory, where example 3 resides.
-> Modifying Example 1 with sci := new scintilla(WinExist(),10,10,100,100,a_scriptdir "\SciLexer.dll") makes example 1 fail as well (as expected ...)

:(

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010
can you check if the __sciNotify() function looks like this?:

__sciNotify(wParam, lParam, msg, hwnd){
    
    ; fix int for x64 bit systems
    __sciObj                 := __SCI(NumGet(lParam + 0))               ; Returns original object
    __sciObj.idFrom          := NumGet(lParam + a_Ptrsize * 1)
    __sciObj.scnCode         := NumGet(lParam + a_Ptrsize * 2)
   
    ...


if not please re-download, i think that what you just downloaded is the old version still (a mistake i made when pushing the changes)

now for the __Add() function do the following:

msgbox % DllPath ; put this
 if !SCIModule:=DllCall("LoadLibrary", "Str", DllPath) ; right before this line...

AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL

hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006
I verified to have the latest version - but Example 9 it still fails.

I put the following within the Notify() function of Ex9: outputDebug % obj.scnCode " - " SCN_CHARADDED " - " chr(obj.ch)

This results in following output:
3000 - 2001 - 
2013 - 2001 - 
2007 - 2001 - 
3000 - 2001 - 
2013 - 2001 - 
3000 - 2001 - 
2013 - 2001 - 
2008 - 2001 - 
2003 - 2001 - 
2008 - 2001 - 
2001 - 2001 - 
2000 - 2001 - 
2007 - 2001 - 
3000 - 2001 - 
2013 - 2001 - 
2000 - 2001 - 

Most of the lines do appear "automatically" - without pressing any key within scintilla-control. I only pressed "a" - but cannot see it in the output above ...

Modifying the __Add() function as you described, results in following:
-> Running unmodified Example1: "Scilexer.dll" (i.e. it's taken from path environment)
-> Running unmodified Example3: "[FULLY_QUALIFIED_SCRIPTPATH]\Scilexer.dll" (as given as parameter within sci.Add(hwndtab, x, 25, w, h, a_scriptdir "\scilexer.dll"))

Coco
  • Members
  • 697 posts
  • Last active: Oct 31 2015 07:26 PM
  • Joined: 27 Jul 2012
When setting a lexer, I just pass "2" for AHK right? Also, as per Scintilla docs, I can set up up to 9 keyword lists. Based on your example(Basic Highlighting), I can assume that this is 0-based index w/c is from 0-8. So, when setting the style, how do refer to a particular set of keywords?

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010
@hoppfrosch That with example 3 points to file permissions... somehow win7 does not allow the script to access that file if you have the whole path... I will ask around to see how to fix that.

The reason why those messages appear "automatically" is because scintilla sends a lot of messages beside SCN_CHARADDED... if you put the outputdebug inside the if statement you should see the debug only for that message.

I know what the problem is but im not sure right now how to fix it. I will keep trying.
The idea is that when i do the following in the sciNotify() function __sciObj.scnCode := NumGet(lParam + a_Ptrsize * 2)
that should get the information from memory, but as it is x64 the memory location is a bit different than x32 bit resulting on getting wrong information and the if statement failing... as soon as i figure how to get the correct info it will be working again! I promise! Posted Image

@coco
I will add this info on the OP!
Good question my friend, here is how the styles are numbered in the lexer:

val SCE_AHK_DEFAULT=0
val SCE_AHK_COMMENTLINE=1 (normal comment with semi-colon [;])
val SCE_AHK_COMMENTBLOCK=2 (block of comment with dash asterisk sequences [/* */])
val SCE_AHK_ESCAPE=3 (escape sequences with the back tick [`n `t `s])
val SCE_AHK_SYNOPERATOR=4 (these are considered syn operators: , %% [] + -= *= /= :=)
val SCE_AHK_EXPOPERATOR=5 ( these are exp<b></b>ression operators: - * ** / // ~ & << >> . () < > <= >= = == <> && ||)
val SCE_AHK_STRING=6 (quoted strings ["this is a string"])
val SCE_AHK_NUMBER=7
val SCE_AHK_IDENTIFIER=8 (whatever is enclosed in percent signs [%myvar%])
val SCE_AHK_VARREF=9 (Variable reference)
val SCE_AHK_LABEL=10 (a word followed by a colon [Label])

These here are keyword lists... you can set up the lists however you want but you have to link the list to the correct style below:

val SCE_AHK_WORD_CF=11 (Control Flow [if, else, break, continue] List)
val SCE_AHK_WORD_CMD=12 (Command [msgbox, winactivate] List)
val SCE_AHK_WORD_FN=13 (Functions [RegexMatch, Chr, Asc] List)
val SCE_AHK_WORD_DIR=14 (Directives [#noenv, #ifwinactive] List)
val SCE_AHK_WORD_KB=15 (Keyboard keys [Lbutton, Down, Up, Delete] List)
val SCE_AHK_WORD_VAR=16 (Variables [a_desktop, a_scriptdir] List)
val SCE_AHK_WORD_SP=17 (Special keywords [Byref, ahk_id] List)
val SCE_AHK_WORD_UD=18 (User Defined list)
val SCE_AHK_VARREFKW=19 (built in variables [a_desktop, a_scriptdir])
val SCE_AHK_ERROR=20 (not valid autohotkey syntax)


And this is a quick example how i set up the Autohotkey syntax in my AutoHotkey Toolkit script:

Loop, % sci.MaxIndex() ; I have an array with 5 scintilla components, this sets them all to the same Lexing values.
{
    cObj := a_index
    sci[cObj].SetLexer(2) ; SCLEX_AHK
    sci[cObj].SetWrapMode(SC_WRAP_WORD)

     ; Setting up default font options
    sci[cObj].StyleSetFont(STYLE_DEFAULT, "Courier New"), sci[cObj].StyleSetSize(STYLE_DEFAULT, 10)
    sci[cObj].StyleSetBold(STYLE_DEFAULT, true), sci[cObj].StyleClearAll()

     ; Setting up the keywords:
    Loop 7
    {
        listNum:=a_index-1
        sci[cObj].SetKeywords(listNum, (listNum = 0 ? options.selectSingleNode("//LiveCode/Keywords/FlowControl").text
        : listNum = 1 ? options.selectSingleNode("//LiveCode/Keywords/Commands").text
        : listNum = 2 ? options.selectSingleNode("//LiveCode/Keywords/Functions").text
        : listNum = 3 ? options.selectSingleNode("//LiveCode/Keywords/Directives").text
        : listNum = 4 ? options.selectSingleNode("//LiveCode/Keywords/Keys").text
        : listNum = 5 ? options.selectSingleNode("//LiveCode/Keywords/BuiltInVars").text
        : listNum = 6 ? options.selectSingleNode("//LiveCode/Keywords/Parameters").text))
    }

    sci[cObj].StyleSetFore(STYLE_LINENUMBER,0x8A8A8A), sci[cObj].StyleSetBold(STYLE_LINENUMBER, false)

     ; Setting up AHK lexer colors:
    bold := "0|1|2|4|5|6|7|8|9|17"
    colors=
    (LTrim Join| c
        0x000000 ; SCE_AHK_DEFAULT
        0x007700 ; SCE_AHK_COMMENTLINE
        0x007700 ; SCE_AHK_COMMENTBLOCK
        0xFF0000 ; SCE_AHK_ESCAPE
        0x000080 ; SCE_AHK_SYNOPERATOR
        0x000080 ; SCE_AHK_EXPOPERATOR
        0xA2A2A2 ; SCE_AHK_STRING
        0xFF9000 ; SCE_AHK_NUMBER
        0xFF9000 ; SCE_AHK_IDENTIFIER
        0xFF9000 ; SCE_AHK_VARREF
        0x0000DD ; SCE_AHK_LABEL
        0x0000DD ; SCE_AHK_WORD_CF
        0x0000DD ; SCE_AHK_WORD_CMD
        0xFF0090 ; SCE_AHK_WORD_FN
        0xA50000 ; SCE_AHK_WORD_DIR
        0xA2A2A2 ; SCE_AHK_WORD_KB
        0xFF9000 ; SCE_AHK_WORD_VAR
        0x0000DD ; SCE_AHK_WORD_SP
        0x00F000 ; SCE_AHK_WORD_UD
        0xFF9000 ; SCE_AHK_VARREFKW
        0xFF0000 ; SCE_AHK_ERROR
    )

    Loop, Parse, colors, |
        sci[cObj].StyleSetFore(a_index-1, a_loopfield)

    Loop, Parse, bold, |
        sci[cObj].StyleSetBold(a_loopfield, false)

    sci[cObj].StyleSetItalic(15, true) ; SCE_AHK_WORD_KB
}

AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010

I verified to have the latest version - but Example 9 it still fails.

I put the following within the Notify() function of Ex9: outputDebug % obj.scnCode " - " SCN_CHARADDED " - " chr(obj.ch)

This results in following output:

3000 - 2001 - 
2013 - 2001 - 
2007 - 2001 - 
3000 - 2001 - 
2013 - 2001 - 
3000 - 2001 - 
2013 - 2001 - 
2008 - 2001 - 
2003 - 2001 - 
2008 - 2001 - 
[color=#FF0000]2001 - 2001 - [/color] [color=#40BF00]; This should have been TRUE!!!![/color]
2000 - 2001 - 
2007 - 2001 - 
3000 - 2001 - 
2013 - 2001 - 
2000 - 2001 - 
...



Interesting, was that on x64??? because that means that my last changes ARE working!!

here is the output of the x32 outputdebug:

[3420] 2013 - 2001 -
[3420] 2013 - 2001 -
[3420] 2007 - 2001 -
[3420] 2013 - 2001 -
[3420] 2013 - 2001 -
[3420] 2008 - 2001 -
[3420] 2003 - 2001 -
[3420] 2008 - 2001 -
[3420] 2001 - 2001 - a
[3420] 2000 - 2001 -
[3420] 2007 - 2001 -
[3420] 2013 - 2001 -
[3420] 2008 - 2001 -
[3420] 2008 - 2001 -
[3420] 2001 - 2001 - s
[3420] 2008 - 2001 -
[3420] 2008 - 2001 -
[3420] 2001 - 2001 - d
[3420] 2000 - 2001 -
[3420] 2007 - 2001 -
[3420] 2013 - 2001 -
[3420] 2008 - 2001 -
[3420] 2008 - 2001 -
[3420] 2001 - 2001 - f
[3420] 2000 - 2001 -


As you can see the messages 2000, 2007, 2008, 2013 are all valid Scintilla messages!!
So now i have to figure out why is your chr(obj.ch) coming blank!!
We are getting closer to having this fixed my friend.

Can you do the following for me please?
in the Notify function add this: tooltip % isObject(obj) before the if statement... it should always be 1.

I have to figure out why [obj.scnCode] is good (it is returning correct scintilla messages) but [obj.ch] is not ok (seems to be blank on your end).

When that is solved then we are finished with this x64 business. :D
AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL

Coco
  • Members
  • 697 posts
  • Last active: Oct 31 2015 07:26 PM
  • Joined: 27 Jul 2012
Many thanks for the detailed explanation. Here is an example script, I altered example #7, I applied your tutorial: (note: I can't seem to get "VarRef" and "Identifiers" to work) - colors are based on the style- HatOfGod by budRich based on tidRich_Zenburn
#include SCI.ahk
#singleinstance force

;---------------------
; This is an example of how to select a Lexer located in a scintilla dll and make some basic highlighting.
; In this example we will select the AutoHotkey Lexer. Keywords are to be added manually so we will add some random words.
;
; The idea is to first select which lexer to use (specially if scilexer.dll has more than one) with SetLexer(lexNum)
; Then you can add some keywords to the keyword lists which will be colored as soon as they appear.
; Finally you can change the Font properties with StyleSetXXXX functions in this case I changed the color of the styles.

Gui +LastFound
sci := new scintilla(WinExist())

sci.StyleSetFont(32, "Segoe UI Semibold"), sci.StyleSetSize(32, 9) ; Font settings
, sci.StyleSetBack(32, "0x000000"), sci.SetCaretFore("0xFFFFFF") ; Background and caret
sci.SetWrapMode(true), sci.SetLexer(2), sci.StyleClearAll()

; Margin settings
, sci.SetMarginWidthN(0, 40) ; Line number
, sci.SetMarginWidthN(1, 10) ; Foldemargin
, sci.StyleSetFore(33, "0xCBCBAB") ; Foreground color
, sci.StyleSetBack(33, "0x333333") ; Background color

Loop, 7 {
    i := A_Index - 1
    , sci.SetKeywords(i, GetKeywords(A_Index))
}

Bold := ["0", "1", "2", "4", "5", "6", "7", "8", "9", "17"]
Colors := ["0xCBCBAB" ; SCE_AHK_DEFAULT
, "0x888888" ; SCE_AHK_COMMENTLINE
, "0xBBBBBB" ; SCE_AHK_COMMENTBLOCK
, "0x789EC6" ; SCE_AHK_ESCAPE
, "0x97C0EB" ; SCE_AHK_SYNOPERATOR
, "0xF09EC0" ; SCE_AHK_EXPOPERATOR
, "0xBBBBBB" ; SCE_AHK_STRING
, "0xFD971F" ; SCE_AHK_NUMBER
, "0x93CCB8" ; SCE_AHK_IDENTIFIER
, "0x000000" ; SCE_AHK_VARREF
, "0xC23669" ;  SCE_AHK_LABEL
, "0xA6E22E" ; SCE_AHK_WORD_CF
, "0xF79B57" ; SCE_AHK_WORD_CMD
, "0x7CC8CF" ; SCE_AHK_WORD_FN
, "0x7CC8CF" ; SCE_AHK_WORD_DIR
, "0xCB8DD9" ; SCE_AHK_WORD_KB
, "0xFF2679" ; SCE_AHK_WORD_VAR
, "0xFFE000" ; SCE_AHK_WORD_SP
, "0x0000FF" ; SCE_AHK_WORD_UD
, "0x000000" ; SCE_AHK_VARREFKW
, "0xFF0000"] ; SCE_AHK_ERROR

for k, v in Colors
    sci.StyleSetFore(A_Index-1, v)
for a, b in Bold
    sci.StyleSetBold(b, false)

Text :=
(
"Normal text = The quick brown fox jumps over the lazy dog
Comment line = ; This is a comment
Comment block =
 /*
 This
 is a
 comment
 */
Escape chars = ``t ``r ``n
Syn operators = {} , `%`% += -= *= /= :=
Expression operators = + - * ** / // ! ~ ^ & << >> . () < > <= >= = == != <> && ||
Quoted strings = ""This is a string""
Numbers = 1 2 3 4 5 6 7 8 9 0
Identifiers = `%Var`% ; I don't know how to make this one work
VarRef = A_Index`%1`% ; The color of identifiers should look like this, weird
Labels =
MyLabel:
Flow of control = break continue else exit exitapp gosub goto loop
AHK commands = autotrim blockinput clipwait control controlclick
Functions = abs acos asc asin atan ceil chr cos dllcall exp fileexist
Directives = #allowsamelinecomments #clipboardtimeout #commentflag
Keys and buttons = shift lshift rshift alt lalt ralt control lcontrol rcontrol ctrl
Built-in variables = a_ahkpath a_ahkversion a_appdata a_appdatacommon
Special keywords = ltrim rtrim join ahk_id ahk_pid ahk_class ahk_group ahk_exe
Invalid syntax = ""Incomplete quote `%Invalid deref"
)

sci.SetText(null, Text), sci.GrabFocus()

;~ sci.StyleSetBold(11, true)
;~ sci.StyleSetFore(11, 0x0000FF) ; Style No. 11 Belongs to SCE_AHK_WORD_CF in this particular lexer which is linked to the Keyword list No. 0 above.

Gui, Add, Edit, x10 y410 w530 -WantReturn vGuiMessage -0x100
Gui, Add, Button, x+10 Default, Search
Gui, Show, w600 h460
return

GuiClose:
    ExitApp
    
GetKeywords(num=1) {
    kw := ["break continue else exit exitapp gosub goto loop onexit pause repeat return settimer sleep suspend static global local var byref while until for class try catch throw"
    , "autotrim blockinput clipwait control controlclick controlfocus controlget controlgetfocus controlgetpos controlgettext controlmove controlsend controlsendraw controlsettext coordmode critical detecthiddentext detecthiddenwindows drive driveget drivespacefree edit endrepeat envadd envdiv envget envmult envset envsub envupdate fileappend filecopy filecopydir filecreatedir filecreateshortcut filedelete filegetattrib filegetshortcut filegetsize filegettime filegetversion fileinstall filemove filemovedir fileread filereadline filerecycle filerecycleempty fileremovedir fileselectfile fileselectfolder filesetattrib filesettime formattime getkeystate groupactivate groupadd groupclose groupdeactivate gui guicontrol guicontrolget hideautoitwin hotkey imagesearch inidelete iniread iniwrite input inputbox keyhistory keywait listhotkeys listlines listvars menu mouseclick mouseclickdrag mousegetpos mousemove msgbox outputdebug pixelgetcolor pixelsearch postmessage process progress random regdelete regread regwrite reload run runas runwait send sendevent sendinput sendlevel sendmessage sendmode sendplay sendraw setbatchlines setcapslockstate setcontroldelay setdefaultmousespeed setenv setformat setkeydelay setmousedelay setnumlockstate setscrolllockstate setstorecapslockmode settitlematchmode setwindelay setworkingdir shutdown 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 sysget thread tooltip transform traytip urldownloadtofile 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 fileencoding setregview"
    , "abs acos asc asin atan ceil chr cos dllcall exp fileexist floor getkeystate numget numput registercallback il_add il_create il_destroy instr islabel isfunc ln log lv_add lv_delete lv_deletecol lv_getcount lv_getnext lv_gettext lv_insert lv_insertcol lv_modify lv_modifycol lv_setimagelist mod onmessage round regexmatch regexreplace sb_seticon sb_setparts sb_settext sin sqrt strlen substr tan tv_add tv_delete tv_getchild tv_getcount tv_getnext tv_get tv_getparent tv_getprev tv_getselection tv_gettext tv_modify tv_setimagelist varsetcapacity winactive winexist trim ltrim rtrim fileopen strget strput object array isobject objinsert objremove objminindex objmaxindex objsetcapacity objgetcapacity objgetaddress objnewenum objaddref objrelease objhaskey objclone _insert _remove _minindex _maxindex _setcapacity _getcapacity _getaddress _newenum _addref _release _haskey _clone comobjcreate comobjget comobjconnect comobjerror comobjactive comobjenwrap comobjunwrap comobjparameter comobjmissing comobjtype comobjvalue comobjarray comobjquery comobjflags func getkeyname getkeyvk getkeysc isbyref exception"
    , "allowsamelinecomments clipboardtimeout commentflag errorstdout escapechar hotkeyinterval hotkeymodifiertimeout hotstring if iftimeout ifwinactive ifwinexist include includeagain inputlevel installkeybdhook installmousehook keyhistory ltrim maxhotkeysperinterval maxmem maxthreads maxthreadsbuffer maxthreadsperhotkey menumaskkey noenv notrayicon persistent singleinstance usehook warn winactivateforce"
    , "shift lshift rshift alt lalt ralt control lcontrol rcontrol ctrl lctrl rctrl lwin rwin appskey altdown altup shiftdown shiftup ctrldown ctrlup lwindown lwinup rwindown rwinup lbutton rbutton mbutton wheelup wheeldown xbutton1 xbutton2 joy1 joy2 joy3 joy4 joy5 joy6 joy7 joy8 joy9 joy10 joy11 joy12 joy13 joy14 joy15 joy16 joy17 joy18 joy19 joy20 joy21 joy22 joy23 joy24 joy25 joy26 joy27 joy28 joy29 joy30 joy31 joy32 joyx joyy joyz joyr joyu joyv joypov joyname joybuttons joyaxes joyinfo space tab enter escape esc backspace bs delete del insert ins pgup pgdn home end up down left right printscreen ctrlbreak pause scrolllock capslock numlock numpad0 numpad1 numpad2 numpad3 numpad4 numpad5 numpad6 numpad7 numpad8 numpad9 numpadmult numpadadd numpadsub numpaddiv numpaddot numpaddel numpadins numpadclear numpadup numpaddown numpadleft numpadright numpadhome numpadend numpadpgup numpadpgdn numpadenter f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12  f13 f14 f15 f16 f17 f18 f19 f20 f21 f22 f23 f24 browser_back browser_forward browser_refresh browser_stop browser_search browser_favorites browser_home volume_mute volume_down volume_up media_next media_prev media_stop media_play_pause launch_mail launch_media launch_app1 launch_app2 blind click raw wheelleft wheelright"
    , "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_guievent a_guicontrol a_guicontrolevent 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_isadmin a_iscompiled a_issuspended 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_screenheight a_screenwidth a_scriptdir a_scriptfullpath a_scriptname a_sec a_space a_startmenu a_startmenucommon a_startup a_startupcommon a_stringcasesense a_tab a_temp a_thishotkey 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 true false a_thisfunc a_thislabel a_ispaused a_iscritical a_isunicode a_ptrsize a_scripthwnd a_priorkey a_is64bitos a_regview"
    , "ltrim rtrim join ahk_id ahk_pid ahk_class ahk_group ahk_exe processname processpath minmax controllist statuscd filesystem setlabel alwaysontop mainwindow nomainwindow useerrorlevel altsubmit hscroll vscroll imagelist wantctrla wantf2 vis visfirst wantreturn backgroundtrans minimizebox maximizebox sysmenu toolwindow exstyle check3 checkedgray readonly notab lastfound lastfoundexist alttab shiftalttab alttabmenu alttabandmenu alttabmenudismiss controllisthwnd hwnd deref pow bitnot bitand bitor bitxor bitshiftleft bitshiftright sendandmouse mousemove mousemoveoff hkey_local_machine hkey_users hkey_current_user hkey_classes_root hkey_current_config hklm hku hkcu hkcr hkcc reg_sz reg_expand_sz reg_multi_sz reg_dword reg_qword reg_binary reg_link reg_resource_list reg_full_resource_descriptor reg_resource_requirements_list reg_dword_big_endian regex pixel mouse screen relative rgb low belownormal normal abovenormal high realtime between contains in is integer float number digit xdigit integerfast floatfast alpha upper lower alnum time date not or and topmost top bottom transparent transcolor redraw region id idlast count list capacity eject lock unlock label serial type status seconds minutes hours days read parse logoff close error single shutdown menu exit reload tray add rename check uncheck togglecheck enable disable toggleenable default nodefault standard nostandard color delete deleteall icon noicon tip click show edit progress hotkey text picture pic groupbox button link checkbox radio dropdownlist ddl combobox statusbar treeview listbox listview datetime monthcal updown slider tab tab2 activex iconsmall tile report sortdesc nosort nosorthdr grid hdr autosize range xm ym ys xs xp yp font resize owner submit nohide minimize maximize restore noactivate na cancel destroy center margin owndialogs guiescape guiclose guisize guicontextmenu guidropfiles tabstop section wrap border top bottom buttons expand first lines number uppercase lowercase limit password multi group background bold italic strike underline norm theme caption delimiter flash style checked password hidden left right center section move focus hide choose choosestring text pos enabled disabled visible notimers interrupt priority waitclose unicode tocodepage fromcodepage yes no ok cancel abort retry ignore force on off all send wanttab monitorcount monitorprimary monitorname monitorworkarea pid this base extends __get __set __call __delete __new new useunsetlocal useunsetglobal useenv localsameasglobal"]
    return kw[num]
}
Sample Screenshot:
Posted Image

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010
If you see my example, you will see that i set these guys to the same value:

SCE_AHK_VARREFKW
SCE_AHK_WORD_VAR
SCE_AHK_VARREF
SCE_AHK_IDENTIFIER
SCE_AHK_NUMBER <--- This is just personal preference

The reason is that I am not quite sure which is which because the lexer code for that is not that clear.

I am sure that SCE_AHK_VARREFKW is for variable keywords, and SCE_AHK_WORD_VAR is for the word list (that means you can set any words you like and treat them like variable keywords)

These two on the other hand are a little bit more obscure in their meaning for me:

SCE_AHK_VARREF
SCE_AHK_IDENTIFIER

If I were you, i would put a value on to them and see which one is the one responsible for the part that you want to colorize Because i noticed that you have some set to 0x000000 which is black, and your background is black... so it IS working is just that you have it set to the same color as the background.

Edit

This is the one that you should change to a different color: SCE_AHK_VARREF


AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL

Coco
  • Members
  • 697 posts
  • Last active: Oct 31 2015 07:26 PM
  • Joined: 27 Jul 2012
I tried applying the following in the loop to no avail: (I tried changing the style background, not working..I will run some more tests)
for k, v in Colors
    A_Index <> 20 && A_Index <> 10 ? sci.StyleSetFore(A_Index-1, v) : sci.StyleSetBack(A_Index-1, v)

Nonetheless, I'm glad that I somehow understand Scintilla styling now. Many thanks again:D

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010
Check my edit, I just ran your script and changed the color of SCE_AHK_VARREF to red and it worked right away.
AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL

Coco
  • Members
  • 697 posts
  • Last active: Oct 31 2015 07:26 PM
  • Joined: 27 Jul 2012

Check my edit, I just ran your script and changed the color of SCE_AHK_VARREF to red and it worked right away.

Thanks. Tried it, and it's working now. Cool!! Btw, how does folding work? I assume that it requires some RegEx or parsing of the entire contents..

Coco
  • Members
  • 697 posts
  • Last active: Oct 31 2015 07:26 PM
  • Joined: 27 Jul 2012
Btw, just noticed, "[]" belongs to SCE_AHK_SYNOPERATOR, but it doesn't seem to detect it.

hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006

So now i have to figure out why is your chr(obj.ch) coming blank!!
We are getting closer to having this fixed my friend.

Can you do the following for me please?
in the Notify function add this: tooltip % isObject(obj) before the if statement... it should always be 1.

I have to figure out why [obj.scnCode] is good (it is returning correct scintilla messages) but [obj.ch] is not ok (seems to be blank on your end).

When that is solved then we are finished with this x64 business. :D


Sry - wasn't on board yesterday ....

Here are the results of your request - currently my Notify() function looks like this:
Notify(wParam, lParam, msg, hwnd, obj){
  outputDebug % obj.scnCode " - " SCN_CHARADDED " - " chr(obj.ch) " - " isObject(obj) " - " obj.ch
  if (obj.scnCode = SCN_CHARADDED)
    MsgBox % chr(obj.ch)
  return
}

Results:
* isObject(obj) is ALWAYS true (as you expected)
* The MsgBox appears pressing a letter - the if() statement is correct therefore.
* The culprit is chr(obj.ch) - the tooltip seems to be shown in previous version (no Msgbox, but tooltip instead), but was "invisible", since chr(obj.ch) returns an empty string
* It seems that obj.ch does not contain a valid value in certain cases -> your guess about empty obj.ch was correct!

Output:
[color=#8000FF]Columns: obj.scnCode " - " SCN_CHARADDED " - " chr(obj.ch) " - " isObject(obj) " - " obj.ch[/color]
3000 - 2001 -  - 1 - 0
2013 - 2001 -  - 1 - 0
2008 - 2001 -  - 1 - 4466765987840
2003 - 2001 -  - 1 - 0
2008 - 2001 -  - 1 - 35257386532864
2001 - 2001 -  - 1 - 0  [color=#8000FF]<- "a" was pressed - Msgbox pops up![/color]
Thanks for your patience!

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010
I just set up a windows 7 virtual machine but i am unable to run the scripts using ahk x64 bit, as soon as i install x32 it works fine.... how were you able to work it out with that? (and it is not file permissions, if it was x32 bit wouldnt work either, but it does)
lol
I think the dllcall in x64bit is having a little problem but you said that some of the examples are working for you... are you using my scintilla dll or another?
AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010
Well guys, mistery resolved:
http://www.autohotke...64/#entry548926
AHK x64 cant load a x32 Dll... so for now, until i build a x64 version of SciLexer.dll only AHK x32bit is supported.
AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL