From: mxmora@unix.sri.com (Matthew Xavier Mora) Subject: PathName from FSSpec (pascal code) Date: 9 Sep 92 00:21:34 GMT I spent the long weekend cursing at the AppleEventManager trying to get the finder to open a control panel. Anyway, one of the things I discoverd was that the alias manager will give you a path name if you ask for it. Since my program needed to display the path name, I wrote a function that will return a full path name in a handle (not in a str255 so you it won't crash with long path names) when you give it a fsspec. I also figured out how to get the finder to open a control panel. You need to send an open selection event. I finally found an example that worked and ported it to pascal. If you would like to see that code I can post it here also. Its a direct copy of C.K Han's C code that is on the developers CD. Here is the code: {-------------------------------------------------------------------------} {Path Name From FSSpec } {by Matthew Xavier Mora } {9-8-92 } {Given a FSSpec this function will return a handle to the full path } {name. It creates the handle as it goes. It does not have the limited } {string length (255) problem like the ones I have seen. This of course } {requires system seven or better because of the use of the alias manager } { Don't forget to dispose the handle when you are done with it. } {-------------------------------------------------------------------------} {$PUSH} {$-R} function PathNameFromFSSpec (var theFile: FSSpec): Handle; var i: AliasInfoType; theStr: STR63; h: Handle; oe: OSErr; alias: AliasHandle; theSize: longint; begin PathNameFromFSSpec := nil; oe := NewAlias(nil, theFile, alias); {create a temporary alias} if alias = nil then {if nil exit } exit(PathNameFromFSSpec); h := NewHandle(0); if h = nil then {if nil exit. } exit(PathNameFromFSSpec); i := asiAliasName; { set the index to the Parent } if GetAliasInfo(alias, i, thestr) = noerr then {get The parentName } begin {returns error if bad alias } while thestr <> '' do { will be '' when done traversing the path} begin theSize := longint(thestr[0]) + 1; thestr[0] := ':'; { use the size byte to store the colon. aux='/' } { Let Munger do the work } theSize := Munger(h, 0, nil, 0, @thestr, thesize); i := i + asiParentName; {set the index to the next parent} oe := GetAliasInfo(alias, i, thestr); {get the parentName } end; {get the Volume Name } oe := GetAliasInfo(alias, asiVolumeName, thestr); theSize := longint(thestr[0]); theSize := Munger(h, 0, nil, 0, Ptr(ord(@theStr) + 1), theSize); PathNameFromFSSpec := h; {return the newly created handle} end; DisposeHandle(Handle(alias)); end; {$POP} Matt