Re: Macro question: branch when file not found?
- I'd thought this kind of error handler would do it (file "biff" doesn't exist):
On Error (anError)
Open Document ("Storyville:users:jrethorst:biff")
Alert ("I found the file")
Alert ("I didn't find the file")
but WP opens the last file opened, in whatever folder, and says it found the file.
A longer script using the commands Set Directory and Get File could probably be made to work, but it would be convoluted. I've had more luck doing larger-scale operations with Applescript, and using WP's redoubtable 900 macro commands and objects for more specific actions.
--- In email@example.com, "em315" <em315@...> wrote:
> Another macro question that should be obvious but isn't obvious to me.
> I'm writing a macro that opens a file on disk. I want to go to a label if the file does not exist. I In WP for DOS, this is handled by putting a line "On Error (labelname)" before the line that opens the file. That doesn't seem to work in WPMac, and the Macro Manual says that "On Error" is used to trap memory errors.
> How can a macro test whether a file exists?