lee Posted September 7, 2005 Share Posted September 7, 2005 i am getting an error window displaying the message "Open Source error" during script execution. the line at which the error occurs is simply: Send("Y") the error is somewhat random -- sometimes it works, and sometimes it doesn't. i can't figure out any pattern to it. what could possibly be causing this? any way to work around it or figure out more about what the error is? all i'm trying to do is select an option from a dialog window. i've tried replacing the Send() with a MouseClick() command, but i still get the same error. Link to comment Share on other sites More sharing options...
theguy0000 Posted September 7, 2005 Share Posted September 7, 2005 (edited) give us your whole scriptedit: typo Edited September 7, 2005 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
lee Posted September 7, 2005 Author Share Posted September 7, 2005 give us your whole script expandcollapse popup; AutoIt script to scan pages to a .txt file dim $TRProProg, $TRWinTitle, $TRPropWinTitle, $TRSaveAsWinTitle dim $TRAutoWinTitle, $MaxPagesToScan, $PageKntr, $TRTransferringWinTitle dim $File, $SaveFileName dim $False, $True $False = 0 $True = 1 $TRProProg = "C:\TypeReader Pro 6.0\TR.exe" $TRWinTitle = "TypeReader" $TRAutoWinTitle = "Auto" $TRPropWinTitle = "Properties" $TRSaveAsWinTitle = "Save As" $MaxPagesToScan = 5 ; get name of output file if FileExists("scan.tmp") = $False then MsgBox(48,"Error","Could not locate scan control file!") exit endif $File = FileOpen("scan.tmp",0) $SaveFileName = FileReadLine($File) FileClose($File) FileDelete($SaveFileName) ; start typereader and wait for it to be active Run($TRProProg) if WinWaitActive($TRWinTitle,"",10) = $False then MsgBox(48,"Error","Could not start scanning program!") exit endif ; start autoscan and wait for auto window Send("{F5}") for $PageKntr = 1 to $MaxPagesToScan WinWaitActive($TRAutoWintitle,"",30) if WinActive($TRAutoWintitle) then if $PageKntr = $MaxPagesToScan then WinWaitActive($TRAutoWinTitle) Send("N") else WinWaitActive($TRAutoWinTitle) Send("Y") endif else MsgBox(48,"Error","Could not determine end of page scanned!") exit endif next ; wait for properties window if WinWaitActive($TRPropWinTitle,"",120) = $False then MsgBox(48,"Error","Could not determine end of scan!") exit endif ; close properties window and do file save Send("{ESC}") Send("!F") Send("A") if WinWaitActive($TRSaveAsWinTitle,"",10) = $False then MsgBox(48,"Error","File save failed!") exit endif Send($SaveFileName) Send("!S") ; end typereader WinClose($TRWinTitle) ; deal with save changes window if WinActive($TRWinTitle,"Save changes to") = $True then Send("N") endif Link to comment Share on other sites More sharing options...
jpm Posted September 7, 2005 Share Posted September 7, 2005 such message cannot come from AutoIt as this string is not in the source code of AutoIt. It should be the application you are sending to. :"> Link to comment Share on other sites More sharing options...
lee Posted September 7, 2005 Author Share Posted September 7, 2005 such message cannot come from AutoIt as this string is not in the source code of AutoIt. It should be the application you are sending to. :"><{POST_SNAPBACK}>that actually occurred to me -- although the title of the window with the error message is the name of the AutoIt script, which made me think the error must be coming from the script. maybe that's coincidence? i guess i could change the name of the script and see if the window title of the error message stays the same -- which would probably prove that the error is indeed coming from the application itself. Link to comment Share on other sites More sharing options...
lee Posted September 7, 2005 Author Share Posted September 7, 2005 sure enough the error message is coming from the application -- i had named the script "scan" and the error window title was "scan" which made me think it was the script. but i changed the name of the script and the error window was still "scan", so the culprit is indeed the application itself. which of course now begs the question of why an application would work correctly with physical key presses or mouse clicks, but fail when the keypress/mouse click was simulated via AutoIt. Link to comment Share on other sites More sharing options...
Valuater Posted September 7, 2005 Share Posted September 7, 2005 sure enough the error message is coming from the application -- i had named the script "scan" and the error window title was "scan" which made me think it was the script. but i changed the name of the script and the error window was still "scan", so the culprit is indeed the application itself.which of course now begs the question of why an application would work correctly with physical key presses or mouse clicks, but fail when the keypress/mouse click was simulated via AutoIt.<{POST_SNAPBACK}>maybe you could try compiling the script to an exe... then see if you recieve the same errorjust an idea8) Link to comment Share on other sites More sharing options...
lee Posted September 7, 2005 Author Share Posted September 7, 2005 maybe you could try compiling the script to an exe... then see if you recieve the same errorjust an idea8)<{POST_SNAPBACK}>thanks, but i already tried that -- didn't help. Link to comment Share on other sites More sharing options...
Josbe Posted September 7, 2005 Share Posted September 7, 2005 thanks, but i already tried that -- didn't help. <{POST_SNAPBACK}>Suggestion: Post a screenshot showing the error (msgbox). • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
lee Posted September 8, 2005 Author Share Posted September 8, 2005 Suggestion: Post a screenshot showing the error (msgbox).<{POST_SNAPBACK}>here it is: Link to comment Share on other sites More sharing options...
lee Posted September 8, 2005 Author Share Posted September 8, 2005 Also, use a MsgBox to show all of your variables just before the proposed error (an ancient method of debugging). Your variables may not hold the information you are hoping for...<{POST_SNAPBACK}>i'm not sure what value that is -- the command that generates the error is a simple SEND("Y"). no variables involved. the script is doing exactly what it's supposed to do -- it's just that when the "Y" is sent, the application program doesn't respond as it should. Link to comment Share on other sites More sharing options...
Josbe Posted September 8, 2005 Share Posted September 8, 2005 i'm not sure what value that is -- the command that generates the error is a simple SEND("Y"). no variables involved. the script is doing exactly what it's supposed to do -- it's just that when the "Y" is sent, the application program doesn't respond as it should.<{POST_SNAPBACK}>Could be from :$TRProProg = "C:\TypeReader Pro 6.0\TR.exe"Isn't a AutoIt error. AutoIt's error messages are like the screenshot(below). • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
/dev/null Posted September 8, 2005 Share Posted September 8, 2005 i am getting an error window displaying the message "Open Source error" during script execution. the line at which the error occurs is simply:"Open Source error", "sometimes it works, and sometimes it doesn't" ???Maybe I'm wrong, but could it be that your scanner/OCR Software has a technical problem which occurs only sometimes? Probably the error pops up only when you use the script, because your script sends the "Y" much faster after the pop-up window than you could ever do manually. Try to add a sleep(2000) before Send("N") and Send("Y"). Just an idea.....WinWaitActive($TRAutoWinTitle) sleep(2000) Send("N") else WinWaitActive($TRAutoWinTitle) sleep(2000) Send("Y")CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
lee Posted September 9, 2005 Author Share Posted September 9, 2005 Could be from :$TRProProg = "C:\TypeReader Pro 6.0\TR.exe"no, that part works fine -- otherwise the program wouldn't even launch.Isn't a AutoIt error. AutoIt's error messages are like the screenshot(below).yeah, i know --see post #6 in this thread. Link to comment Share on other sites More sharing options...
lee Posted September 9, 2005 Author Share Posted September 9, 2005 "Open Source error", "sometimes it works, and sometimes it doesn't" ???Maybe I'm wrong, but could it be that your scanner/OCR Software has a technical problem which occurs only sometimes? Probably the error pops up only when you use the script, because your script sends the "Y" much faster after the pop-up window than you could ever do manually. Try to add a sleep(2000) before Send("N") and Send("Y"). Just an idea.....<{POST_SNAPBACK}>that was one of my initial thoughts -- so i scattered SLEEP's throughout the code, even threw in some disk i/o for good measure. didn't help. Link to comment Share on other sites More sharing options...
lee Posted September 9, 2005 Author Share Posted September 9, 2005 thanks for all the suggestions here, but i've decided to drop back and punt on this one. the end user has been looking for an excuse to upgrade their scanner and their scanner software (which is rather ancient, which could be part of the problem) -- and so i've convinced them to go ahead and do that, rather than try to chase down what would appear to be a rather strange issue. hopefully i'll be able to automate the new software/scanner without any of these type problems....... if not, i'll be back. 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