Raik Posted May 6, 2015 Share Posted May 6, 2015 I want to comunicate with the Scintilla-Control in Notepad++.The GUICtrl* Functions ar related only to AutoIt-Gui's, not to external Program-Windows.ControlCommand() does not provide enought parameters (like various dll-calls, lparam, wparam, ...).David Barrett once had suggested such a Function:http://permalink.gmane.org/gmane.comp.windows.autoit.user/17713Is this possible, or forbidden for security-reasons or impossible by design? AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
Developers Jos Posted May 6, 2015 Developers Share Posted May 6, 2015 Have you checked out the other Controlxxxxx commands in the AutoIt3 Helpfile?Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Raik Posted May 7, 2015 Author Share Posted May 7, 2015 (edited) I want to build a helpertool for notepad++, to interact with, while possibly the computer is used too for other activities, so it is a bad idea (i think), to send keystrokes or use the clipboard. Thats why i want to use controlmessages.At my first atempt notepad++ crashes, now ihave something, particular working, but i get no data back:Global $NPPhwnd, $NPPselected Global CONST $SCI_GETSELTEXT = 2161 $NPPhwnd = WinGetHandle("[Active;CLASS:Notepad++]") Local $ScintillaClassNameNN = ControlGetFocus($NPPhwnd) Local $ScintillaHwnd = ControlGetHandle($NPPhwnd,"",$ScintillaClassNameNN) ConsoleWrite(SCI_GETSELTEXT($ScintillaHwnd)) Func SCI_GETSELTEXT($Sci) Local $iLen, $sBuf, $ret, $sText $iLen = DllCall("user32.dll", "long", "SendMessageW", "long", $Sci, "int", $SCI_GETSELTEXT, "int", 0, "int", 0) If @error Then Return -1 $sBuf = DllStructCreate("char[" & $iLen[0] & "]") If @error Then Return -2 ;DllStructSetData($sBuf, 1, "abcdefghijklmnopqrstuvwxyz") $ret = DllCall("user32.dll", "long", "SendMessageW", "long", $Sci, "int", $SCI_GETSELTEXT, "int", 0, "ptr", DllStructGetPtr($sBuf)) If @error Then Return -3 $sText = DllStructGetData($sBuf, 1) $sBuf = 0 If @error Then Return -4 Return $sText EndFuncRun it from nppExec after selecting some text:"Path_to_AutoIt\AutoIt3.exe" /ErrorStdout "$(FULL_CURRENT_PATH)"Returnvalue ($sText) is empty, should contain the selected text. Edited May 8, 2015 by Raik AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
Raik Posted May 8, 2015 Author Share Posted May 8, 2015 (edited) It seems that some Scintilla-Messages do work only within the same Process, especially the ones, witch use structs. Any idea about this?PS:Maybe i have to use WM_COPYDATA like this: https://autoit.de/index.php/Thread/6438-WinAPI-PostMessage-string/?postID=47622#post47622 ? Edited May 9, 2015 by Raik AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
Raik Posted June 3, 2015 Author Share Posted June 3, 2015 Just for the Record:_WinAPI_OpenProcess_MemVirtualAllocEx_WinAPI_ReadProcessMemory / _WinAPI_WriteProcessMemory_MemVirtualFreeExand _WinAPI_CloseProcessdo the trick. AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now