PS:
quote:
Originally posted by whiz
quote:
Originally posted by SmokingCookie
That's weird..
Could you try:
JScript code:
var length = (Interop.Call("User32.dll","SendMessageW",Edit,WM_GETTEXTLENGTH,0,0) + 1);
var Buffer = Interop.Allocate((length + 1) * 2);
var lResult = Interop.Call("User32.dll","SendMessageW",Edit,WM_GETTEXT,length,Buffer.DataPtr);
// MessageBox is a class in my script; use your AlertDialog instead
//MessageBox.Show("Copied\t: " + lResult + "\nLength\t: " + length);
var Buffer = Interop.Allocate((length + 1) * 2);
should be
var Buffer = Interop.Allocate(length * 2);
since you already increased
length by one (to accomodate the null character).
As for the garbage collection, that is a very good practice indeed, but it isn't needed for scripting as Plus! already does the garbage collection for you.
Aka, code will run 'faster' if Plus! does it internally, compared to the need to parse, execute and handle yet another script line.
* CookieRevised slaps whiz around for swapping WM_GETTEXTLENGTH and WM_GETTEXT
... frustrating stuff I can imagine