erebus Posted June 27, 2005 Share Posted June 27, 2005 I searched the forum a bit but with no luck.. Here is my code: Func DisplayBanners() ; Search for the JPG banners $search = FileFindFirstFile($path & "*." & $type) ; Check if the search was successful If $search = -1 Then MsgBox(16, $app & " " & $ver, "No " & $type & " files were found in " & $path & ". " & $app & " cannot proceed.") Terminate() EndIf ; Start displaying banners While 1 $file = FileFindNextFile($search) If $file = "." Or $file = ".." Then ContinueLoop If @error Then FileClose($search) DisplayBanners() EndIf SplashImageOn($app & " " & $ver, $file, 160, 600, @DesktopWidth-165, @DesktopHeight-635, 3) If $fade>0 And $fade<255 Then WinSetTrans($app & " " & $ver, "", $fade) If @error Then MsgBox(16, $app & " " & $ver, "Transparency isn't supported by your OS. Please use the value '255' in the configurarion file. " & @LF & $app & " cannot proceed.") Terminate() EndIf EndIf Sleep($delay) WEnd EndFunc You see this "Sleep" function at the end of the code so as to allow the program delay before every SplashImageOn. The problem is that my program runs fine but after some time (more than an hour for sure) it produces the following error: Line 0 (File "blah blah") Sleep($delay) Error: Recursion level has been exceeded - AutoIt will quit to prevent stack overflow. Maybe I have missed something here, but I can't figure out what is it... Thank you. Link to comment Share on other sites More sharing options...
jpm Posted June 27, 2005 Share Posted June 27, 2005 You are in the recursion game. DisplayBanners is calling DisplayBanners. The logic inside DisplayBanners must have a way to return. In your case there is nothing so the recursion will occurs and you will reach the recursion maximum limit which produce the error. Link to comment Share on other sites More sharing options...
erebus Posted June 27, 2005 Author Share Posted June 27, 2005 I can see your point. However that is why I wrote this part of the code as a function, so as to call it again when I have no more files to display. I used to have another similar problem yesterday with "invalid type handlers" which was solved by adding a FileClose($search) where it should be. My question now (since I can't see how to solve this): Can I avoid this recursion somehow? The only thing I want is when I have no more files to read to run the function again so to start over. So probably the problem resides here: If @error Then FileClose($search) DisplayBanners() EndIf Any ideas? Link to comment Share on other sites More sharing options...
w0uter Posted June 27, 2005 Share Posted June 27, 2005 giant while loop of witch you start again at @error ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
erebus Posted June 27, 2005 Author Share Posted June 27, 2005 (edited) Ok it seems that it works fine now. Just added this in my code: While 1 DisplayBanners() WEnd So as to call it forever. Thanks for your answers guys, helped me a lot. Edited June 27, 2005 by erebus Link to comment Share on other sites More sharing options...
/dev/null Posted June 27, 2005 Share Posted June 27, 2005 However that is why I wrote this part of the code as a function, so as to call it again when I have no more files to display.Use this.expandcollapse popupwhile 1 DisplayBanners("C:\pics\", "jpg") wend Func DisplayBanners($path, $type) ; Search for the JPG banners $search = FileFindFirstFile($path & "*." & $type) ; Check if the search was successful If $search = -1 Then MsgBox(16, $app & " " & $ver, "No " & $type & " files were found in " & $path & ". " & $app & " cannot proceed.") Terminate() EndIf ; Start displaying banners While 1 $file = FileFindNextFile($search) If $file = "." Or $file = ".." Then ContinueLoop If @error Then FileClose($search) exitloop EndIf SplashImageOn($app & " " & $ver, $file, 160, 600, @DesktopWidth-165, @DesktopHeight-635, 3) If $fade>0 And $fade<255 Then WinSetTrans($app & " " & $ver, "", $fade) If @error Then MsgBox(16, $app & " " & $ver, "Transparency isn't supported by your OS. Please use the value '255' in the configurarion file. " & @LF & $app & " cannot proceed.") Terminate() EndIf EndIf Sleep($delay) WEnd EndFuncCheersKurt __________________________________________________________(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...
erebus Posted June 27, 2005 Author Share Posted June 27, 2005 Haha, exactly what I thought right now! Thank you very much /dev/null, I really appreciate it. Link to comment Share on other sites More sharing options...
/dev/null Posted June 27, 2005 Share Posted June 27, 2005 Haha, exactly what I thought right now!Thank you very much /dev/null, I really appreciate it. <{POST_SNAPBACK}>well, you have been faster 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...
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