home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel Volume 2 #1
/
carousel.iso
/
mactosh
/
fkey
/
pathname.sit
/
Pathname.Pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1986-07-17
|
3KB
|
125 lines
{ Compile as a DA! }
{$h ' '} {we dont want a Pas$DeskAccHeader }
{$c 'FKEY' 6 'Pathname' } {Create a FKEY resource with a ID = 6}
{$t FKEY RSED }
{
This is an FKEY that will present the User with the standard SFGet
dialog box. The entire HFS pathname of the form
disk:folder:folder: ... :file
will be copied into the clipboard for subsequent pasting.
This is useful for Slideshow presentations and specifying include
files.
Written by :
Jon Pugh
Lawrence Livermore National Lab
PO Box 5509 L-561
Livermore CA 94550
(415) 423-4239
Copyright 1986. All rights reserved. This may be freely distributed
as long as you don't try and claim it or sell it. If you paid money
for this then you have been had!
}
Program FindPathName;
{$I 'MicahDrive:TML Pascal:Pascal System:MemTypes.ipas' }
{$I 'MicahDrive:TML Pascal:Pascal System:QuickDraw.ipas' }
{$I 'MicahDrive:TML Pascal:Pascal System:OSintf.ipas' }
{$I 'MicahDrive:TML Pascal:Pascal System:ToolIntf.ipas' }
{$I 'MicahDrive:TML Pascal:Pascal System:PackIntf.ipas' }
{$I 'MicahDrive:TML Pascal:Pascal System:HFS.ipas' }
Procedure PathName;
Const
FSFCBLen = $3F6;
VAR
myPt : Point;
catPB : CInfoPBRec;
volPB : ParamBlockRec;
anErr : OSErr;
reply : SFReply;
HFS : ^Integer;
TList : SFTypeList;
volName, Name : Str255;
ScrapName : Packed Array [1..255] of Char;
vRefNum, i : Integer;
SaveVol, DirRef, Err : LongInt;
Begin
HFS := Pointer(FSFCBLen);
SetPt(myPt,82,30);
SFGetFile(myPt,'Filename to Copy? ',NIL,-1,TList,NIL,reply);
IF reply.good THEN
Name := reply.fName;
vRefNum := reply.vRefNum;
If reply.good then
Begin
If HFS^ > 0 then
Begin
volName := Name;
With catPB do
Begin
ioNamePtr := @volName;
ioCompletion := NIL;
ioVRefNum := VRefNum;
ioFDirIndex := -1;
ioDrDirID := 0;
anErr := PBGetCatInfo(@catPB,FALSE);
DirRef := ioDrParID
End;
Name := Concat(VolName,':',Name);
While DirRef <> 1 do
Begin
SaveVol := DirRef;
With catPB do
Begin
ioNamePtr := @volName;
ioCompletion := NIL;
ioVRefNum := VRefNum;
ioFDirIndex := -1;
ioDrDirID := DirRef;
anErr := PBGetCatInfo(@catPB,FALSE);
DirRef := ioDrParID
End;
Name := Concat(VolName,':',Name)
End
End
Else
Begin
VolName := Name;
With volPB do
Begin
ioNamePtr := @volName;
ioVRefNum := VRefNum;
ioVolIndex := 0;
anErr := PBGetVInfo(@volPB,FALSE);
If anErr <> NoErr then SysBeep(3);
End;
Name := Concat(VolName,':',Name)
End;
Err := ZeroScrap;
For i := 1 to Length(Name) do
ScrapName[i] := Name[i];
Err := PutScrap (Length(Name), 'TEXT', @ScrapName)
End
End;
Procedure TheFKEY;
Begin
InitFonts;
InitWindows;
InitMenus;
TEInit;
InitDialogs(NIL);
PathName
End;
Begin { Main }
End.