Page 1 of 1

Error trapping for a video file

Posted: Thu Jul 10, 2014 3:51 pm
by lrieber
Hello,

I'm creating a video analysis tool application where the user chooses a video file to analyze for tagging and commenting. I've created a nice structure where the user can save as many analysis project as they wish, with each project pointing to a unique video file. All is working great.

But now I want to anticipate some error trapping, such as those times when the user inadvertently deletes or moves the video file from their hard drive after they have quit the LiveCode app. Then, when they launch the LiveCode app, I want my LiveCode to detect that the video file is missing followed by prompting the user to navigate to the video's new location.

I'm storing the path to the video file in a local variable called "varVideoFile" and here is the line that tells the video player where to find the file:
set the filename of player "Player" to varVideoFile

Again, this works great. But what if the video file is not there? Well, LiveCode just shows an empty player.

I know this is one way to do error trapping:

open file "MyFile"
if the result is not empty then
answer the result
exit to top
end if

But I don't want to open the video file, I just want to "look" and see if it is there. If it is (true), then I'll play the video as planned. If it isn't (false), I want to prompt the user to give me the new location.

So, my question is simply what is the code to just "look" to see if the file is there to return a result of true or false?

Thanks - Lloyd

Re: Error trapping for a video file

Posted: Thu Jul 10, 2014 3:59 pm
by Klaus
Hi Lloyd,

this one is pretty "cheap":
...
if there is a file varVideoFile then
## File present
....
Or
...
if there is NOT a file varVideoFile then
## File not present
...
:D


Best

Klaus

Re: Error trapping for a video file

Posted: Thu Jul 10, 2014 4:18 pm
by lrieber
Thanks, Klaus.

I was assuming (and hoping) it would be something this simple. :)

Lloyd

Re: Error trapping for a video file

Posted: Wed Oct 22, 2014 3:26 am
by FourthWorld
Moderation note: thread restored to its original pre-spam state.

Re: Error trapping for a video file

Posted: Wed Oct 22, 2014 11:58 am
by Klaus
??? :shock: