• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: SMB CIFS AFP ETC... Server Path URL question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SMB CIFS AFP ETC... Server Path URL question


  • Subject: Re: SMB CIFS AFP ETC... Server Path URL question
  • From: Quinn <email@hidden>
  • Date: Fri, 10 Aug 2007 11:01:05 +0100

At 23:01 -0400 9/8/07, Daniel Brieck Jr. wrote:
What should I be focusing on as a minimum? Objective-c , Core Foundation/ services, all of the above, etc to use those functions. New to programming Apps for OS 10 . Started Development of Mac os 10 apps using AppleScript Studio. I have some experience with C / C++ and plan on moving to Objective-C full time at a later date. But for now I want to try to get My AppleScript Studio program working.

Here's an Objective-C method that calls FSCopyURLForVolume and returns the result as an NString.


- (NSString *) urlStringForServerVolume:(const char *) path
{
OSStatus err;
FSRef ref;
FSCatalogInfo catInfo;
CFURLRef url;
CFStringRef str;
NSString * result;
assert(path != NULL);
err = FSPathMakeRef( (const UInt8 *) path, &ref, NULL);
assert(err == noErr);
err = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catInfo, NULL, NULL, NULL);
assert(err == noErr);
err = FSCopyURLForVolume(catInfo.volume, &url);
assert(err == noErr);
str = CFURLGetString(url);
assert(str != NULL);
result = [NSString stringWithString:(NSString *) str];
assert(result != nil);
CFRelease(url);


    return result;
}

To integrate this into an AS Studio app you'll need to do the standard AppleScript-to-Objective-C bridging thing. That's kinda off topic for this list, but there's plenty of information available.

o The "AppleScript Studio Programming Guide" (URL below) has a section called "Accessing Code From AppleScript Studio Scripts" that talks about how to go from AppleScript to Objective-C.

<http://developer.apple.com/documentation/AppleScript/Conceptual/StudioBuildingApps/index.html>

o The "Multi-Language" sample code (in "/Developer/Examples/AppleScript Studio") demonstrates how to call various languages, including Objective-C from AS Studio.

o The "Support" sample code (also in "/Developer/Examples/AppleScript Studio") has a very simple example of how to call a trivial Objective-C method from a trivial AppleScript. Look at the "Localized String.applescript", "LocalizedString.h", and "LocalizedString.m" files.

o Finally, if you have problems with the AS Studio integration, I'd recommend the applescript-studio mailing list.

<http://lists.apple.com/mailman/listinfo/applescript-studio>

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Server Path URL question
      • From: "Daniel Brieck Jr." <email@hidden>
References: 
 >Re: SMB CIFS AFP ETC... Server Path URL question (From: "Daniel Brieck Jr." <email@hidden>)

  • Prev by Date: Re: SMB CIFS AFP ETC... Server Path URL question
  • Next by Date: Re: SMB CIFS AFP ETC... Server Path URL question
  • Previous by thread: Re: SMB CIFS AFP ETC... Server Path URL question
  • Next by thread: Re: Server Path URL question
  • Index(es):
    • Date
    • Thread