/* REXX script */ trace 'o' Installfolder = '' DefaultIWFProject = '' Executable = 'eftedde.exe' rc = rxfuncadd('SysLoadFuncs','REXXUTIL','SysLoadFuncs') rc = SysLoadFuncs() /* for some odd reason, registering the IWFPAPI REXX functions needs to be done twice on the first run of this REXX script because the first invocation will always fail ... */ rc = rxfuncadd('IwfEnvPrfLoadFuncs','IWFPAPI','IwfRxEnvPrfLoadFuncs') rc = rxfuncadd('IwfEnvPrfLoadFuncs','IWFPAPI','IwfRxEnvPrfLoadFuncs') if rc <> 1 then do say 'IWF not installed, aborting ...' return 1 end rc = SysOpenObject(DefaultIWFProject,0,0) if rc <> 1 then do say 'Cannot find IWF default project, aborting ...' return 1 end rc = SysOpenObject(Installfolder,0,0) if rc <> 1 then do say 'Cannot find eFTE installation, aborting ...' return 1 end EftePath = SysSearchPath('PATH','eftepm.exe') if EftePath = '' then do say 'eFTE Executable cannot be found, aborting ...' return 1 end TargetPath = strip(filespec('D',EftePath)||filespec('P',EftePath),'T','\') '@copy 'Executable' 'TargetPath rc = SysCreateObject('WPProgram','eFTEPM/2 IWF DDE daemon','','OBJECTID=;EXENAME='TargetPath'\'Executable,'R') rc = IwfEnvPrfLoadFuncs() drop stem. stem.pszProject = DefaultIWFProject stem.pszActionClass = 'Edit' stem.pszActionName = 'EFTE' stem.pszDeleteAny = 'TRUE' /* to be on the safe side, delete the action if it already exists */ rc = IwfDestroyAction(stem) stem.pszCommand = Executable stem.pszSrcMask = 'Editable' stem.pszTgtMask = ' ' stem.pszucActionScope = 'Both' /*stem.pszOwningPrj = 'IWFBPAM'*/ stem.pszPam = 'IWFBPAM' stem.pszucRunMode = 'Default' stem.pszucAccelKey = 'E' stem.pszDllName = 'IWFOPT' stem.pszDllEntryName = 'EDIT' stem.pszPriority = 75 stem.pszfPrjMenu = 'True' stem.pszfOptMenu = 'False' stem.pszfTBMenu = 'True' /* (re)create the action in the default IWF project */ rc = IwfAddAction(stem) stem.pszfProjectScope = 'False' stem.pszpOptionData = BuildEditFileOptions('%a %z',0,1) stem.pszulOptionSize = length(stem.pszpOptionData) /* requires: stem.pszulOptionSize stem.pszpOptionData */ /* set the file scoped options so that user is ready to go */ rc = IwfSetOption(stem) return 0 /* Info: file scoped settings: offset 0x0: length of complete option string as a ULONG value offet 0x4: String "TMF" with terminating zero offset 0x8: 0x1 = command line, 0x2 = pass error via DDE to editor offset 0x10: length of parameter string including terminating zero offset 0x1C: start of parameter string */ BuildEditFileOptions: procedure paramstring = arg(1) if (arg(2) > 0) then openCmdLine = '00000001'x else openCmdLine = '00000000'x if (arg(3) > 0) then passToEditor = '00000002'x else passToEditor = '00000000'x configBits = bitor('00000000'x,openCmdLine) configBits = bitor(configBits,passToEditor) string = '00000000'x||'TMF'||'00'x||reverse(configBits)||'00000000'x||'00000000'x||'00000000'x||'00000000'x||paramstring||'00'x paramlen = length(paramstring)+1 totlen = length(string) string = overlay(reverse(d2c(totlen,4)),string,1,4) string = overlay(reverse(d2c(paramlen,4)),string,17,4) return string