Call Methods in Applescript (xcode)

ive been applescripting for a couple years now, finally dipping myself into xcode, with a hint of Oj C knowledge, i want to try implementing call methods invto applescript. i read in the AS studio PDF provided by apple that this is doable, and there is an AS cmd for it, but it was really complicated and i got lost pretty quick. i managed to make a simple web browser with the “loadrequest:” method, and i wish to expand on this.

does anybody have any pointers or tutorial links for call methods in AS? ive been googling around and found nil =[


to call a ObjC method you need the name of the method and the class, which contains this method.
If the method expects parameters, use with parameter (single parameter) or with parameters (multiple parameters as list)

For example this creates a properly escaped URL from a string

set theURL to ""
set URLWithString to (call method "stringByAddingPercentEscapesUsingEncoding:" of theURL with parameter 30)
set newString to call method "URLWithString:" of class "NSURL" with parameter URLWithString

There are quite a number of discussions on Macscripter about using call methods.