Re: script doesn't find all the file in a hiearchy
Re: script doesn't find all the file in a hiearchy
- Subject: Re: script doesn't find all the file in a hiearchy
- From: Gary Lists <email@hidden>
- Date: Tue, 02 Mar 2004 18:08:46 -0500
Stephan Adam wrote [3/2/04 3:06 PM]:
>
Hello all,
>
>
I have a script to verify for a specific file in a hiearchy and it seems
>
that sometime the file is there but the script doesn't see it.
>
>
I am on OS 9.2.2 on eMac. The script is run from within FileMaker Pro 6.0v3
>
>
Here is my complete script. Is there a better and a faster way to do that?
>
----
Even with your script posted, it would be helpful to know what string values
the FM fields contain. Perhaps you are not getting colons properly placed
in some records and so forth?
It appears to me that you already expect to have the name of the file in
your field, and that you know the path to the parent (storage) folder.
Your field naming, using 'g' in front, implies you might even have this set
in a global field, so all your images are expected to be in the same folder.
That's good. Why not just concatenate the two (the global folder and the
name) and then test in one line:
tell app "Finder" to set photoExists to exists gWholeFolderAsPath & ":" &
myPhotoName
if not photoExists then
-- mark your record according, delete a thumb if you want, etc.
else
-- skip this record, because your info is correct...file is there
end if
If you use the field value to look for a file with that name, then insert
that file name back into the field, you've changed nothing.
In my photo catalog DB, I either use 'exists' to see if the file is present
at the path info that I have stored, or wrap things in a try block and use
'alias...'. The first option (seems better) will return a 'false', while
the second will throw an error, which you catch in your 'on error' handler.
try
set dummy to alias myWholeImagePathWithColonsOrWhatever
on error
display dialog "oops. gone."
-- or something more useful
end try
It is _much_ faster to just use 'exists', as this is precisely what it's
for, when you know the supposed location.
--
Gary
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.