Jump to content

Recommended Posts

Posted

im using a screen capute program to read text from a game (OCRSDK) and put it in string .txt

the problem is string .txt gets overwrited evrytime the text changes(im trying to get a log file of the text)

so i got it to read the text (and copy it to clipboard for good measure)

but when i try to to "filewrite" it gives me a bunch of squares croses and other usless junk (imo)

so how do i get it to put the text i the logs.txt :)

while 1
    sleep(2000)
    winwaitactive("SRO_Client")
     PixelSearch(550,130,725,145,0xffffff,8)
     If Not @error Then
         run ("OCRSDKcl.exe /capture 450 133 830 145 /ascii string.txt","",@SW_HIDE)
         FileOpen("string.txt",0)
         $log = FileRead("string.txt")
         FileOpen("logs.txt",1)
         ClipPut($log)
         
         [b][u]WTF DO I PUT HERE!???[/u][/b]
         
     EndIf 
  wend
Posted
Posted

:) ok neither of them worked :D (duno waht the 1st one even is but i put it by wtf do i put her and it dident work)

any other sugestions?

thare is no write command?????????

(i dont wanna have to run the text document and paste from clipboard)

  • Moderators
Posted

:) ok neither of them worked :D (duno waht the 1st one even is but i put it by wtf do i put her and it dident work)

any other sugestions?

thare is no write command?????????

(i dont wanna have to run the text document and paste from clipboard)

Want to share the OCRSDK so we can test to see what the issue is that you are having. All your doing now is chasing your tail, and having us follow suit.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

ocrskd is totaly irrelevnt imo but http://www.screenocr.com/ im using the command line version(skd)

its putting the text in string.txt just fine and autoit is reading it fine also (if i paste the stuff it coppied to clipboard on my own its the same as the text in string.txt) the problem comes up when i try to put it into logs.txt using writefile command

i just need auto it to read one text file and place the text elsewhare..

Posted

ocrskd is totaly irrelevnt imo but http://www.screenocr.com/ im using the command line version(skd)

its putting the text in string.txt just fine and autoit is reading it fine also (if i paste the stuff it coppied to clipboard on my own its the same as the text in string.txt) the problem comes up when i try to put it into logs.txt using writefile command

i just need auto it to read one text file and place the text elsewhare..

So your trying paste $log into logs.txt?

Posted

Try this:

The basic write part worked for me.

while 1
    sleep(2000)
    winwaitactive("SRO_Client")
     PixelSearch(550,130,725,145,0xffffff,8)
     If Not @error Then
         run ("OCRSDKcl.exe /capture 450 133 830 145 /ascii string.txt","",@SW_HIDE)
         FileOpen("string.txt",0)
         $log = FileRead("string.txt") 
         ClipPut($log)
         FileOpen("logs.txt",1)
         FileWrite ("logs.txt",  ClipGet ())
         
     EndIf 
wend

Just make sure the files' paths a specified.

Posted (edited)

:) dident work it just writes more gibberish :D

but if i open logs.txt on my own and press crtl+v it puts in the text just fine O.o

could you give me examples of the files (String.txt, ascii string.tx...) It would help with the fixing problem

EDIT: Forgot a word...

Edited by bert
Posted

string.txt = "- ` I wil- ake 1 seconds o close he game - - Ä" (the ocrsdk dosent capute perfect but its good enough for me)

logs.txt = " ⸭⁉⸠⁉ൠ弊慃湮攠畱灩戠捥畡敳漠⸠楤ⴠⴭ湥敳⹸⃄쐠张਍⃄䌭湡潮煥極⁰"

^^i never noticed the chinese bfore in notepad (by me) its just squares and crosses i probably dident have the language pack installed or s/t

Posted

If you use FileOpen, then you need to store the handle that is returned and use that with FileRead or FileWrite. When finished with the handle then use FileClose on the handle.

:)

Posted

0o whare is the handel returned to??/ how do i get/know my handle??

in other words wtf is a handle!

:)

(i see fileclose requires a handle and fileopen read and write gives you a choice)

Posted

The handle is returned from the FileOpen function and is a reference to the opened file. The handle can be stored inside a variable and the file will remain open until FileClose is used on the handle to close it.

Simple example of using a handle

$handle = FileOpen('path/to/file.ext', 0)
If $handle <> -1 Then
    FileRead($handle)
    FileClose($handle)
EndIf

:)

  • Moderators
Posted

How many names do these guys put out there... or is one of the a rip lol.

http://www.deskperience.com/textcapture/index.html

Anyway, we had done some work on the above here (is why I asked for the link to the download, that was the relevance).

http://www.autoitscript.com/forum/index.php?showtopic=30760

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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
×
×
  • Create New...