Jump to content
Server Maintenance This Week. ×

Copying files based on an ID in FileMaker


This topic is 8245 days old. Please don't post here. Open a new topic instead.

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

Link to comment
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

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
Share on other sites

This topic is 8245 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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