Re: NSString in ApplescriptObjC
Re: NSString in ApplescriptObjC
- Subject: Re: NSString in ApplescriptObjC
- From: Shane Stanley <email@hidden>
- Date: Fri, 11 Apr 2014 00:01:52 +1000
On 10 Apr 2014, at 9:06 pm, Robert Stott <email@hidden> wrote:
> set theOutputText to psPrefix & return & thePS & return & theSuffix
> set theString to NSString's stringWithString_(theOutputText)
> theString's writeToFile_atomically_(theSavePath, true)
I just noticed this: don't use writeToFile:atomically:. It was deprecated in OS X 10.4, and you should *never* write a string to file without setting an encoding.
Try something like this instead:
set theString to NSString's stringWithFormat_("%@%@%@", psPrefix, thePS, theSuffix)
theString's writeToFile_atomically_encoding_error_(theSavePath, true, current application's NSMacOSRomanStringEncoding, missing value)
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
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