NSMakeRange-> ASObjC

I've never seen code formatted like this before: NSMakeRange (0, 5). Usually, there is a method in the class that can be called, but I didn't know the class name itself take parameters. How to convert this into ASObjC ObjC syntax?

Like other executives, the function is defined in the application, so it would be:

NSMakeRange (0, 5) active application

Tags: Mac OS & System Software

Similar Questions

  • AppleScript-> Get contact photo-> NSImage

    I hope that red_menace or ASObjC another expert will see this.

    In collaboration with AppleScript, I have:

    tell application "Contacts"
       set theImage to image of somePerson
    end tell
    

    You are on the right track, but the Contacts.app image data is not in a format that like cocoa (even if the .sdef said NSData, it does not seem make it cross the bridge).  I looked around a bit and have not found a direct conversion, but there are two ways to do it.  First of all, you can use StandardAdditions to write the image AppleScript in a file and then use NSImage initWithContentsOfFile: method to read it back in.  If you're not wanting to use a file to perform the conversion, you can also perform the conversion of data by program, although it is more than a run around.

    To do your own conversion, you need get the data of the AppleScript into another container (for example, a string), and then convert it to a cocoa NSData object.  You cannot force the data directly in a string, to do an end run around of AppleScript to do.  One way is to use and the shell script osascript (which returns the text), another is to use a try statement to force an error, since even if AppleScript will not force the data to a string, it will tell you what it is in a chain of error message (?):

            tell application id "com.apple.AddressBook" to set theImage to image of my card
            try
                    theImage as string -- force an error
            on error errMsg -- strip the terms and chevrons from the error message
                    set here to (offset of "«" in errMsg) + 10
                    set there to (offset of "»" in errMsg) - 1
                    set imageString to text here thru there of errMsg
            end try
            log imageString -- note that the string is pretty long, even with a small image
    
  • How to create a progress ApplescriptObjc Webkit bar

    I'm working on a based ApplescriptObjc web browser for OS X, and I'm stuck on getting a progress bar determined to view the progress of the loading of webkit view.  Does anyone have any ideas on how to do that? I would like to do so without a loop of constant repetition also. The perfect end goal would be to have a progress bar that reflects the progress of the loading of a web view and allow the user interface to remain responsive while it is running. Thank you!

    The WebResourceLoadDelegate methods are now obsolete since recently, but in fact they have changed just in a formal Protocol and the documentation has not yet caught up.  I don't know if something has changed in the way that ASObjC can access the delegate methods, but take a look at the WebKit Programming Guide.

Maybe you are looking for