String manipulation in Apple Script
Issue #89
Today I find that AppleScript allows us to import Foundation, with that we have lots of power, including NSString. See my script
1 | use scripting additions |
Here is how I can remove last path component from a string
1 | on myRemoveLastPath(myPath) |
You need to cast to NSString with NSString's stringWithString: and cast back to Apple Script string with as text. The 's is how you can invoke functions.
One more thing is that we can support parameters to function, like this script
1 | on remove:remove_string fromString:source_string |