Jump to content
Sign in to follow this  
Partha

Copying files based on an ID in FileMaker

Recommended Posts

Hi,

I do have some basic knowledge of AppleScript with FileMaker, but this has me stumped. crazy.gif" border="0

I've got a database made for a friend that has descriptions of hundreds of old advertisements. Each record has a unique ID.

These Ads have been scanned and saved with the same name as the ID (though with a .jpg extension at the end of the file name). They are all saved on an external hard disk in a common folder called "Press Ads".

Problem is that he needs to mail these out to people regularly, and finding them is painful.

Is there anyway through AppleScript that I can copy them to a new folder ?

Thanks in advance

Partha Dasgupta

Share this post


Link to post
Share on other sites

In the database, create 2 new fields (global - text format):

1. "from_folder" who contains the path to the folder named "Press Ads"

a path looks like this : "HD_name:folder:sub_folder:Press Ads:"

2. "to_folder" who contains the path to the new folder

Then try this applescript :

set the_name to cell "ID" of current record

set the_from_folder to cell "from_folder" of current record

set the_to_folder to cell "to_folder" of current record

set the_file to from_folder & the_name & ".jpg" as string

tell application "Finder"

duplicate (the_file) as alias to (the_to_folder) as alias

end tell

Jean-Marie

Share this post


Link to post
Share on other sites

The script below wil find "Tagged" records and move the corresponding image to a folder.

Or, ditch the doScript line and find your images manually, then run the AppleScript

tell application "FileMaker"

activate

open file "SomeDrive:SomeFolder:SomeDB"

do script "SomeScript ThatFindsTheRecords"

set N to (number of records)

set T to N

repeat N times

set UserImage to cell "SomeField" of record T

set UserPath to "SomeHarddrive:SomeFolder:" & UserImage & ".jpg" as string

set T to (T - 1)

tell application "Finder"

activate

try

move file UserPath to folder "SomeHarddrive:SomeFolder"

on error

display dialog UserImage & " Not Found"

end try

end tell

end repeat

end tell

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Who Viewed the Topic

    1 member has viewed this topic:
    cfmartinez1090 
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.