🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #18428

Re: Alias Launchers

#18428
From: Peter "Arrgh" Korn
Date: Mon, 24 Aug 1987 07:20
70 lines
3130 bytes
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
Technical Details
Message-ID: <20268@ucbvax.BERKELEY.EDU>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!sri-spam!ames!ucbcad!ucbvax!cory.Berkeley.EDU!korn
References: <225@dbase.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!sri-spam!ames!ucbcad!ucbvax!cory.Berkeley.EDU!korn
From: korn@cory.Berkeley.EDU (Peter "Arrgh" Korn)
Newsgroups: comp.sys.mac
Subject: Re: Alias Launchers
Message-ID: <20268@ucbvax.BERKELEY.EDU>
Date: Mon, 24-Aug-87 03:20:31 EDT
Article-I.D.: ucbvax.20268
Posted: Mon Aug 24 03:20:31 1987
Date-Received: Tue, 25-Aug-87 01:28:16 EDT
References: <225@dbase.UUCP>
Sender: usenet@ucbvax.BERKELEY.EDU
Reply-To: korn@cory.Berkeley.EDU.UUCP (Peter "Arrgh" Korn)
Organization: What, me organized???
Lines: 70
Keywords: Mac, Launch