The sample below will demonstrate how two GAB scripts can communicate with each other.
This program calls another GAB program, passing the IPM handle in the switches parameter. The program also has an event handler for when a message is received.
Program.Sub.Main.Start v.Local.iPID.Declare(Long) gui.fMain..Show Function.Intrinsic.Control.AddEventHandler("IPMDATAIN",ipmReceived) Function.Global.General.CallAsyncGAS("D:\Projects\GAB\MRP for Miller Welding\Trunk\PPT_MRP_LLC_Gen.gas",v.Ambient.MyIPMh,v.Local.iPID) Program.Sub.Main.End Program.Sub.ipmReceived.Start Function.Intrinsic.UI.Msgbox(v.Args.MESSAGE) Program.Sub.ipmReceived.End
This program is initiated from the other program. It has the calling program's IPM handle as v.caller.switches. So this program uses the IPM function for sending messages to send something back to the other program. When the Calling program receives the message, that's when the event will be triggered. Note that if the message you are sending contains the sequence "*!*", you will need to escape it somehow. Otherwise you will get an error code of 300 "Index out of range" in your IPMDataIn sub.