I am struggling to get a hotkey to launch a form in MES. So far I managed to cobble together some code from a variety of threads on this site as well as some C# threads.
I would like to launch the Start Activity form. That button is already on MES, but I don’t know how to call that button/process directly so I added the Start Activity DLL file to Menu Maintenance with ID SSSM9999, and I am trying to call it with this code:
I learned a little more about KeyDown, KeyUp, and KeyPress, and have since changed KeyDown to KeyPress since it makes more sense for what I want (form fires when “J” key is pressed).
public class Script
{
public void InitializeCustomCode()
{
Erp.Menu.Mes.MESMenu mainPanel1 = MESMenu;
mainPanel1.KeyPress += new KeyPressEventHandler(mainPanel1_KeyPress)
}
private void MESMenu_Load(object sender, EventArgs args)
{
mainPanel1.KeyPreview = true;
}
private void mainPanel1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)106)
{
MessageBox.Show("Success!");
ProcessCaller.LaunchForm(this.oTrans, "SSSM9999");
}
}
I am getting this error when I compile: “Error: CS1061 - line 119 (1624) - ‘Ice.Lib.Framework.EpiPanel’ does not contain a definition for ‘KeyPreview’ and no extension method ‘KeyPreview’ accepting a first argument of type ‘Ice.Lib.Framework.EpiPanel’ could be found (are you missing a using directive or an assembly reference?)”
@fredmeissner would you be available to discuss this MES customization script & Start Production Activity barcode script offline? Please let me know. Very interested in accomplishing same but need a little guidance.