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

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

Recommended Posts

Posted

hello,

i have a script that copies a soundfile that is referenced to a record in my database.

tell application "FileMaker Pro"

set thePath to cell "filepathtext" of current record

end tell

if thePath is not "" then

set theDestinationFolder to choose folder

try

set thealias to alias thePath

tell application "Finder"

duplicate thealias to theDestinationFolder with replacing

end tell

on error errMes

display dialog "Could not copy file" & return & errMes

end try

end if

I can run this script and it works fine when copying 1 sound file ,how do i edit the script to copy all the soundfiles in the current found set to one destination folder ignoring any errors (records that are not linked)

Thank you

Paul Apted

Posted

just create a looping script in ScriptMaker that looks like the following

Go to Record/Request/Page[First]

Loop

Perform AppleScript[--your AppleScript goes here--]

Go to Record/Request/Page[Exit after last, Next]

End Loop

Posted

Break your applescript into two parts. The first part would perform the "choose folder" part and then set a global to that folder path. That part would be done before you enter the loop. Then the second part would be the remainder of the applescript that copies the file, and would reference the global value to get the destination folder.


--part 1, before the loop

set theDestinationFolder to choose folder

tell application "FileMaker Pro"

  set cell "destinationFolder"  of current record to theDestinationFolder

end tell



--part 2, inside the loop

tell application "FileMaker Pro"

  set thePath to cell "filepathtext" of current record

  set theDestinationFolder to cell "destinationFolder"  of current record

end tell

if thePath is not "" then

  try

    set thealias to alias thePath

    tell application "Finder"

      duplicate thealias to theDestinationFolder with replacing

    end tell

  on error errMes

    display dialog "Could not copy file" & return & errMes

  end try

end if





*Filemaker Script

Go to Record/Request/Page[First]

Perform AppleScript[--your AppleScript Part 1 goes here--]

Loop

  Perform AppleScript[--your AppleScript Part 2 goes here--]

  Go to Record/Request/Page[Exit after last, Next]

End Loop 

Posted

Thank you very much for your input . the script worked after i changed the following line:

set cell "destinationfolder" of current record to theDestinationFolder

to

set cell "destinationfolder" of current record to theDestinationFolder as string

thanks for the help

Paul

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