[comp.sys.mac] Alias Launchers

drc@dbase.UUCP (Dennis Cohen) (08/19/87)

The following is MDS Assembly and TML Pascal Source as well as a set of
resources which, when linked together into an application and placed in
the same directory as SuperPaint will cause SuperPaint to be opened with
the MacPaint docs on which you double-clicked.  Obviously, from the source
there are some caveats - you cannot have MacPaint on your disk and SuperPaint
must be called SuperPaint.

Obviously, the application to which you're aliasing should be able to open the
document that you're passing it.  Word is stupid that way, it can open a
MacWrite document but can't open it at launch -- MindWrite can.  SuperPaint
can and does open anything of type PNTG as well as its own docs.

Dennis Cohen
Ashton-Tate Glendale Development Center
dBASE Mac Development Team
---
(This file must be converted with BinHex 4.0)

:$%aKG@jMD'9b,R"TG!"3593J8%P8)!#3"!cB!*!%If&36@%d!A#d@i+YGPQpLU8
'k#aKlSFpFH)P('BjJK%%CV1%jNLKcJ%cQbNfXR9GEhGLSpKk[H6500*,aP)Jh'f
0TX'Xe3+9i9CJa+l`Vr9'CVLX3`RXMhJLe#@HDZ"6C!J%Y!9#"3QhV6FS#S"$9NY
S6,CAPGkF5L"d`&&PeXXT1aVS`Q&L*M#S@+0,%TUC4+Irb`VRGGpVEr1`4!($cUf
3!,"LYm$LK"'eASVla3)f#Z3A-#K@S9L5'Y*$@T&@+T**,Z"8$ZLT8#&B"U#K8B0
c@5NNVd*TASdM3-i@+FD"R#a6#P'Dc4YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
YYYYfD@D%NNQ!MK%CYGaj0rRB)J$HF!!-E[P[)T0X11i$XGl@K***1!C3maJmadX
dXd***)8"Lk-F2BF316G4BiR(RB)J#3`16`!!aL%F$LK")2,HE4L"2!!$'ljEbH!
fV0#556&dBJ3mJfXfL%SBcheNh83B%K3rI-"cS4c(#5&3QkKM&'3%F)$-H0cXQjK
l0e&MMCS5553FjY%1%J)mK'+([V'j2@3b'"bE@3Pc[%-K'((ZhNhN35)-)CjM(RP
Uj2@3!2D)F0QK***$!j)4KalYj)L%%2N3-3)k2!!$'ljEcK*#J15!b$c%1j-A4i#
44EJfA!8*eF0[9iE0,0#556Ij((FNFpMV9jb555EJ+"hF)4BRahCTCSfffffffff
ffffffffffffffffffffffffffffl,)0K***)eEQ$BJNNhqGJL!0PrRB)J$B5555
2lS3`BEm%NQmfi$D'6Ch09"**d0VZf!)B(*Mb(h'#H@V8HHZV#5554rG#'$$IJNN
hQh!E3bE)AV)**1Kki%FN-$Np"aa!MSJ)BJ3maf%NNNMqk%-''r"**'h9E,[0Z!f
S**1KZZ!KN!$!j)#1+hb1j23L2136b22,#5554rG#'$$IJNNKHXfAHEF"Y355G$(
RS1'2*$!j23FF3)k)#')%2-GK***)rZK$"K[`55GZ!f3[9355G#)K"#8-GXK`N!!
4`K`L)FF1($B5556Z#HJNNLG#a1E&`JNNk%CVr1`4!'bc4YYYYYYYYYYYYYYYYYY
YYYYYYYYYYYYYYYYYYYf@%NNNi,[FXX5P*51%N!$K+"f'fffffffffffffffpEIj
f#)!iHG@qS&**************************#ELJLD5[3QPHM556J'82-B2-G,0
,0#555&!BZM($f(%$Nh8@1*ajf#)!N!$!j2!!$')4`1+%%JmYjY')%m!!-E[P[*i
$DXd***-A4L"$b$DcD)5KM2I@6G4"J5&$pm`(1K(-8PV9"'-IK"i)KhT)6+'0#B5
P*51%N!$K+"f%K,kP#@53!*9E#R"XAB8NK+B!S,(+5%RHL55558M&U,d*bNN*&5-
9ahM#14Jhlpqp9)[UT&j91S95,UUELUNA&8LfUN@P3XkP9)h96kUI96kUI96kUI9
6kUI96kUI96kUI96kVA&K9VMG9VK09)mUNH952+T(P8qURe8qURe8qURe8qURe8q
URe8qURe8qURe8qURe8qURe8qURe8qURe8qURe8qURe8qURe8qURe8qURpi`MNB0
qrI[95,kU4H96U&8LkUQiUT&a9)YUT&T8,1T950e8qURe8qURe8qURe8qURe8qUR
e8qURe8qUeaB9Dih9Di6952+T(P8MbU4j92UTp92UTp92UTp92UTp92UTp92UTp9
2UTp92UTp92UTp92UTp92UTp92UTp92UTp92UTp92UTp92UTmGL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+PiAejc5#pjZk[FK*cpZ6'FPNKSYQ5-qJ@`,BY)T#!!Mc-j"(c00Pm6C8Y)
QX!"4JY4@U'24fe3ab0aU-aK66hCq-FQR[h3-,RTYJVFRrVp91*[8dpf95rTTYVb
qmfLAKGB[eE48N!#kaS'#2*kTY("&22h1j+lL0T&NVIUTa1G9Y)Rlm)iGf'6pTqB
[NijSSSUFe8iQirE+(Gi,!,@!,!&GYJVFRrVp91*[8dpf95rTTYVbqmfLAKGB[rk
UF659,`[X`!#3$E5rqd"4JY4&ED@%2%$NjfUPDh!#T0K&UF9LQ2%h65+QdX)H)&i
RfUPED@%2%(H*I*U)`*Q)8ZdLBfljGhF31h05Dk``l1X-5r@'*Cb"-8kQdX)H)*k
VfUR5h!PF5c%a+E51P0)UE5`KiJ!R#Xkh9F4Y,j0!!*!)5Sk5C"B"D`"B!VK+@9R
3!cbZ,-Ur%`1M*26`!c[c0aJ!!2b('!%J"QAi8%9ZC(3a!!!:

korn@cory.Berkeley.EDU (Peter "Arrgh" Korn) (08/24/87)

In <225@dbase.UUCP>, drc@dbase.UUCP (Dennis Cohen) posted:  
>
>...[the binhexed source code to an assembly prog. to launch other 
>    programs through a bit of aliasing]...
>
>Obviously, the application to which you're aliasing should be able to open the
>document that you're passing it.  Word is stupid that way, it can open a
>MacWrite document but can't open it at launch -- MindWrite can.

I'd been thinking about the problem for a bit myself, and just a few days
before Dennis kindly posted his program, I wrote my own (somehow I think
I'm not alone either...).  In any case, mine has no problem with having
MacWrite documents launch MS-Word w/the document automagically opened.
Simply using the LightSpeed C chain function works marvelously.  The
souce code is small, and is included below.  A packit-ed binhex-ed file
containing both the source code and the compiled program (as not all 
compilers allow in-line assembly, or support _Chain as a call-able function)
has been sent to the moderator of comp.binaries.mac.

Please note, my program (engaging in a little bit of one-ups-manship)
can be easily modified by the non-programming user simply by editing
resource 'str ' #128--replacing the string that's there with the name
(and HFS path) of the program to be executed instead of MacWrite.

To make the program complete, one would want to check to make sure that
the string supplied is a valid path to the MacWrite replacing program,
and display a dialog box if not.


-----(the code)-----

/*
  This is a little ditty that will pretend it's MacWrite, and will get
  launched by double-clicking on a MacWrite document.  It will then
  launch whatever program is names in resource 'str ' #128, and pass to
  that program all the FinderInfo that was passed to this program.
  This program *has* to be in the same directory as the one that 
  is named in resource 'str ' #128; -or- that resource string *has*
  to specify a full HFS path to the program to be launched.  Got it?

  Written by:  Peter Korn        korn@ucbvax.berkeley.edu          !ucbvax!korn
	
*/


/*	includes	*/

#include	<MacTypes.h>
#include	<ToolboxUtil.h>
#include	<FileMgr.h>

/*	defines		*/

#define	LAUNCHSTRING	128

main()
{
	StringHandle	launchTo;
	
	launchTo = GetString(LAUNCHSTRING);
	Chain(0, *launchTo);
}

-----(end code)-----

Peter
--
Peter "Arrgh" Korn
korn@ucbvax.Berkeley.EDU
{decvax,dual,hplabs,sdcsvax,ulysses}!ucbvax!korn