Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!fernwood!portal!cup.portal.com!Lee_Robert_Willis From: Lee_Robert_Willis@cup.portal.com Newsgroups: comp.sys.amiga Subject: How does SCRIPIT work? (How intercept IntuiMessages?) Message-ID: <33651@cup.portal.com> Date: 8 Sep 90 06:32:29 GMT Organization: The Portal System (TM) Lines: 85 I have a Amiga Guru question: I want to intercept the 'IntuiMessages' that are passed from Intuition to an application (where the "application" is any old pre-compiled Amiga program). TECHNICAL BACKGROUND: Normally, Intuition communicates to applications via to 'MessagePorts' contained in the 'Window' structure. Messages from Intuition are sent to the application via 'Window->UserPort', and those messages are replied to via 'Window->WindowPort'. (See Ugly Text diagram:) ----------------------------------------------------------------------- [Input.Device] Mouse and keyboard events | are fed to Intuition from | the Input device. v Intuition sends msgs +--------[Intuition]<--------+ Intuition reads to the Message Port | | reply from 'UserPort' in the v | 'WindowPort'. App's window. Window->UserPort window->WindowPort Application reads msgs | ^ Application from 'UserPort' | | replies to msgs. +---->[Application program]--+ -------------------------------------------------------------------------- What I want to do is insert a 'middleman' process into this loop. I want to be able to patch a process in that will intercept the messages sent to the application, process them as needed, then pass them on to the application. The 'middleman' should also intercept the replies as well. (See next ugly text diagram) -------------------------------------------------------------------------- Mouse and keyboard events | are fed to Intuition from | the Input device. v Intuition thinks its +--------[Intuition]<--------+ Intuition reads sending to the App., | | reply from but is really sending v | 'WindowPort'. to middleman. [middleman->UserPort] [middleman->WindowPort] Middleman processes | ^ middleman forwards events, then passes v | reply to Intuition. them on to App. [window->UserPort] [window->WindowPort] Application reads msgs | ^ Application thinks from 'UserPort' | | its replying to +---->[Application program]--+ Intuition, but is really replying to middleman. -------------------------------------------------------------------------- (NOTE: It is not necessary that the 'middleman' process be structured exactly as this diagram, as long as it is: * Capable of monitoring IntuiMessages. * Capable of feeding 'false' IntuiMessages to application. * Capable of monitoring replies to IntuiMessages. I know its possible, because the program "ScripIt" by Khalid Aldoseri does it, but for the life of my, I can't figure out how. (Unfortunately, there is no source included with SCRIPIT.) WHY DO I WANT TO DO THIS? I'm trying to create a 'tear-off' menu facility similar to that on the Macintosh. (For those who've never seen it, 'tearing-off' a menu creates a new window which contains all the menu items converted into gadgets. This is very handy for menus that are used all the time. Fr'instance, if a graphic program put its palette on a menu (e.g. IntroCAD), you could 'tear-off' this menu, drag the window to a free screen location, and pick colors from the tear off menu (much more convenient!) and the program reacts as if you had used the real menu. When you no longer need the tear-off menu, close its window.) Assuming the 'middleman' problem'tear-of' can be solved, it should not be too difficult to implement this utility, which should work on ANY existing Amiga program! Send replies to : Lee_Robert_Willis@cup.portal.com __ __ __ __ __ _ __ __ __ __ o The /_ / / /_ / | / /_/ /_| /_ /_ /_/ / /| / / /\O/\ __/ /_/ / / |/|/ / / / \ /_ __/ / / / / |/ / ///^\\\ Software so good, it's a religious experience! |_|