macdonald@author.dec.com (QRZ de Paul WA1OMM -- 223-3439) (12/28/86)
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. (CLOCK give 12 hour format while CLOCK LONG gives 24 hour format) Is there a way to execute the second option with the qualifier from an icon? Thanks. Paul MacDonald
carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner) (12/30/86)
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 <exec/types.h> #include <workbench/workbench.h> #include <workbench/icon.h> #include <workbench/startup.h> 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 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=