Re: percent encoding handler
Re: percent encoding handler
- Subject: Re: percent encoding handler
- From: Shane Stanley <email@hidden>
- Date: Sun, 10 Jul 2016 17:37:56 +1000
On 10 Jul 2016, at 5:24 PM, 2551phil <email@hidden> wrote:
Has anyone got a quick and dirty percent encoding handler?
i.e. I want to turn this:
tell application "Finder" activate end tell
into this:
tell application "Finder"
activate
end tell
I thought I’d seen one on this list in the past, but my searches have turned up a "missing value”. :p
How you do it depends a bit on what the purpose is. In this case, I suspect you want:
use AppleScript version "2.4" -- Yosemite (10.10) or later use framework "Foundation" use scripting additions
set aString to current application's NSString's stringWithString:"The time has come for all good “men”" set aString to (aString's stringByAddingPercentEncodingWithAllowedCharacters:(current application's NSCharacterSet's URLQueryAllowedCharacterSet())) as text
Which is quick but really quite clean...
|
_______________________________________________
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