home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / FileMover / Dopus5 / DC-OP55B.LZX / Opus5 / storage / Modules / IntelOutside.dopus5 < prev    next >
Encoding:
Text File  |  1996-07-01  |  3.6 KB  |  127 lines

  1. /* IntelOutside for Directory Opus 5.5
  2.    by Leo 'Nudel' Davidson for Gods'Gift Utilities
  3.    email: leo.davidson@keble.oxford.ac.uk  www: http://users.ox.ac.uk/~kebl0364
  4.  
  5. $VER: IntelOutside.dopus5 1.4 (1.7.96)
  6.  
  7.    Adds an icon to your Opus screen. Supports close and snapshot (writes
  8.    snapshot information to the filecomment of the icon -- don't snapshot
  9.    if you want to keep the comment).
  10.  
  11.    What's the point? I wanted to have a nice, transparent "Intel Outside"
  12.    icon on my bench and didn't want the little left-out arrow in the
  13.    corner spoiling it. You should fine 1:1 and 1:2 aspect Intel Outside
  14.    icons somewhere with this script (put them in DOpus5:Icons if they
  15.    are not there already).
  16.  
  17.    Just put this script in DOpus5:Modules to enable it.
  18.  
  19.    Specify your icon below, without ".info" at the end.
  20.  
  21.    If you want the AppIcon to be there from startup set "initstart" below
  22.    to "y". Whether you do or not a command called "OpenIntOut" will be added
  23.    to Opus which can be used to open a new AppIcon at any time. "OpenIntOut"
  24.    takes an optional argument which specifies the name of a different icon
  25.    to use, without ".info" at the end.
  26.  
  27. //---------------------------------------------------------------------------*/
  28. iconname  = "DOpus5:Icons/IntelOutsideEmboss"
  29. initstart = y
  30. /*---------------------------------------------------------------------------*/
  31.  
  32. options results
  33. options failat 11
  34. parse arg DOpusPort function source dest arguments
  35.  
  36. If (function~='init' & function~="OpenIntOut") then exit
  37.  
  38. Address value DOpusPort
  39.  
  40. If ~Show('L','rexxsupport.library') then
  41.     call addlib('rexxsupport.library',0,-30,0)
  42.  
  43. /* add restart command (for restart after closing the icon) - quit after that if initstart off */
  44. if function = 'init' then do
  45.     dopus command "OpenIntOut" program "IntelOutside" desc "'(Re)open IntelOutside AppIcon'" template "ICON/K"
  46.     if left(Upper(initstart),1) ~= "Y" then exit
  47.     end
  48.  
  49.  
  50. If (function="OpenIntOut" & arguments~="") then do
  51.     iconname = arguments
  52.     end
  53.  
  54. /* Get unique name and open a port. */
  55. Call Forbid()
  56.     i = 0
  57.     myportname = "DOIntOutIcon."i
  58.     Do i=0 While Show("P",myportname)
  59.         myportname = "DOIntOutIcon."i
  60.         End
  61.     If ~openport(myportname) then do
  62.         Call Permit()
  63.         dopus request '"IntelOutSide Icon: Could not open message port" OK'
  64.         Exit
  65.         End
  66. Call Permit()
  67.  
  68.  
  69. /* See if there is any snapshot info in the icon's filecomment */
  70. address command "list >PIPE:"myportname" "iconname".info LFORMAT %c"
  71. if open(comfile,"PIPE:"myportname,"R") then do
  72.     comment = readln(comfile)
  73.     close(comfile)
  74.     end
  75.  
  76. If Word(comment,1) = "NudelSnap:" Then do
  77.     comment =   word(comment,2)
  78.     comcom  =  index(comment,",")
  79.     comx    =   left(comment,comcom-1)
  80.     comy    =  right(comment,length(comment) - comcom)
  81.     comment = "POS" comx comy
  82.     End
  83. Else
  84.     comment = ""
  85.  
  86.  
  87. /* add an icon */
  88. dopus addappicon myportname "''" 1 comment info snap close local icon iconname
  89. icon=result
  90.  
  91.  
  92. flag = 0
  93.  
  94. /* loop around */
  95. do while flag = 0
  96.     call waitpkt(myportname)
  97.  
  98.     packet=getpkt(myportname)
  99.     arg0=getarg(packet,0)
  100.     arg1=getarg(packet,1)
  101.     arg2=getarg(packet,2)
  102.     arg3=getarg(packet,3)
  103.     arg4=getarg(packet,4)
  104.  
  105.     call reply(packet,0)
  106.  
  107.     if arg0 = 'close' then flag = 1
  108.     if arg0 = 'removed' then flag = 2
  109.     if (arg0 = 'info' | arg0 = 'doubleclick') then do
  110.         dopus setappicon icon busy on
  111.         dopus request '"IntelOutside for Directory Opus'|| '0a'x ||"by Leo 'Nudel' Davidson"||'" OK|Close'
  112.         If RC = 0 then flag = 1
  113.         dopus setappicon icon busy off
  114.         end
  115.     if arg0 = 'snapshot' then
  116.         address command 'filenote 'iconname'.info "NudelSnap:' arg2'"'
  117.     if arg0 = 'unsnapshot' then
  118.         address command 'filenote 'iconname'.info'
  119.     end
  120.  
  121. /* remove icon */
  122. if flag~=2 then dopus remappicon icon
  123.  
  124. Call closeport(myportname)
  125.  
  126. Exit
  127.