File I/O errors

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

File I/O errors

Douglas Benn-2
Dear Colleagues,

I am writing a macro to detect whether a Results file (  .xls) is present in a directory to prevent an error when using the Open(filename) command. I wondered if there is a way of testing in a macro the return value of the Open() command to see if it has failed to prevent the Directory window from opening?

Thank you.

Douglas

Dr Douglas K Benn, BDS,DDS, M.Phil., Ph.D., Dipl. Dental Radiology (Royal College of Radiologists, England).
Professor and Director of Oral & Maxillofacial Radiology
Dept of General Dentistry
Creighton University Dental School
2802 Webster St, Boyne 210
Omaha
Nebraska 68178

Tel: (402)280 5025
Fax: (402)280 5094
Reply | Threaded
Open this post in threaded view
|

Re: File I/O errors

BenTupper
Hi,

On Jun 30, 2010, at 6:53 PM, Benn, Douglas K. wrote:

> Dear Colleagues,
>
> I am writing a macro to detect whether a Results file (  .xls) is  
> present in a directory to prevent an error when using the  
> Open(filename) command. I wondered if there is a way of testing in a  
> macro the return value of the Open() command to see if it has failed  
> to prevent the Directory window from opening?
>

Perhaps first using the macro command File.exists(path) is the way to  
go.  If it isn't there you won't have to muck around with  
Open(filename).  See http://rsb.info.nih.gov/ij/developer/macro/functions.html#F 
  for details.

Cheers,
Ben




> Thank you.
>
> Douglas
>
> Dr Douglas K Benn, BDS,DDS, M.Phil., Ph.D., Dipl. Dental Radiology  
> (Royal College of Radiologists, England).
> Professor and Director of Oral & Maxillofacial Radiology
> Dept of General Dentistry
> Creighton University Dental School
> 2802 Webster St, Boyne 210
> Omaha
> Nebraska 68178
>
> Tel: (402)280 5025
> Fax: (402)280 5094
Reply | Threaded
Open this post in threaded view
|

Re: File I/O errors

Douglas Benn-2
Dear Ben,

Thanks very much.

Douglas

Dr Douglas K Benn, BDS,DDS, M.Phil., Ph.D., Dipl. Dental Radiology (Royal College of Radiologists, England).
Professor and Director of Oral & Maxillofacial Radiology
Dept of General Dentistry
Creighton University Dental School
2802 Webster St, Boyne 210
Omaha
Nebraska 68178

Tel: (402)280 5025
Fax: (402)280 5094



-----Original Message-----
From: ImageJ Interest Group on behalf of Ben Tupper
Sent: Wed 6/30/2010 7:10 PM
To: [hidden email]
Subject: Re: File I/O errors
 
Hi,

On Jun 30, 2010, at 6:53 PM, Benn, Douglas K. wrote:

> Dear Colleagues,
>
> I am writing a macro to detect whether a Results file (  .xls) is  
> present in a directory to prevent an error when using the  
> Open(filename) command. I wondered if there is a way of testing in a  
> macro the return value of the Open() command to see if it has failed  
> to prevent the Directory window from opening?
>

Perhaps first using the macro command File.exists(path) is the way to  
go.  If it isn't there you won't have to muck around with  
Open(filename).  See http://rsb.info.nih.gov/ij/developer/macro/functions.html#F 
  for details.

Cheers,
Ben




> Thank you.
>
> Douglas
>
> Dr Douglas K Benn, BDS,DDS, M.Phil., Ph.D., Dipl. Dental Radiology  
> (Royal College of Radiologists, England).
> Professor and Director of Oral & Maxillofacial Radiology
> Dept of General Dentistry
> Creighton University Dental School
> 2802 Webster St, Boyne 210
> Omaha
> Nebraska 68178
>
> Tel: (402)280 5025
> Fax: (402)280 5094