
CyberGlitch
Active Members-
Posts
64 -
Joined
-
Last visited
Everything posted by CyberGlitch
-
Here is a function I created and am using. $ocr = _rectOCR("notepad",0,0,200,200) MsgBox(0,"OCR", $ocr) Func _rectOCR($wTitle, $rX, $rY, $rWidth, $rHeight) $xy = WinGetPos($wTitle) $Title = WinGetTitle($wTitle) $hwnd = Dec(StringTrimLeft(WinGetHandle($Title), 2)) $obj = ObjCreate("TCaptureX.TextCaptureX") $results = $obj.GetTextFromRect($hwnd, $xy[0]+$rX, $xy[1]+$rY, $rWidth, $rHeight) return $results EndFunc
-
Success! Thank you so much. $Title = WinGetTitle('TextPad') $hwnd = Dec(StringTrimLeft(WinGetHandle($Title), 2)) $oShell = ObjCreate("TCaptureX.TextCaptureX") $res = $oShell.GetTextFromRect($hwnd, 100, 100, 200, 200) MsgBox(0, $hwnd, $res)
-
Ok, inside autoit how would I convert b093c to be 723260? b093c is the handle of the window. Looking at the C# source code that I can understand it converts the b093c to 723260. //txtHandle.Text = b093c int hWndTarget = System.Convert.ToInt32(txtHandle.Text, 16); If I plug 723260 directly into autoit it works great! Just need to get that number automatically inside autoit now.
-
Ok, figured the hard part out. Now to figured out the handle part for windows. ;autoit hand returns 0x000B093C $hnd = 723260 $oShell = ObjCreate("TCaptureX.TextCaptureX") $res = $oShell.GetTextFromRect(hnd, 0, 0, 200, 200) Now how do I convert the window handles autoit gives to the type I need. I'm guesing it's a hex conversion?! :">
-
Almost got it working. Took a step back to work with the simplest function in the dll and I've got that working with objects. $oShell = ObjCreate("TCaptureX.TextCaptureX") $res = $oShell.CaptureActiveWindow MsgBox(0,0,$res)
-
Would you be so kind to post the source code here for download?
-
sorry, I ment I have the autoit script in the same dir as the dll and yes I changed the code to reflect that. I'm pretty sure you have full access to the whole API with the trial version.
-
Yep, change it to the same dir as the autoit script.
-
Valiant effort but no dice. At least it doesn't crash, just returns 0. Would I have to create an Object to use it similar to the VB code? Don't see any examples in the help for creating an object against a dll and have never used this feature in AutoIt.
-
VB Code for using rect. Reference=*\G{92657C70-D31B-4930-9014-379E3F6FB91A}#1.0#0#..\..\..\..\Program Files\Deskperience\Text Capture\TCaptureX.dll#TCaptureX 1.0 Type Library Public Sub CaptureRectangle() On Error GoTo Err Dim objCapture As New TextCaptureX Dim hwnd As Long Dim str As String Dim res As String str = "&H" & txtHandle.Text hwnd = Val(str) txtResult.Text = objCapture.GetTextFromRect(hwnd, CLng(txtX.Text), CLng(txtY.Text), CLng(txtWidth.Text), CLng(txtHeight.Text)) Exit Sub Err: ShowMessageNotRegistered End Sub
-
They only provide source code examples for C++, C# and VB.
-
Deskperience has a very nice OCR DLL that is relatively cheap, $40. They have source code to show how to use it in several languages. Normally I could load PE Explorer, look at the exports and easily figure out the right DLLCall format in AutoIt through trial and error. I can't for the life of my figure out this DLL because the exports are strange, I imaging it has to do with the licensing and such. C++ Source using the DLL. This is inside a function to get OCR text from a given rect on a certain window by handle. ITextCaptureXPtr pCaptureObj = NULL; HRESULT hr = pCaptureObj.CreateInstance(__uuidof(TextCaptureX)); if(FAILED(hr)) { ShowErrorMessage(); return; } long hWndTarget = GetValueFromHexCode(m_strHandle); _bstr_t bstrResult; try { bstrResult = pCaptureObj->GetTextFromRect(hWndTarget, m_nX, m_nY, m_nWidth, m_nHeight); } catch(...) There are several DLLs in the package and I assume they all talk to each other with registration and licensing information. In the C++ code I only see a reference to TextCaptureX and no other DLLs. TCaptureX.dll - Exports. DllCanUnloadNow DllGetClassObject DllRegisterServer DllUnregisterServer _PathFindExtensionW@4 TCapture.dll looks to be the one that does the magic though. Here is the export that looks to handle the rect function. ?GetTextFromRect@@YAPAGPAUHWND__@@UtagRECT@@PAUtagLOGFONTW@@PAK3PAPAG@Z Undecorated C++ Function: unsigned short * __cdecl GetTextFromRect(struct HWND__ *,struct tagRECT,struct tagLOGFONTW *,unsigned long *,unsigned long *,unsigned short * *) I only know enough C++ to get myself in trouble so I'm at a loss. Hope one of the big brains around here and descramble this all for me. They have a trial of the DLL on their website if anyone wants to take a stab at it. http://www.deskperience.com/textcapture/index.html
-
Gotcha, thanks again!
-
Thanks for the links. It seems your radar isn't working from the source. The function DllStructDelete can't be found anywhere and it's not in any of the includes. I'm using the latest beta.
-
I haven't messed with the AutoIt GUI functions much, however everything else I'm very familar with. If someone could push me in the right direction, please. I want to create a GUI to help me with another project I'm working on. What I want it to be able to do to begin with is display an image. The image will be of an active window that was previously captured using Lazycats dll. I want to be able to draw a rect on that image, inside the gui only, and then have autoit spit out what the relative coordinates are for the rect. So if I draw on the image starting at the top left and create a 10x10 box it would spit out 0,0,10,10. I would like it to display and keep the rect on the screen with options to possably save the values to an ini with a name. Would be great if it could keep many rects displayed on the screen and manipulate them when needed from the GUI. My thoughts are having a listview on the left with keys from an INI, rect1, rect2, rec3 etc. These rects would be drawn on the current image being displayed, in the gui only. Ability to move the rects around and save the new values over the old ones. I'm by no means asking anyone to do this for me. Unless you're bored and want to of course. Just never created a GUI and I think this would be a good starting point for me to learn from.
-
Hmm.. That's odd. That image is a small list of what I have to search through. Most of them are all scrambled though with different sets of numbers. That's a sample that I picked for testing that has a bunch of 10/20 grouped together. What I have to do is go down the list looking for specific set of numbers and once one is found run the rest of my script. It has to be fast though as well. I'll play with it some more though.
-
Also, I have used your combo of PixelSearch and PixelCheckSum for other projects at work. The problem with that is if you have to search the whole desktop then it can take upwards of 20 seconds till it finds a match. I've played around with AHK ImageSearch and it's less then a second no mater where I move the image to be found on the screen, even at 1600x1200 resolution.
-
Here is one I put together at home that shows 2 errors. If you can explain it then great. Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client WinActivate("checksum.bmp - Paint") Sleep(500) For $y = 69 to 251 STEP 13 MouseMove(65,$y) $checksum = PixelChecksum(65,$y, 133, $y+11) $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file, $checksum & @CRLF) FileClose($file) Next Exit Returns 2249230982 2347134656 2249230982 2347134656 2249230982 2347134656 1274841446 2347134656 2249230982 2347134656 2249230982 2347134656 93483183 117568781 2558851038 checksum.bmp
-
I'll try to find an image I used to test PixelCheckSum and send it to you. It was one I was playing with for fun. It was the same exact text all the way down the only difference was alternating background colors, only 2. So One would assume you would only have 2 different checksums, 1 for each background seeing as the foreground color and text where the same. I told autoit to go line by line, 14 pixels high, and write the checksums to a text file. Looking through it there was a few similarities but also some anomalies as well. Why this happened I don't know. I've gotta go to the office tomorrow, if I can find the image I'll post it and let you take a look at it. Excuse me if I'm rambling, it's Saturday and I've have a few glasses of Vodka already.
-
The problem with that though is I've had many checksums be the same but the images are completely different. If we had an ImageSearch function then it would only match on the exact image. Don't get me wrong if there was a way to hash the image into a variable and use that for searches, like PixelChecksum, it would be so much better, if it was 100% accurate. I just never had good results with PixelChecksum and it being a 100% match, more around 60%. Also the fact that searching the whole desktop can be slow doesn't help either.
-
Yea, I couldn't find any rhyme or reason to the errors. I image that DLL was somebody's project and was never really finished, hence the errors. I don't have all my scripts here at home to test otherwise I'd post what the DLL error was. My last resort is going to just code a UDF with AHK and call that with autoit to return back the variables I need. That single function is the only one that I like in AHK and have use for.
-
I posted about this in the Scripts and Scraps forum a few weeks ago. http://www.autoitscript.com/forum/index.ph...topic=21629&hl= The DLL works most of the time but every so often with the same exact code it'll just throw an error.
-
Can we get a function similar to AHKs ImageSearch feature. I know we have PixelCheckSum and others but those don't always work. I've also been playing with a DLL I found mentioned on here before and it crashes sometimes for unknow reasons. Don't know where the DLL came from or anything so looking for another solution and this looks perfect but my beloved AutoIt doesn't handle it. AHK ImageSearch is fast and finds a saved image on the current screen and returns the X,Y cords. http://www.autohotkey.com/docs/commands/ImageSearch.htm I see this was discussed before but not much came of it.
-
Client / Server Comunication
CyberGlitch replied to CyberGlitch's topic in AutoIt General Help and Support
I must have an old help file then. That example works great, the one on the help file is different and doesn't work. -
Client / Server Comunication
CyberGlitch replied to CyberGlitch's topic in AutoIt General Help and Support
The 2 examples in the help file wouldn't work using the latest beta.