Diferentiate error source

If I read 2 text file "simultaneously" and there's a 2101 error, How do I tell which file crashed. The error catcher gives 4 items. Component which is ...file@random number, FunctionName that returns FileRead, errorcode returns 2101 and message that says file not found.

use 2 file components or
use 1 file component and read the files one by one

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

I couldn't think of a way at first to ID the 2 components' random numbers so I used the 1 by 1 method. The problem is the way AI cues. You can't do one and then the other unless you put the second in the error handler and the after.read I got it to work using a complicated system of flags.

Then I did some experimenting and "found" the component "name" at the end of the properties list. I may re-write it the 2 file way.

1 Like

I used the hint as a variable so I wouldn't have to create a global just for this. It works but over-all it's a great way not to do it.

Is there a better way than this? I don't actually use the data here, it's just a central place to verify existence to avoid errors. If they don't exist I re-create them from the master files. The purpose is to have the files in a location where the user can access them by PC.

you might want to to use the Exists method from the file extension
App Inventor Extensions: File | Pura Vida Apps or just copy the files to its destination using the Copy method

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.