Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!cbmvax!carolyn From: carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner) Newsgroups: comp.sys.amiga Subject: Re: WorkBench -- How to get a Tool to run along with an optional qualifier Message-ID: <1195@cbmvax.cbmvax.cbm.UUCP> Date: Mon, 29-Dec-86 18:59:38 EST Article-I.D.: cbmvax.1195 Posted: Mon Dec 29 18:59:38 1986 Date-Received: Wed, 31-Dec-86 22:43:38 EST References: <7207@decwrl.DEC.COM> Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner) Organization: Commodore Technology, West Chester, PA Lines: 92 In article <7207@decwrl.DEC.COM> macdonald@author.dec.com (QRZ de Paul WA1OMM -- 223-3439) writes: > >I have a program that I wish to run from Workbench using a Tool icon. >The program happens to have a few qualifiers: > > CLOCK Selecting the icon runs the program okay > > CLOCK LONG This is how I would like to run it > from Workbench. Right now I can only > do this from CLI There are at least two ways to do this. If you did NOT write the CLOCK program and it only looks for CLI args, then you can use one of the Fish Disk programs (Xicon or WBRun) to execute a script file from a WorkBench icon. Your script file would contain: CLOCK LONG If YOU wrote the program, you can modify it so it reads the ToolTypes from the .info file if started from WorkBench. You could then use a Project icon with Default Tool being the CLOCK program and ToolTypes being something like FLAGS=LONG. The code (with Lattice C) would be something like this: ------------------------------------------------------------------ #include#include #include #include extern struct WBStartup *WBenchMsg; BOOL FromWB, LongMode; ULONG IconBase; main(argc,argv) int argc; char **argv; { FromWB = (argc==0) ? TRUE : FALSE; LongMode = FALSE; if(argc>1) /* passed argument (flag) via CLI */ { /* Check CLI arg and set LongMode = TRUE if arg is "LONG" */ } else if(FromWB) { checkToolTypes(WBenchMsg); } /* rest of program */ } checkToolTypes(wbMsg) struct WBStartup wbMsg; { struct WBArg *wbArg; char **toolArray; char *string; struct DiskObject *diskObj; if(IconBase = OpenLibrary("icon.library",0)) { diskObj = (struct DiskObject *)GetDiskObject(wbArg->wa_Name); if(diskObj) { toolArray = diskObj->do_ToolTypes; if(string = FindToolType(toolArray,"FLAGS")) { if(MatchToolValue(string,"long")) { LongMode = TRUE; } } FreeDiskObject(diskObj); } CloseLibrary(IconBase); } } -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carolyn Scheppner -- CBM >>Amiga Technical Support<< UUCP ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=