//------------------------------------------------------------------------------------------------- //dblclick.c - Replaces macro from SPFSE // This macro uses indexes to match keyword with web page or CHM html page (See H3 macro on SPF page) // Requires x.c SPFSE C macro routines (see last line) //Mark McDonald 2008 //------------------------------------------------------------------------------------------------- void DblClick(void) { char *ctype1 = "ASM CS DL6 HTM WBT BAS PBS"; char *ctype1fspecs = " "; char *ctype2 = "HTML HTM REX CMD SPF ISP PBW LBS COB CBL"; //File Extension char *ctype2fspecs = "HTML HTML OOREXX REXXC SPFPRO SPFPRO PBWIN LB COBOL COBOL"; //Corresponding Index.bdx name char *ctype3 = "PHP"; //File Extension char *ctype3fspecs = "PHP"; //Corresponding help.chm name char *cbdxloc = "h:\\u\\mhelp\\"; char *cbdxloc2 = "h:\\u\\mhelp\\"; char *cieloc = "H:\\U\\IE.EXE"; //Where I keep my IE clone char *cindex = ""; char *cfilespec = ""; char *cexnt = ""; int iwrdpos; int itype = 0; int icol; char *iline; char *tcmd = ""; int isp; //--- Get Keyword Location --- icol = spfservice("query","COL_NUMBER"); iline = spfservice("query","LINE_DATA_RAW"); //--- Isolate Keyword --- iline = xgetword(iline,icol); //--- Get filespec exnt --- cfilespec = spfservice("query","FILESPEC"); cexnt = xupper(xfilespec(cfilespec,"E")); //--- Determine Type/Get Index File Name --- if(xwordpos(cexnt, ctype2, 1, " ") != 0){itype = 2;} if(xwordpos(cexnt, ctype3, 1, " ") != 0){itype = 3;} if(itype > 0){ if(itype == 2){iwrdpos = xwordpos(cexnt, ctype2, 1, " "); cindex = xword(ctype2fspecs,iwrdpos," ");} if(itype == 3){iwrdpos = xwordpos(cexnt, ctype3, 1, " "); cindex = xword(ctype3fspecs,iwrdpos," ");} //--- Build Index File Name --- cbdxloc = strcompose(cbdxloc,cindex,".bdx"); iline = xgetmatch(cbdxloc,iline); if(iline != "EOF"){ if(itype == 2){tcmd = strcompose("system NOBATCH NOSTOP ",cieloc," ",xsubstr(iline,xwordindex(iline,2," "),0," "));} if(itype == 3){tcmd = strcompose("system NOBATCH NOSTOP ",cieloc," mk:@MSITStore:",cbdxloc2,xsubstr(iline,xwordindex(iline,2," "),0," "));} if(tcmd != ""){spfservice("cmd",tcmd);} }//endif }//endif }//dblclick char xgetmatch(char *xfile,char *iline){ char *xret = ""; char *xtr = ""; int xhdl; xhdl = fileopen(xfile,"r"); while(xtr != "EOF"){ xtr = filerecread(xhdl, xret); if(xword(xupper(xret),1," ") == xupper(iline)){fileclose(xhdl); return(xret);} }//wend fileclose(xhdl); xret = "EOF"; return(xret); }//xgetmatch #include "x.c"