Jump to content

Recommended Posts

Posted

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.

Posted
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?

Posted
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.
autoit_scripter_blue_userbar.png

Posted (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 by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (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 by CYCho

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...