Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted

Hi - I'm sorry if this has been asked before. I'm new to this forum, FMP, and AppleScript. Here is my situation:

I have thousands of High Resolution Tiff files I need to send to many different agencies. The file structures were created years before we contracted these other agencies and are spread throughout many different folders. I can get a found set of the images I need to send to each agency, I just need a way to copy the original Tiffs to a new external HD. All of the Tiffs have a low Resolution JPEG I have referenced to a FMP 6 DB. I also have a path to the Tiff file in that DB. I can only assume the only way to do this is through scripting. Any thoughts are very appreciated.

Thanks,

Ed

Posted

It sounds as if you have pretty much what you need to automate this. You have the complete file path to the original file and the same of the destination folder (where the new file is going to be in). To see how it works, try this, which has you choose the file and folder. In your real script you'd put the file and folder path's instead.

tell application "Finder"

set theFile to choose file

set newFolder to choose folder

duplicate theFile to newFolder

-- or "move", same thing between 2 volumes

end tell

To see what each should look like, a Mac path, just use the command "(choose file) as string" and look at the result.

"Macintosh HD:Users:fej:Desktop:SDMUG DB:SDMUG_db.fp7"

(choose folder) as string -- ends in ":"

This is partition 1 of my external hard drive (dull name, I know):

"Part 1:Users:fej:Documents:"

If you had the original file path, and the path to the new folder, in FileMaker fields, the AppleScript would look like:

tell application "FileMaker Developer" -- comment out or remove in FileMaker

tell current record of window 1

set myFolder to cell "FilePath"

set newFolder to cell "NewFolder"

end tell

end tell -- comment out or remove also

tell application "Finder"

duplicate file theFile to alias newFolder

end tell

You don't need to: tell "FileMaker Pro" inside a Perform AppleScript step (the FileMaker app knows who it is, and it avoids the "Pro" or "Developer" name problem). So you can either comment those lines out, with a "--" preface, or remove them. They are only needed in Script Editor (who otherwise does not know who FileMaker is). I write the code in Script Editor (or Smile), with its pretty colors :-), then comment them out and copy/paste into FileMaker.

You'd want to be on a layout that had those 2 fields on it, for simplicity. Also easiest to just run this Perform AppleScript step for each record, inside a FileMaker Loop, with Go To Record/Request [Exit after Last, Next].

It would be possible to create the folder structure in the external drive, mirroring the original (not easy, but doable, I think), or rename the file afterwards (pretty easy).

This topic is 7261 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.