Previous Index Next

BridgePlus.framework, SMSForder Class Methods

Category

URL and File related methods

Method

copyItemAt:toItem:replace:error:

Summary

Copies item, with atomic replacement if replaceFlag is true and destination item already exists. Pass aliases, files, HFS paths, POSIX paths or NSURLs.

Signature

+ (BOOL)copyItemAt:(id)urlFileOrPath toItem:(id)destUrlFileOrPath replace:(BOOL)replaceFlag error:(NSError *__autoreleasing *)outError

Parameters

urlFileOrPath = source alias, file, HFS path, POSIX path or NSURL

destUrlFileOrPath = destination alias, file, HFS path, POSIX path or NSURL

replaceFlag = whether to replace existing file

outError = missing value or reference

Result

True if it succeeds, false if not. See Notes.

Availability

Version 1.3.0

Notes

If you set outError to reference, the result will be a list of two items. If there is no error, the first item will be the result of the method and the second will be missing value. If there is an error, the first item will be false and the second item with be an NSError.

Sample

use scripting additions

use framework "Foundation"

use script "BridgePlus"

load framework


set {theResult, theError} to (current application's SMSForder's copyItemAt:"~/Documents/Something" toItem:"~/Desktop/Something" replace:true |error|:(reference))

if theResult as boolean is false then error (theError's localizedDescription() as text)


Click here to open script in a script editor