home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / launch.txt < prev    next >
Encoding:
Text File  |  1992-11-05  |  2.8 KB  |  110 lines

  1. program Transfer;
  2.  
  3. {This program implements a desk accessory that allows you to
  4. transfer to another application.
  5.  
  6. Richard Siegel
  7. March 7, 1986
  8.  
  9. Copying is allowed for noncommercial and personal use only.
  10. }
  11.  
  12. {This file should be saved as "Transfer.pas"}
  13.  
  14. {$i MemTypes.ipas}
  15. {$i QuickDraw.ipas}
  16. {$i OSIntf.ipas}
  17. {$i ToolIntf.ipas}
  18. {$i PackIntf.ipas}
  19.  
  20. TYPE
  21.           pLaunchStruct = ^LaunchStruct;
  22.           LaunchStruct = record
  23.                     pfName: ^Str255;
  24.                     param: integer;
  25.           End;  {LaunchStruct}
  26.  
  27.           DAGlobals = record
  28.                     Reply : SFReply;
  29.                     ValidTypes : SFTypeList;
  30.                     volRef : Integer;
  31.                     Location : Point;
  32.                     prompt : Str255;
  33.                     pMyLaunch: pLaunchStruct;
  34.                     myLaunch:  LaunchStruct;
  35.                     fName: Str255;
  36.                     err : OSErr;
  37.           end;
  38.  
  39.           DAGlobalsPtr = ^DAGlobals;
  40.           DAGlobalsHandle = ^DaGlobalsPtr;
  41.  
  42.  
  43. Procedure Open(var Device : DCtlEntry; var Block : PAramBlockRec);
  44.  
  45. var
  46.           DaGlobalsHndl : DAGlobalsHandle;
  47.           DAGlobalsRec : DAGlobals;
  48.  
  49. Procedure Launch; INLINE $A9F2;
  50. PROCEDURE LaunchIt(pLnch: pLaunchStruct); INLINE $205F;
  51.  
  52. begin
  53.  
  54.           Device.DCtlStorage := NewHandle(SizeOf(DAGlobalsRec));
  55.           HLock(Device.DCtlStorage);
  56.  
  57.           DAGlobalsHndl := DAGlobalsHandle(Device.DCtlStorage);
  58.  
  59.           with DAGlobalsHndl^^ do begin
  60.                     with Location do begin
  61.                               h := 60;
  62.                               v := 60;
  63.                     end;
  64.  
  65.                     validTypes[0] := 'APPL';
  66.  
  67.                     SFGetFile(Location, prompt, NIL, 1, validTypes, NIL, Reply);
  68.                     if Reply.good then begin
  69.                               err := SetVol(NIL, Reply.vRefNum);
  70.                               pMyLaunch:= @myLaunch;
  71.                               With pMyLaunch^ do Begin
  72.                                          pfName:= @Reply.fName;    {pointer to our fileName}
  73.                                          param:= 0;          {we don't want alternate screen or sound buffers}
  74.                               End;       {With}
  75.                               LaunchIt(pMyLaunch);
  76.                               Launch;
  77.                     end;
  78.           end;
  79. end;
  80.  
  81. procedure Close(var Device : DCtlEntry; var Block : PAramBlockRec);
  82. begin
  83. end;
  84.  
  85. procedure Ctl(var Device : DCtlEntry; var Block : PAramBlockRec);
  86. begin
  87. end;
  88.  
  89. begin
  90. end.
  91.  
  92. ------------------------Cut Here-------------------
  93.  
  94. *The RMaker source file looks like this:
  95.  
  96. *RMaker source to create desk accessory file
  97. *Richard Siegel
  98. *March 7, 1986
  99. * This file should be saved as Transfer.R
  100.  
  101. Transfer DA
  102. DFILDMOV
  103.  
  104. TYPE DRVR = PROC
  105.  Transfer, 20
  106. pds2:Transfer *Make the disk name whichever disk you want the file
  107.               *to be stored on
  108.  
  109. ------
  110.