Re: Toggle invisible files
Re: Toggle invisible files
- Subject: Re: Toggle invisible files
- From: Nigel Garvey <email@hidden>
- Date: Thu, 10 Nov 2016 12:53:25 +0000
2551phil wrote on Thu, 10 Nov 2016 18:38:04 +0700:
>> read the whole defaults text and see if it contains
"AppleShowAllFiles =
>>1;". If not, it either contains the 0 setting or neither; it doesn't
>>matter which
>
>As Shane’s already pointed out, that setting can also be ‘Yes’ or
‘True’,
>so just testing for ‘1’ won’t cut it.
Neither will only reading half my post. ;)
NG
>>>> there are several values other than "1"
>>>
>>> ‘Yes’, ‘true’ and ‘1’ - you’re right I was a bit hasty there.
>>
>> Here's a one-shell-script offering:
>>
>> do shell script "newState=$(
>> defaults read com.apple.finder |
>> sed -En '/ *AppleShowAllFiles *=
*(1|[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]).*/ {
>> # If the ‘on’ setting is found, store “0” in the hold space.
>> s//0/
>> h
>> }
>> $ {
>> # Output the hold space contents at the end, or “1” if none.
>> g
>> /^$/ s//1/
>> p
>> }'
>> ) ;
>> defaults write com.apple.finder AppleShowAllFiles $newState ;
>> killall Finder"
_______________________________________________
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