Marspidey Posted July 12, 2007 Share Posted July 12, 2007 I've have put some while loops ito my script but they aren't working. I have a few of them below. All the path names are correct. Am I missing a library or is it a computer configuration problem? Any help is appreciated. Thanks. While WinExists( "Moving...");Wait ;MsgBox(0, "Busy", "Loop");Test WEnd Doesn't wait for the moving window to close and moves to next step $wait = -1 While $wait = -1 ControlFocus("C:\_Flash Video\CompletedSource", "", "SysListView321") $wait = ControlListView("C:\_Flash Video\CompletedSource", "", "SysListView321", "FindItem", $shortfilename & $ext) WEnd Doesn't check for video file and moves to next step Link to comment Share on other sites More sharing options...
martin Posted July 12, 2007 Share Posted July 12, 2007 I've have put some while loops ito my script but they aren't working. I have a few of them below. All the path names are correct. Am I missing a library or is it a computer configuration problem? Any help is appreciated. Thanks. While WinExists( "Moving...");Wait ;MsgBox(0, "Busy", "Loop");Test WEnd Doesn't wait for the moving window to close and moves to next step $wait = -1 While $wait = -1 ControlFocus("C:\_Flash Video\CompletedSource", "", "SysListView321") $wait = ControlListView("C:\_Flash Video\CompletedSource", "", "SysListView321", "FindItem", $shortfilename & $ext) WEnd Doesn't check for video file and moves to next step Most likely problem is that there is no window with a title "Moving...", and that ControlListView finds the string and so doesn't return -1. Since you have not included the whole of your code these are my best guesses. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Marspidey Posted July 12, 2007 Author Share Posted July 12, 2007 Most likely problem is that there is no window with a title "Moving...", and that ControlListView finds the string and so doesn't return -1.Since you have not included the whole of your code these are my best guesses.For the moving loop the "Moving..." window does appear but the script just keeps moving along. As for the ControlListView it shouldn't find a string until the video file is added to that folder and therefore $wait should remain -1 unless I'm wrong. Link to comment Share on other sites More sharing options...
Supercross Posted July 12, 2007 Share Posted July 12, 2007 I personally would do something like this: while 1 If NOT WinExists("Moving...") Then ExitLoop wend It never hurts to put in msgboxes to debug your code. To double check what is happening when you call a function, just msgbox its return value and confirm with the help file. Like this: (using your code) $wait = -1 While $wait = -1 ControlFocus("C:\_Flash Video\CompletedSource", "", "SysListView321") $wait = ControlListView("C:\_Flash Video\CompletedSource", "", "SysListView321", "FindItem", $shortfilename & $ext) msgbox(0,"",$wait) WEnd Link to comment Share on other sites More sharing options...
Marspidey Posted July 12, 2007 Author Share Posted July 12, 2007 I personally would do something like this: while 1 If NOT WinExists("Moving...") Then ExitLoop wend It never hurts to put in msgboxes to debug your code. To double check what is happening when you call a function, just msgbox its return value and confirm with the help file. Like this: (using your code) $wait = -1 While $wait = -1 ControlFocus("C:\_Flash Video\CompletedSource", "", "SysListView321") $wait = ControlListView("C:\_Flash Video\CompletedSource", "", "SysListView321", "FindItem", $shortfilename & $ext) msgbox(0,"",$wait) WEnd Thanks for the help guys. Your suggestions got me thinkng in a new direction. It seems to be working for now but if I have another problem with the While statements I'll repost here. Thanks again. Link to comment Share on other sites More sharing options...
Marspidey Posted July 13, 2007 Author Share Posted July 13, 2007 Ok, below is what I added to the while loop. I have this same exact process on another computer. When this script is working correctly it is suppose to check the CompletedSource folder every ten secs for the video file and then move on to the next stage without any human contact. What it does on this computer is when it hits the 5th line of the code it reads it as "0" even though the file isn't there. Am I using "FindItem" incorrectly? Or is there a better way to find a video file than the way I'm doing now? While $wait = -1;Check for video file to be move to completed source ;MsgBox(0, "Code Status", $wait);User prompt to wait until squeeze jobs are complete ---- Here it returns "-1" and waits for user to press "Ok" ;Sleep ( 10000 );Pauses for 10 secs ControlFocus("C:\_Flash Video\CompletedSource", "", "SysListView321") $wait = ControlListView("C:\_Flash Video\CompletedSource", "", "SysListView321", "FindItem", $shortfilename & $ext);Check for completed video file MsgBox( 0 , "Code Status", $wait); Here it returns "0" and wait for user to press "Ok" WEnd Link to comment Share on other sites More sharing options...
Marspidey Posted July 13, 2007 Author Share Posted July 13, 2007 Anyone have any suggestions? 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