Jump to content
Sign in to follow this  
nznet

Text Grab program

Recommended Posts

Hi John,

Sorry about that... should not have missed the array part. I have chnaged to the following:

#include <Array.au3>

Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

$hWnd = WinGetHandle("Notepad")

$Struct = DllStructCreate('wchar[1024]')

$text = DllCall("tgsdkx.dll","int","CaptureFromHWND","hwnd",$hwnd, "ptr", $struct)

If IsArray($text) Then

MsgBox(0, "Text", $text[0])

Else

MsgBox(0, "Error", @error)

EndIf

;_ArrayDisplay($text, "Text")

Func MyErrFunc()

Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _

"err.description is: " & @TAB & $oMyError.description & @CRLF & _

"err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _

"err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _

"err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _

"err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _

"err.source is: " & @TAB & $oMyError.source & @CRLF & _

"err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _

"err.helpcontext is: " & @TAB & $oMyError.helpcontext _

)

Endfunc

The error message that is returned is '0'.

Thanks,

Stephen

Share this post


Link to post
Share on other sites

Well if the @error is 0 (which means success) the return ($text) should be an array, and the

error message should never show, so that has me stumped.

But you are passing it a struct, instead of a pointer to a struct.

it could also mean that it simply is not possible to use it in that fashion.

in any case, look up DllStructGetData() function, and test it for a value.

or since this is a dll call

try

$Struct = DllStructCreate('str')

$StrPtr = DllStructGetPtr($Struct)

DllStructSetData($Struct,1)

$text = DllCall("tgsdkx.dll","int","CaptureFromHWND","hwnd",$hwnd,"ptr", $StrPtr )

Or

$Struct = DllStructCreate('str')

DllStructSetData($Struct,1,"")

$text = DllCall("tgsdkx.dll","int","CaptureFromHWND","hwnd",$hwnd,"struct", $Struct )

etc...

Try passing the struct ByRef

etc...

But my guess, is you simply cannot use dll in this fashion.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Hi Guys,

Sorry Richard... I did not respond to your posting the other week. Thanks for pitching in. And Thanks John for your Valent atempt to help.

However, is there any other suggestions anyone can give. If it means I need to go back to TextGrab to have them modify a dll to suit I am prepared to do this if I know what changes need to be made.

Kind Regards

Stephen

Edited by nznet

Share this post


Link to post
Share on other sites

Did you ever get the TextGrab library to work?? I am looking at it for a project I am working on.

Share this post


Link to post
Share on other sites

I have had a quick play with the last code from Stephen, and something is fundermentally wrong with either the code, mysetup or my myunderstanding because even if I feed the DllCall complete gibberish I get the exact same "0" result.

Share this post


Link to post
Share on other sites

If i wanted to do something like that, i would, 1. detect mouse click, 2. select everything. 3. Copy to clipboard.

Now this may be stupid, or out of context as i haven't bothered to read all posts, but it's just my 2 cents.


Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...