Re: Using Defaults to Manipulate NSHumanReadableCopyright
Re: Using Defaults to Manipulate NSHumanReadableCopyright
- Subject: Re: Using Defaults to Manipulate NSHumanReadableCopyright
- From: Axel Luttgens <email@hidden>
- Date: Tue, 13 Sep 2011 09:46:21 +0200
Le 13 sept. 2011 à 08:45, Jim Thorton a écrit :
> Hola, AppleScripters!
>
> I have a simple app that will allow the user to manipulate application's plist file like changing version numbers and adding copyright info. It simply utilizes shell's Defaults. If you want to edit the copyright notice, then you manipulate NSHumanReadableCopyright. I've noticed that Defaults doesn't accept some special characters. For example, if I want to insert
>
> © Wasabi Things, LLC
>
> , then I should type the following.
>
> defaults write /Volumes/SDHC\ MEMORY/Test_package/MyTestApp.app/Contents/Info NSHumanReadableCopyright © Wasabi Things, LLC
>
> Terminal says
>
> defaults[347:903] Unexpected argument Wasabi; leaving defaults unchanged
Hello Jim,
That's because the shell sees "@", "Wasabi" and so on as separate words while parsing the line, each of these words being passed as an argument to the defaults command.
Here, spaces are viewed as separators during parsing; you may quote them individually:
defaults write /Volumes/SDHC\ MEMORY/Test_package/MyTestApp.app/Contents/Info NSHumanReadableCopyright ©\ Wasabi\ Things,\ LLC
or enclose the whole string within quotes:
defaults write /Volumes/SDHC\ MEMORY/Test_package/MyTestApp.app/Contents/Info NSHumanReadableCopyright '© Wasabi Things, LLC'
In this precise case, single or double quotes are OK.
Note that you already performed such quoting, so as to pass the plist's path as a single argument.
> If I want to insert Hello&Goodbye, Defaults will only insert Hello.
Here, "&" is viewed as a separator as well during parsing; but it also has a special meaning and acts as a control operator (you are in fact trying to perform two command: defaults and Goodbye).
Again, quoting allows to hide the special meaning of "&"; for example:
defaults write /Volumes/SDHC\ MEMORY/Test_package/MyTestApp.app/Contents/Info NSHumanReadableCopyright 'Hello&Goodbye'
HTH,
Axel
_______________________________________________
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