Re: Filemaker & Searching for File in Finder
Re: Filemaker & Searching for File in Finder
- Subject: Re: Filemaker & Searching for File in Finder
- From: "Mara Jade Skywalker" <email@hidden>
- Date: Thu, 2 Mar 2006 12:57:54 -0700
Stan,
Thank you for your help. Please see my comments below!
On 3/1/06, Stan Cleveland <email@hidden
> wrote:A couple of things are going on. First, the syntax you're using for the file
search is incorrect.
--This doesn't surprise me...during my searches on the net, trying to find any reference to doing a Finder search was difficult. I found two examples, neither of which even compiled in my particular script, so I ended up adjusting the syntax here and there until the compiler took it. LOL Probably not the smartest way to go about writing applescript, but it's all I had. :)
Second, you're redundently specifying the class of the
variable 'search_folder' as both a folder and an alias. The code 'folder
search_folder' resolves to 'folder (alias "Server:Folder1:Folder2:")' which
fails. Use either 'folder' or 'alias' but not both.
--Again, I'm not surprised. I used so many variations on both alias and folder during re-writes to get something to compile. Until you pointed it out, I hadn't even realized I was doing that.
The code below does what
I think you're wanting to accomplish.
tell application "Finder"
with timeout of 180 seconds
set image_file_alias to first file of entire contents ¬
of search_folder whose name is sku_name
end timeout
end tell
--This code does indeed point to the right file now. It still won't let me return the path or the picture to cells in my Filemaker DB, but it's closer. I'll have to work more on the last bit.
Note the use of an extended timeout to prevent the search operation in a
large folder structure from failing. Adjust the timeout value to fit your
situation. Also, specifying the 'first file of' (instead of 'files of')
will, on average, shorten search times considerably.
--I did notice the addition of "first file of", which I've not encountered in my applescript research until now. Nice touch that. Thank you for sharing it with me. I had planned on doing a timeout and a few more parameters, such as a try block in case the image doesn't exist (which might happen once in a while as files get moved accidentally). But I wasn't going to do that until I had actually gotten the base script to run. Because I'm incredibly new at this, I'm building and testing in baby steps. If part "A" works as a script on its own, and I add "B" to the script and it stops working, then I only have to tweak the "B" code. But I really appreciate your suggestions, and having you put the timeout code in at this stage gives me a bit of code I know works!
Thank you again,
Tina
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden