I discovered today that by asking an AppleScript studio app to do things on your behalf, you can essentially get the benefits of AppleScript studio into any standalone script. So I put together an EMPTY AS studio application that runs in the background:
http://www.red-sweater.com/AppleScriptKit.zip
If you download this to your computer, you can now use the entire AppleScriptKit terminology by simply addressing the application “AppleScriptKit”. For example:
WebSafeString("http://www.apple.com/Fun with spaces.html")
on WebSafeString(myString)
tell application "AppleScriptKit"
set myURLString to call method "stringWithString:" of class "NSString" with parameter myString
set myFixedURLString to call method "stringByAddingPercentEscapesUsingEncoding:" of myURLString with parameter 30
end tell
end WebSafeString
This produces the string “http://www.apple.com/Fun%20with%20spaces.html”