CYCho Posted December 1, 2024 Posted December 1, 2024 I know the exact line of script which causes the script to freeze. In my zPlayer, I use mciSendString commands to "open" and "play" a media file. It works perfectly most of the time. But one of my video files seems to have some problem. Once in a while it would not play and the script is stuck on the line of "play" command without returning any result or error and not moving to the next line of script. I know that the file was opened with no error at all. I could simply throw that file away. As a programmer, however, I would like to handle that situation as an error. I hope I can detect the freeze from within the script. Please help me resolve this situation. zPlayer - A Small Audio and Video Player
Werty Posted December 1, 2024 Posted December 1, 2024 (edited) Maybe... _WinAPI_IsHungAppWindow() https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_IsHungAppWindow.htm /edit i may have been in a bit of a hurry there, guess i misunderstood you, i should have read the whole post and not just the topic. 😛 Edited December 1, 2024 by Werty CYCho 1 Some guy's script + some other guy's script = my script!
argumentum Posted December 1, 2024 Posted December 1, 2024 use #include <Timers.au3> _Timer_SetTimer ( $hWnd [, $iElapse = 250 [, $sTimerFunc = "" [, $iTimerID = -1]]] ) or if that does not do it, do some IPC from a watcher script that will handle the frozen one, because if is frozen, how are you gonna unfreeze it ? CYCho 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted December 1, 2024 Posted December 1, 2024 But the first and main issue here is HOW will you programmatically know that the script is frozen ? CYCho 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
CYCho Posted December 1, 2024 Author Posted December 1, 2024 2 hours ago, argumentum said: do some IPC from a watcher script that will handle the frozen one, because if is frozen, how are you gonna unfreeze it ? 2 hours ago, Nine said: But the first and main issue here is HOW will you programmatically know that the script is frozen ? If you two gurus say so, I believe it. The simplest way I can think of is as follows: In the main program, just before "play" command: 1. Write a small temp file containing its PID and the media title which failed to play 2. Run a small watcher program in the script directory Immediately after "play" command: 1. Delete the temp file In the small watcher program: 1. wait for 2 seconds 2. If temp file does not exist, exit 3. Otherwise, read the temp file, show a warning message, close the PID, delete the temp file I have some worries about the DLLs not properly closed and the RichEdit control not destroyed, but what else can I do? zPlayer - A Small Audio and Video Player
argumentum Posted December 1, 2024 Posted December 1, 2024 52 minutes ago, CYCho said: I have some worries about the DLLs not properly closed and the RichEdit control not destroyed AutoIt should take care of everything once it closes. But to make sure, load the script and kill the PID. Do that repeatedly and check the memory use in your PC. If after a thousand cycles it looks good then don't worry, else, either fix the freeze or don't use the RichEdit. Another approach would be to fork everything and that would be better for handling everything you wish to separate. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
CYCho Posted December 1, 2024 Author Posted December 1, 2024 30 minutes ago, argumentum said: AutoIt should take care of everything once it closes. I'm relieved to hear that. The freeze is very rare anyway and I will not worry about it anymore. Thanks. zPlayer - A Small Audio and Video Player
argumentum Posted December 1, 2024 Posted December 1, 2024 (edited) 7 minutes ago, CYCho said: I'm relieved to hear that. 40 minutes ago, argumentum said: But to make sure, load the script and kill the PID. Do that repeatedly and check the memory use in your PC. If after a thousand cycles it looks good then don't worry, else, either fix the freeze or don't use the RichEdit. Heed my words coder: do testing. Don't trust anyone other than your own testing. 😇 Edited December 1, 2024 by argumentum CYCho 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
CYCho Posted December 1, 2024 Author Posted December 1, 2024 (edited) 2 hours ago, argumentum said: If after a thousand cycles it looks good then don't worry, 1 hour ago, argumentum said: Don't trust anyone other than your own testing. I just finished 1000 loops of run and close of the program including the RichEdit and I coudn't see even 1% change of memory usage. If it happens I will just kill the process in the task manager and don't worry about it. Edited December 1, 2024 by CYCho argumentum 1 zPlayer - A Small Audio and Video Player
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