/* TinyHelp.zp 2.0 (6.2.94) by Ueli Kaufmann ARexx Skript für Zodiac's Point Zweck: ------ Zeigt eine Uebersicht der zur Zeit installierten ARexx-Skripten und bietet die Moeglichkeit, sie per Mausklick zu starten.. Hinweis: -------- - benoetigt die apig.library v3.3 von fish 634. Installation: ------------- Ins fkeys.zp einbinden mit folgender Zeile: F10:SYS:Rexxc/RX ZPOINT:Rexx/TinyHelp.zp %s */ parse arg zpPort address value zpPort /* benoetigte Libraries laden */ if(~show('l',"rexxsupport.library")) then x = addlib("rexxsupport.library",0,-30,0) if(~show('l',"apig.library")) then x = addlib("apig.library",0,-30,0) /* apig vorbereiten */ call Set_APIG_Globals() screen = LockPubScreen("ZPoint") /* gonna put our window */ /* upon ZPoint screen */ scrvinfo = GetVisualInfo(screen) /* NewGadgets need this */ scrfont = GETVALUE(screen,40,4,'p') /* NewGadgets need this */ /* points to TextAttr */ glist = AllocVec(4,MEMF_CLEAR) /* a pointer for context */ conxgad = CreateContext(glist) prevGadget = conxgad /* Adressen Listview-Gadget */ newgadx = MakeNewGadget(scrvinfo,scrfont,8,16,508,120,null(), ,null(),1,null()) if newgadx == null() then exit(0) rxList = build_rx_list() prevGadget = CreateGadget(LISTVIEW_KIND,prevGadget,newgadx, ,GTLV_Labels, rxList, ,TAG_DONE,0) /****************************/ call FreeThis(newgadx) /* NewGadget-Struktur Speicher freigeben */ window = open_window() if window = null() then do REQUESTNOTIFY "Requester konnte nicht geöffnet werden.." exit(10) end OPTIONS FAILAT 6 /* ignore warnings */ SIGNAL ON SYNTAX /* ensure clean exit */ exitme = 0 do while exitme = 0 x = waitpkt(portname) do forever msg = getpkt(portname) if msg = '0000 0000'x then leave msgclass = getarg(msg,0) msgcode = getarg(msg,1) msggadadr= getarg(msg,8) msggadid = getarg(msg,9) x = reply(msg,0) select when msgclass = CLOSEWINDOW then /* Close-Gadget */ do exitme = 1 end when msgclass = NEWSIZE then /* Zoom-Gadget */ do zoomed = (zoomed = 0) if zoomed == 0 then /* Gadgets refreshen */ call GT_RefreshWindow(window) end when msgclass = GADGETUP then /* Gadget-UP */ do if msggadid = 1 then do dummy = msgcode + 1 fnode = rxList do x = 1 to dummy fnode = next(fnode) end theCmd = GETVALUE(fnode,10,4,'s') /* F-Taste rausschneiden */ cpos = pos(':',theCmd) if cpos ~= 0 then theCmd = delstr(theCmd, 1, cpos) cpos = pos('%s',theCmd) /* ZP-Port anhängen */ if cpos ~= 0 then do theCmd = delstr(theCmd, cpos) theCmd = theCmd || zpPort end address command theCmd end end otherwise nop end end end /**********************************/ SYNTAX: dummy = close_window() call FreeVisualInfo(scrvinfo) call FREE_EXEC_LIST(rxList) exit(0) /*****************************************************************/ open_window: wintitle = "ZP's little helper" winidcmp = CLOSEWINDOW+NEWSIZE+LISTVIEWIDCMP winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH+ACTIVATE portname = "ZPOINT_HELP" p = openport(portname) myTitle = 0 tagList = 0 window = 0 zoomed = 0 if build_zoom_array() | build_window_name() then do tagList = AllocateTagItems(13) if tagList ~= null() then do call SetTagSlot(tagList,0,WA_LEFT,'n',114) call SetTagSlot(tagList,1,WA_TOP,'n',2) call SetTagSlot(tagList,2,WA_WIDTH,'n',524) call SetTagSlot(tagList,3,WA_HEIGHT,'n',138) call SetTagSlot(tagList,4,WA_DRAGBAR,'n',1) call SetTagSlot(tagList,5,WA_CLOSEGADGET,'n',1) call SetTagSlot(tagList,6,WA_ACTIVATE,'n',1) call SetTagSlot(tagList,7,WA_TITLE,'p',myTitle) call SetTagSlot(tagList,8,WA_FLAGS,'n',winflags) call SetTagSlot(tagList,9,WA_ZOOM,'p',zoomArray) call SetTagSlot(tagList,10,WA_IDCMP,'n',winidcmp) call SetTagSlot(tagList,11,WA_CUSTOMSCREEN,'p',screen) call SetTagSlot(tagList,12,TAG_DONE,'n',0) window = OpenWindowTagList(portname,null(),tagList) if window ~= null() then do call AddGList(window, conxgad, -1, -1, null()); call RefreshGList(conxgad, window, null(), -1); call GT_RefreshWindow(window) end end end call UnlockPubScreen(null(),screen) return(window) close_window: if conxgad ~= null() then do if window ~= null() then call RemoveGList(window, conxgad, -1) call FreeGadgets(conxgad) drop conxgad end if glist ~= null() then do call FreeVec(glist) drop glist end if window ~= null() then do call CloseWindow(window) drop window end if tagList ~= null() then do call FreeTagItems(tagList) drop tagList end if myTitle ~= null() then do call FreeVec(myTitle) drop myTitle end if zoomArray ~= null() then do call FreeVec(zoomArray) drop zoomArray end return(0) /*****************************************************************/ build_rx_list: mylist = AllocMem(14,MEMF_CLEAR) /* our list structure */ /* always use ALLOCMEM */ /* so it can be freed */ /* properly. */ call NewList(mylist) if ~open('infile',"zpoint:fkeys.zp",read) then do REQUESTNOTIFY "fkeys.zp kann nicht geoeffnet werden.." exit(0) end instring = '' do forever instring=readln('infile') dummy = ADD_LIST_NODE(mylist,instring) if eof('infile') then leave end dummy = close('infile') return mylist /*****************************************************************/ build_zoom_array: zoomArray = AllocVec(16,MEMF_CLEAR) if zoomArray ~= null() then do call export(zoomArray,'019f'x || '0011'x || '00e0'x || '000d'x) return(1) end return(0) /*****************************************************************/ build_window_name: myTitle = AllocVec(length(wintitle)+1,MEMF_CLEAR) if myTitle ~= null() then do call export(myTitle,wintitle) return(1) end return(0) /*****************************************************************/