Maroney Posted May 8, 2009 Posted May 8, 2009 Hi Folks, Hope you can help. I'm working on a script to take pictures, send them to the web, and generate a series of images to use as a time lapse movie. Everything works fine, till I include this code to create the "series" of images in a folder for the time lapse movie The error I get is "While" statement has no matching "Wend" statement. This loop works fine till I include the func. statement. I found this "Custom" function statement here in this forum, and want to give thanks to weaponx. Thanks in advance, I appreciate your help. ;begin taking pictures,take 1 pic each 10min for 10 hours = 60 pics ; camin is the directory where pics are captured ; cammovie is the folder for the time lapse movie ; camout is the folder i use for FTP to the web. $i = 1 While $i <=60 ; next line fires the shutter Send ("{SPACE}") Sleep (5000) _IncrementalFileCopy("c:\vws\camin\*.jpg", "c:\vws\cammovie\image.jpg") Func _IncrementalFileCopy($Source, $Destination) $count = 0 Do ;Split destination into file / extension $pathArray = StringSplit ( $Destination, ".") ;If more than one period in destination filename, return error if $pathArray[0] > 2 then return 3 $newDestination = $pathArray[1] & $count & "." & $pathArray[2] $count += 1 Until FileExists($newDestination) = 0 ;Copy file without overwrite just to be safe FileCopy ( $Source, $newDestination, 8) Return @error EndFunc ; move image for FTP FileMove ("c:\vws\camin\*.jpg", "c:\vws\camout\image.jpg", 1) Sleep (595000) $i = $i + 1 WEnd
will88 Posted May 8, 2009 Posted May 8, 2009 You have your function inside of the while loop $i = 1 While $i <=60 ; next line fires the shutter Send ("{SPACE}") Sleep (5000) _IncrementalFileCopy("c:\vws\camin\*.jpg", "c:\vws\cammovie\image.jpg") FileMove ("c:\vws\camin\*.jpg", "c:\vws\camout\image.jpg", 1) Sleep (595000) $i = $i + 1 WEnd Func _IncrementalFileCopy($Source, $Destination) $count = 0 Do $pathArray = StringSplit ( $Destination, ".") if $pathArray[0] > 2 Then Return 3 $newDestination = $pathArray[1] & $count & "." & $pathArray[2] $count += 1 Until FileExists($newDestination) = 0 FileCopy ( $Source, $newDestination, 8) Return @error EndFunc Password-Keeper
Maroney Posted May 8, 2009 Author Posted May 8, 2009 Will, Thanks! Guess I have a lot to learn. Any suggestions on how or where? I thought the function had to be executed within the loop. Thanks again, I look forward to trying it. paul
Richard Robertson Posted May 8, 2009 Posted May 8, 2009 You execute the function in a loop, yes. You have to write the function code elsewhere.
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