home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / utilsm / np52 / SIGNAL.OPL < prev    next >
Text File  |  1995-06-06  |  2KB  |  58 lines

  1. /* This example shows how to send an IPC message to Notepad
  2.    The message resides in a temp file called M:\Npmess.000
  3.    Each field in this file carries part of the message for Notepad.
  4.  
  5.         a.mess$  = Filename
  6.         a.typ$   = "O" or "C" (Open or Create)
  7.         a.front$ = Tells Notepad to come to front before acting
  8.  
  9.    There are two types of messages currently supported.
  10.         . Open/Create Notepad file
  11.         . Run Plug-in
  12.  
  13.    When sending an open file message, you must supply the complete filename
  14.    in a.mess$. You must also supply the type byte "O" or "C", for Open or
  15.    Create. Notepad needs to know if it is creating a new notepad, or just
  16.    opening one.
  17.  
  18.    When sending a run Plugin message, just put the name of the plugin in
  19.    a.mess$, without any path, or extension. (like Np2wrd) That's it.
  20.  */
  21.  
  22. Proc signal:
  23. local name$(12),z$(1),sspid%,messtyp%
  24. local fc$(128),ch%,front%,off%(6)
  25.  
  26. z$=chr$(0)
  27. fc$="\note\expand\*.exp"
  28.  
  29. dinit
  30. dtext"","Send a Message to Noteapd",$302
  31. dchoice messtyp%,"Message Type","Open/Create File,Run Plug-In"
  32. dfile fc$,"Filename",1
  33. dchoice ch%,"Choose","Open,Create"
  34. dchoice front%,"Bring Notepad to Foreground","No,Yes"
  35. if dialog =0 :return :endif
  36.  
  37. if messtyp%=2
  38.         fc$=parse$(fc$,"",off%())
  39.         fc$=mid$(fc$,off%(4),off%(5)-off%(4))
  40. endif
  41.  
  42. trap delete "M:\Npmess.000"
  43. create "M:\Npmess.000",a,mess$,typ$,front$
  44.  
  45. front%=front%-1         rem (zero = false) (1 = true)
  46.  
  47. if ch%=1 :a.typ$="O" :else a.typ$="C" :endif
  48. a.mess$=fc$ :a.front$=fix$(front%,0,2)
  49. append :close
  50.  
  51. name$="notepad.*"+z$
  52. sspid%=call($0188,addr(name$)+1,0,0,0,0)
  53. if call($8c8d,sspid%)>=0
  54.     call($92,sspid%,2,0,addr(messtyp%),$28)   rem ProcCopyToById
  55.     call($0986,sspid%)                        rem IoSignalByPid
  56. endif
  57. Endp
  58.