How can I find the value to send to Notepad++ through send message.
-
Greetings, I want to use the send message functionality to get the current line number and column from Notepad++ by an external program which is AutoHotKey. AutoHotKey requires the message to be a number, and not a code like (NPPM_GETCURRENTLINE or NPPM_GETCURRENTCOLUMN)
I looked at the “Notepad_plus_msgs.h” file but the #define lines are slightly ambiguous and I can’t seem to find the number that I should send to notepad++ to get the current line number and column number. -
I figured it out, I had to calculate the number myself and assume WM_USER to be equal to 1024. So for example for NPPM_GETCURRENTLINE, it is 1024 + 3000 + 8 which is equal to 4032.
-
@asadMarmash said in How can I find the value to send to Notepad++ through send message.:
I had to calculate the number myself
Correct.
and assume WM_USER to be equal to 1024
That’s a given, not an assumption, per MS documentation for WM_USER
-
@asadMarmash said in How can I find the value to send to Notepad++ through send message.:
I had to calculate the number myself
Another way is to let the NppExec plugin do the math. Install this plugin via PluginsAdmin and open its console. Then type:
set $(var) ~ NPPM_GETCURRENTLINE echo $(var)
The output will be (as expected) 4032.
-
Here’s a table for the plugin messages; hopefully complete – it’s autogenerated so I just “spot-checked”. It should be current to N++ v8.5.2.
(Aside: making it gave me the first practical use for the script from THIS thread. What I needed was remarkably similar to the OP’s need from that thread!)
NPPM_xxx Value NPPM_GETCURRENTSCINTILLA 2028 NPPM_GETCURRENTLANGTYPE 2029 NPPM_SETCURRENTLANGTYPE 2030 NPPM_GETNBOPENFILES 2031 NPPM_GETOPENFILENAMES 2032 NPPM_MODELESSDIALOG 2036 NPPM_GETNBSESSIONFILES 2037 NPPM_GETSESSIONFILES 2038 NPPM_SAVESESSION 2039 NPPM_SAVECURRENTSESSION 2040 NPPM_GETOPENFILENAMESPRIMARY 2041 NPPM_GETOPENFILENAMESSECOND 2042 NPPM_CREATESCINTILLAHANDLE 2044 NPPM_DESTROYSCINTILLAHANDLE 2045 NPPM_GETNBUSERLANG 2046 NPPM_GETCURRENTDOCINDEX 2047 NPPM_SETSTATUSBAR 2048 NPPM_GETMENUHANDLE 2049 NPPM_ENCODESCI 2050 NPPM_DECODESCI 2051 NPPM_ACTIVATEDOC 2052 NPPM_LAUNCHFINDINFILESDLG 2053 NPPM_DMMSHOW 2054 NPPM_DMMHIDE 2055 NPPM_DMMUPDATEDISPINFO 2056 NPPM_DMMREGASDCKDLG 2057 NPPM_LOADSESSION 2058 NPPM_DMMVIEWOTHERTAB 2059 NPPM_RELOADFILE 2060 NPPM_SWITCHTOFILE 2061 NPPM_SAVECURRENTFILE 2062 NPPM_SAVEALLFILES 2063 NPPM_SETMENUITEMCHECK 2064 NPPM_ADDTOOLBARICON_DEPRECATED 2065 NPPM_GETWINDOWSVERSION 2066 NPPM_DMMGETPLUGINHWNDBYNAME 2067 NPPM_MAKECURRENTBUFFERDIRTY 2068 NPPM_GETENABLETHEMETEXTUREFUNC_DEPRECATED 2069 NPPM_GETPLUGINSCONFIGDIR 2070 NPPM_MSGTOPLUGIN 2071 NPPM_MENUCOMMAND 2072 NPPM_TRIGGERTABBARCONTEXTMENU 2073 NPPM_GETNPPVERSION 2074 NPPM_HIDETABBAR 2075 NPPM_ISTABBARHIDDEN 2076 NPPM_GETPOSFROMBUFFERID 2081 NPPM_GETFULLPATHFROMBUFFERID 2082 NPPM_GETBUFFERIDFROMPOS 2083 NPPM_GETCURRENTBUFFERID 2084 NPPM_RELOADBUFFERID 2085 NPPM_GETBUFFERLANGTYPE 2088 NPPM_SETBUFFERLANGTYPE 2089 NPPM_GETBUFFERENCODING 2090 NPPM_SETBUFFERENCODING 2091 NPPM_GETBUFFERFORMAT 2092 NPPM_SETBUFFERFORMAT 2093 NPPM_HIDETOOLBAR 2094 NPPM_ISTOOLBARHIDDEN 2095 NPPM_HIDEMENU 2096 NPPM_ISMENUHIDDEN 2097 NPPM_HIDESTATUSBAR 2098 NPPM_ISSTATUSBARHIDDEN 2099 NPPM_GETSHORTCUTBYCMDID 2100 NPPM_DOOPEN 2101 NPPM_SAVECURRENTFILEAS 2102 NPPM_GETCURRENTNATIVELANGENCODING 2103 NPPM_ALLOCATESUPPORTED 2104 NPPM_ALLOCATECMDID 2105 NPPM_ALLOCATEMARKER 2106 NPPM_GETLANGUAGENAME 2107 NPPM_GETLANGUAGEDESC 2108 NPPM_SHOWDOCLIST 2109 NPPM_ISDOCLISTSHOWN 2110 NPPM_GETAPPDATAPLUGINSALLOWED 2111 NPPM_GETCURRENTVIEW 2112 NPPM_DOCLISTDISABLEEXTCOLUMN 2113 NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR 2114 NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR 2115 NPPM_SETSMOOTHFONT 2116 NPPM_SETEDITORBORDEREDGE 2117 NPPM_SAVEFILE 2118 NPPM_DISABLEAUTOUPDATE 2119 NPPM_REMOVESHORTCUTBYCMDID 2120 NPPM_GETPLUGINHOMEPATH 2121 NPPM_GETSETTINGSONCLOUDPATH 2122 NPPM_SETLINENUMBERWIDTHMODE 2123 NPPM_GETLINENUMBERWIDTHMODE 2124 NPPM_ADDTOOLBARICON_FORDARKMODE 2125 NPPM_DOCLISTDISABLEPATHCOLUMN 2126 NPPM_GETEXTERNALLEXERAUTOINDENTMODE 2127 NPPM_SETEXTERNALLEXERAUTOINDENTMODE 2128 NPPM_ISAUTOINDENTON 2129 NPPM_GETCURRENTMACROSTATUS 2130 NPPM_ISDARKMODEENABLED 2131 NPPM_GETDARKMODECOLORS 2132 NPPM_GETCURRENTCMDLINE 2133 NPPM_CREATELEXER 2134 NPPM_GETBOOKMARKID 2135 NPPM_ALLOCATEINDICATOR 2137 NPPM_GETFULLCURRENTPATH 4025 NPPM_GETCURRENTDIRECTORY 4026 NPPM_GETFILENAME 4027 NPPM_GETNAMEPART 4028 NPPM_GETEXTPART 4029 NPPM_GETCURRENTWORD 4030 NPPM_GETNPPDIRECTORY 4031 NPPM_GETCURRENTLINE 4032 NPPM_GETCURRENTCOLUMN 4033 NPPM_GETNPPFULLFILEPATH 4034 NPPM_GETFILENAMEATCURSOR 4035 NPPM_GETCURRENTLINESTR 4036 -
@PeterJones I totally overlooked the 0x0400 on the top, I looked at the table below and got confused :)
-
This is great! Thank you all for your comments and suggestions, and a special thanks goes to @Alan-Kilborn for providing the table.