• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
System Events duplicate command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

System Events duplicate command


  • Subject: System Events duplicate command
  • From: Luther Fuller <email@hidden>
  • Date: Thu, 20 Aug 2009 13:00:41 -0500

I recently complained that ...

tell application "System Events"
duplicate aFile to destinationFolder with properties {name:newName}
end tell

ignores the phrase 'with properties { ... }'. (bug?)

My work-around was to use this handler ...

on copyFile(fileAlias, targetAlias, newFileName)
-- fileAlias is an alias to the source file, targetAlias is an alias to the destination folder and newFileName is a string
set sourcePath to (quoted form of POSIX path of fileAlias)
set targetPath to (quoted form of (POSIX path of ((targetAlias as text) & newFileName)))
try
do shell script "cp -n -p " & sourcePath & space & targetPath
return ((targetAlias as text) & newFileName) as alias
end try
return {}
end copyFile

It seems to do exactly what I need.
Does anyone with more unix experience than I see any problems here?

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Find/replace
  • Next by Date: Another Indesign CS4 question
  • Previous by thread: System Events duplicate command
  • Next by thread: Value of insertion point as integer
  • Index(es):
    • Date
    • Thread