Norway Posted October 22, 2005 Share Posted October 22, 2005 Hi, I've tried searching the forum - but can't seem to find any solutions. Perhaps I am not looking for the correct keywords. Anyway. What I have is a script that now has passed 1600 lines. The script calls other functions/programs - but when I enter high load situations the strings I pass to the programs seem to loose "shift "- an example : I am sending " and the program receives 2, I send : and the program recieves . This only happends randomly, but seems to be in cases where the CPU load is high. I have also detected that I have a problem when I for instance use a Open dialogue on one of the programs I call, and I suspect the program being busy displaying 5000+ files in the open dialogue at the same time as I pass one of the filenames to the open dialogue and press the "open" button. Is there any way to wait until a process is completed (an open file process) in order to avoid the problems I am experiencing? What is the optimal way of sending text strings to dialog boxes? Obviously my script is designed to run for 24+ hours and as such I am interested in learning how to optimize the script - any ideas where I can find a list of suggested methods? Thanks for any help I can get. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 22, 2005 Share Posted October 22, 2005 maybe you should post your script so people can look at it but for your first problem just look through your script to see if you maybe have something like this in it: {shiftdown} my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Norway Posted October 22, 2005 Author Share Posted October 22, 2005 Here is a segment of the code in which I am experiencing the problems. I'm using variables for all text strings in order to have all the routines generic. The problem occurs when I have the open or save dialogs open (and when I have several 1000 files in the directories opened. Hope this is enough to give a pointer opt("SendKeyDelay", 1) If $Nospaceinpath = $SET Then ;ControlSend($open_string, "", "Edit1", $file & "{ENTER}") ControlSetText($open_string, "", "Edit1", $file) ControlClick($open_string, "", "Button2") winwaitclose($open_string,"",2) if winexists($open_string) Then Do ControlSetText($open_string, "", "Edit1", $file) ControlClick($open_string, "", "Button2") until winexists($open_string) = 0 EndIf Else ;ControlSend ($open_string, "", "Edit1", '"' & $file & '"' & "{ENTER}") ControlSetText($open_string, "", "Edit1", '"' & $file & '"') ControlClick($open_string, "", "Button2") winwaitclose($open_string,"",2) if winexists($open_string) Then Do ControlSetText($open_string, "", "Edit1", '"' & $file & '"') ControlClick($open_string, "", "Button2") until winexists($open_string) = 0 EndIf EndIf WinWaitActive("WSD - " & $file) ;AdlibDisable() WinMenuSelectItem("WSD", "", "&File", "&Save") WinWait($save_string) $file2 = StringTrimRight($file, 3) & "mmf" If FileExists($SMAF_source & $file2) Then FileDelete($SMAF_source & $file2) EndIf If $Nospaceinpath = $SET Then ;ControlSend($save_string, "", "Edit1", $file2 & "{ENTER}") ControlSetText($save_string, "", "Edit1", $file2) ControlClick($save_string, "", "Button2") winwaitclose($save_string,"",2) if winexists($save_string) Then Do ControlSetText($save_string, "", "Edit1", $file2) ControlClick($save_string, "", "Button2") until winexists($save_string) = 0 EndIf Else ControlSetText($save_string, "", "Edit1", '"' & $file2 & '"') ControlClick($save_string, "", "Button2") winwaitclose($save_string,"",2) if winexists($save_string) Then Do ControlSetText($save_string, "", "Edit1", '"' & $file2 & '"') ControlClick($save_string, "", "Button2") until winexists($save_string) = 0 EndIf EndIf Link to comment Share on other sites More sharing options...
LxP Posted October 23, 2005 Share Posted October 23, 2005 Welcome to the forums!Since you're using ControlSetText() I don't understand why you're receiving such odd behaviour. You might like to try this code and see if it works any better for you:Opt('SendKeyDelay', 1) Local $DesiredEditData, $ActualEditData ; Set the Edit field to the file path $DesiredEditData = '"' & $File & '"' Do ControlSetText($Open_String, '', 'Edit1', $DesiredEditData) $ActualEditData = ControlGetText($Open_String, '', 'Edit1') If $ActualEditData <> $DesiredEditData Then Sleep(100) Until $ActualEditData = $DesiredEditData ; Click the button and wait for control to return to the main window ControlClick($Open_String, '', 'Button2') WinWaitClose($Open_String) WinWaitActive('WSD - ' & $File) ; Determine the new location and delete any existing file $File2 = StringTrimRight($File, 3) & 'mmf' FileDelete($SMAF_Source & $File2) ; Perform the save WinMenuSelectItem('WSD - ', '', '&File', '&Save') WinWait($Save_String) $DesiredEditData = '"' & $File2 & '"' Do ControlSetText($Save_String, '', 'Edit1', $DesiredEditData) $ActualEditData = ControlGetText($Save_String, '', 'Edit1') If $ActualEditData <> $DesiredEditData Then Sleep(100) Until $ActualEditData = $DesiredEditData ControlClick($Save_string, '', 'Button2') WinWaitClose($Save_String) Link to comment Share on other sites More sharing options...
GaryFrost Posted October 23, 2005 Share Posted October 23, 2005 My question would be is the text being sent to another autoit script? if so there are limitations to the amount of data that the control can hold. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Norway Posted October 23, 2005 Author Share Posted October 23, 2005 Hi thank you both. LXP: I used controlsend when I experienced the fault.Controlsendtext is the code which I am currently running tests on -I'll know if there are any problems with the script on monday. As it is -it is now runnning tests on 5 computers in parallell - but adding a error trapping routine is a good idea. I'll try the proposed code - thanks. gafrost: It is an external program that is called and it is the open/save dialog that I am experiencing the problem with. The odd thing is that it works perfectly on my own machine when I test on 10-20 files- but it fails when I run on other machines and when I run it on several thousand files -on one computer it failed with the file number 500+ and on another 1500+. The entire thing is puzzling - because I got the problem when I sent the string with both control signs and without - I even tried sending ascii code - but still got the same problem. I've experienced this problem when interfacing with other external programs as well - and it would be good to figure out the cause and workaround to this problem. Thanks for all your feedback so far. 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