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
Error trapping for a video file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Error trapping for a video file
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
...
Best
Klaus
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
...
Best
Klaus
Re: Error trapping for a video file
Thanks, Klaus.
I was assuming (and hoping) it would be something this simple.
Lloyd
I was assuming (and hoping) it would be something this simple.
Lloyd
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Error trapping for a video file
Moderation note: thread restored to its original pre-spam state.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn