freedomcaller Posted January 12, 2007 Share Posted January 12, 2007 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 Link to comment Share on other sites More sharing options...
Joon Posted January 12, 2007 Share Posted January 12, 2007 RunWait(@ComSpec & ' /c string.txt >> log.txt','',@SW_HIDE) Link to comment Share on other sites More sharing options...
BrettF Posted January 12, 2007 Share Posted January 12, 2007 Dose this help for the overwriteing of string.txt? FileOpen("string.txt",1) It opens it in write mode and appends to end of the file Hope that helps (a bit) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
freedomcaller Posted January 12, 2007 Author Share Posted January 12, 2007 ^^good idea but i was planing on makeing it write only sentances containing certian words (once i got it to write at all) Link to comment Share on other sites More sharing options...
freedomcaller Posted January 14, 2007 Author Share Posted January 14, 2007 ok neither of them worked (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) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 14, 2007 Moderators Share Posted January 14, 2007 ok neither of them worked (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. Link to comment Share on other sites More sharing options...
freedomcaller Posted January 14, 2007 Author Share Posted January 14, 2007 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 commandi just need auto it to read one text file and place the text elsewhare.. Link to comment Share on other sites More sharing options...
BrettF Posted January 14, 2007 Share Posted January 14, 2007 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 commandi just need auto it to read one text file and place the text elsewhare..So your trying paste $log into logs.txt? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
freedomcaller Posted January 14, 2007 Author Share Posted January 14, 2007 yep Link to comment Share on other sites More sharing options...
BrettF Posted January 14, 2007 Share Posted January 14, 2007 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. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
freedomcaller Posted January 14, 2007 Author Share Posted January 14, 2007 dident work it just writes more gibberish but if i open logs.txt on my own and press crtl+v it puts in the text just fine O.o Link to comment Share on other sites More sharing options...
BrettF Posted January 14, 2007 Share Posted January 14, 2007 (edited) dident work it just writes more gibberish but if i open logs.txt on my own and press crtl+v it puts in the text just fine O.ocould you give me examples of the files (String.txt, ascii string.tx...) It would help with the fixing problemEDIT: Forgot a word... Edited January 14, 2007 by bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
freedomcaller Posted January 14, 2007 Author Share Posted January 14, 2007 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 Link to comment Share on other sites More sharing options...
MHz Posted January 14, 2007 Share Posted January 14, 2007 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. Link to comment Share on other sites More sharing options...
freedomcaller Posted January 14, 2007 Author Share Posted January 14, 2007 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) Link to comment Share on other sites More sharing options...
MHz Posted January 14, 2007 Share Posted January 14, 2007 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 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 14, 2007 Moderators Share Posted January 14, 2007 How many names do these guys put out there... or is one of the a rip lol.http://www.deskperience.com/textcapture/index.htmlAnyway, 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. 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