Jump to content

repeat prpblem


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

Recommended Posts

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

Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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