Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: TimGS on June 03, 2015, 07:52:53 PM

Title: No Script Engine Found for ...
Post by: TimGS on June 03, 2015, 07:52:53 PM
Just tried to edit a script from Mach4 and got an error "No Script Engine Found for "PATH/filename.mcs"

Can someone tell me what I am doing wrong?
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 03, 2015, 07:55:20 PM
wrong path name what it was looking for was not there as in the path to what ever script you where editing
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 03, 2015, 08:07:15 PM
I just selected a macro from the macro directory
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 03, 2015, 08:08:43 PM
c:\Mach4Hobby\Profiles\Mach4Mill\Macros\m3.mcc
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 03, 2015, 08:11:53 PM
you know the m3, 4, 5 macros are there as examples when you run a G code it courses the spindle to not turn on you can get ride of those one`s

Title: Re: No Script Engine Found for ...
Post by: Screwie Louie on June 03, 2015, 08:16:17 PM
just delete it and write your own M3 macro, lol. haha. // you know you probably will anyways. hehe
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 03, 2015, 08:18:40 PM
I was just playing around and ran into this error :(
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 03, 2015, 08:27:44 PM
daniellyall... just sent an email to you from my bearboy53154@yahoo.com account
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 03, 2015, 09:27:53 PM
that looking relay good that thing with stopping things working when you don't wont them to work I think you may just have to play with the codes or add to whats there now at the moment I don't need to do stuff like that but I might play anyway since what I needed I have finished to a point where they work
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 03, 2015, 09:38:53 PM
I just need to get them into Mach4 displays
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 03, 2015, 09:41:39 PM
have you had a look at what poppabear did with the joystick progect this one http://www.machsupport.com/forum/index.php/topic,28149.0.html that may help
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 03, 2015, 09:46:33 PM
I can't get his screens to work on my machine :(
Title: Re: No Script Engine Found for ...
Post by: patton on June 03, 2015, 10:26:05 PM
c:\Mach4Hobby\Profiles\Mach4Mill\Macros\m3.mcc

you have the .mcc file here in your post..... it has to be the .mcs file I beleive.
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 03, 2015, 10:28:59 PM
I tried both... it didn't matter...same error...
...Thank you for your help...sometimes it is easy to miss the most obvious things when you work all day and play late into the night ;)
...I wish it was that easy :D
Title: Re: No Script Engine Found for ...
Post by: smurph on June 03, 2015, 11:01:08 PM
Enable the mcLua plugin. 

Steve
Title: Re: No Script Engine Found for ...
Post by: patton on June 03, 2015, 11:02:24 PM
yeah kinda figured that was a typo or something. do ya get the error with all scripts? maybe a corrupted file with the editor?
not sure if the lua plugin has anything to do with the editor. just tryin to throw some ideas out.
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 03, 2015, 11:54:22 PM
It is the address for the images it is wrong it cant find them

local imagepathBMP =  Path .. "\\Wizards\\images\\";--Path to your Picture with name and extension

you put your script in wizards and double click on it will start with a error log showing it can`t find any of the images it does it anywhere in M4 file system
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 04, 2015, 07:52:45 AM
smurph.... "DOE!!!!!"   .... I will have to check that when I get home... VERY POSSIBLE... just reloaded a couple of days ago.  Thank You

Danielyall....  That's what I meant by you may encounter a Path problem....  From what I can see when running the LuaEditor.exe manually the "PATH..\" is relative to the directory where the LuaEditor.exe  was executed from.  If you run my script from a ..\Mach4\LuaEditor.exe copy the script into the ..\Mach4\Wizards folder and the images into the ..\Mach4\Wizards\images folder.  Execute the LuaEditor.exe in the ..\Mach4 folder and File>Open the script that you just copied to the ..\Mach4\Wizards folder.  Everything should work.

If you just copy the whole zipped folder to a folder, a name of your choosing (..\"YourFolderName") , including the LuaEditor.exe (included in the .zip) then execute the LuaEditor.exe in the ..\"YourFolderName" folder and File>Open the script in the ..\"YourFolderName"\Wizards folder, everything should work too.

This is a standalone script that does not require Mach4....at the moment :D
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 04, 2015, 07:55:39 AM
I got it working in wizards just had to change this bit local Path = "..\\Mach4Hobby" I stuck it in a lua panel in a screen set did not work but it would be good to use as a fly out tyed to a button like the one M3 has,

I think the first part has to be what place in the system the pics are

I put it in wizards what is in Mach4Hobby so I have it like this

local Path = mc.mcCntlGetCwd(inst); --Get Mach4's directory
    local Path = "..\\Mach4Hobby"
    local imagepathBMP =  Path .. "\\Wizards\\images\\";--Path to your Picture with name and extension

also for fun I put it on desktop and the path is

local Path = mc.mcCntlGetCwd(inst); --Get Mach4's directory
    local Path = "..\\Wizards"
    local imagepathBMP =  Path .. "\\images\\";--Path to your Picture with name and extension


if you look at how poppabear did his joystick progect it will show you what to do to get it working in a screen set and how to tye it to inputs,  you have done a good job with it
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 04, 2015, 07:57:48 AM
I looked again last night and still could not find Poppa Bear's code....Where exactly should I look???
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 04, 2015, 07:59:49 AM
...Yes the code was written as a Flyout...it has its own frame.   I could modify it for a panel...I just need to figure out how to put the code where it needs to be ???
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 04, 2015, 08:08:49 AM
tool box / joystick project example is done
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 04, 2015, 08:16:08 AM
I tried that exact project from the toolbox on Tuesday...I could not execute that example...let alone see where they place the panel code.
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 04, 2015, 08:20:00 AM
you have to put all bits in the correct spot the code is tyed into the screen set if you still cant get at the codes I will pull them out and send them to you and where i got them from
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 04, 2015, 08:23:39 AM
this is poppabears code from the lua panel
Code: [Select]
------------------------Header Section---------------------------------------
-- Name:        JoyStick Status Bitmap display
-- Author:      S Shafer
-- Modified by:
-- Created:     10/13/2014
-- Copyright:   (c) 2014 S S Systems, LLC, can be freely used, modified, or
-- derived from as long as this header section remains.
-- Licence:     BSD license
-- File Name: (luapanel embedded script, NO FRAME)
------------------------Header Section----------------------------------------

local panel = nil
local m_id = 0
local mInst = 0; --Mach4 instance number
local inst = mc.mcGetInstance(mInst);
local gtimer1 = 0;
local BitMapPanel = 0;
local picToUse = 0;
local KeyPressed = "";
local window = 0;

function GetNextID()
    m_id = m_id+1;
    return m_id;
end

function TimerTick()
    BitMapPanel:Refresh();
end

---the ID and its call to GetNextID has been moved to where the control is made.                          
function main()
    panel = mcLuaPanelParent;
    local window = panel:GetParent();
    window:SetBackgroundColour(wx.wxColour(230, 230, 230));
    --use the same color bg as the panel sits on in screen designer
    window:SetWindowStyleFlag(wx.wxBORDER_NONE);--removes sunken border of lua panel
    window:ClearBackground();
    window:Refresh();
    local wsize = window:GetSize();
    panel:SetSize(wsize);
    gtimer1 = wx.wxTimer(panel);--start a timer to poll IO changes
    panel:Connect(wx.wxEVT_TIMER, TimerTick);
    gtimer1:Start(200); -- set poll rate to 1/5th a second        
    panel:Connect(wx.wxEVT_CLOSE_WINDOW,
        function (event)        
            gtimer1:Stop();                
            event:Skip();
        end);
        
    mainSizer = wx.wxBoxSizer(wx.wxVERTICAL);
    GridSizer  = wx.wxFlexGridSizer( 2, 1, 0, 0 );--2 rows, 1 column, no x/y spacing between  

local Path = mc.mcCntlGetCwd(inst); --Get Mach4's directory          
    local imagePathJoyCT =  Path .. "\\Wizards\\JoyStickResources\\JoyCenter.bmp";
local imagePathJoyDN =  Path .. "\\Wizards\\JoyStickResources\\JoyDown.bmp";
local imagePathJoyLT =  Path .. "\\Wizards\\JoyStickResources\\JoyLeft.bmp";
local imagePathJoyRT =  Path .. "\\Wizards\\JoyStickResources\\JoyRight.bmp";
local imagePathJoyUP =  Path .. "\\Wizards\\JoyStickResources\\JoyUp.bmp";

imageCT = wx.wxImage();
imageCT:LoadFile(imagePathJoyCT, wx.wxBITMAP_TYPE_BMP);
    JoyBmpCT = wx.wxBitmap(imageCT);
wsizeCT = wx.wxSize(JoyBmpCT:GetWidth(), JoyBmpCT:GetHeight());

imageDN = wx.wxImage();
imageDN:LoadFile(imagePathJoyDN, wx.wxBITMAP_TYPE_BMP);
    JoyBmpDN = wx.wxBitmap(imageDN);
wsizeDN = wx.wxSize(JoyBmpDN:GetWidth(), JoyBmpDN:GetHeight());

imageLT = wx.wxImage();
imageLT:LoadFile(imagePathJoyLT, wx.wxBITMAP_TYPE_BMP);
    JoyBmpLT = wx.wxBitmap(imageLT);
wsizeLT = wx.wxSize(JoyBmpLT:GetWidth(), JoyBmpLT:GetHeight());

imageRT = wx.wxImage();
imageRT:LoadFile(imagePathJoyRT, wx.wxBITMAP_TYPE_BMP);
    JoyBmpRT = wx.wxBitmap(imageRT);
wsizeRT = wx.wxSize(JoyBmpRT:GetWidth(), JoyBmpRT:GetHeight());
  
imageUP = wx.wxImage();
imageUP:LoadFile(imagePathJoyUP, wx.wxBITMAP_TYPE_BMP);
    JoyBmpUP = wx.wxBitmap(imageUP);
wsizeUP = wx.wxSize(JoyBmpUP:GetWidth(), JoyBmpUP:GetHeight());  

    BITMAPPANEL1_ID = GetNextID ();
    BitMapPanel = wx.wxPanel (  panel,
                                BITMAPPANEL1_ID,
                                wx.wxDefaultPosition,
                                panel:GetSize(),
                                wx.wxWANTS_CHARS,'');

    GridSizer:Add(BitMapPanel, 0, wx.wxALIGN_LEFT+wx.wxALL, 2);
    mainSizer:Add(GridSizer, 0, wx.wxALIGN_LEFT+wx.wxALL,2);
    panel:SetSizer(mainSizer);

    picToUse = JoyBmpCT;    
    BitMapPanel:SetFocus();    
    scr.SetProperty('DebugTB', 'Label', '');

    BitMapPanel:Connect(wx.wxEVT_PAINT,
                         function (event)
                            local mInst = 0;
                            local rc = 0; local X = 0; local Y = 1; local DirP = 1; DirN = -1;
                            local iSigVal1 = 0;local iSigVal2 = 0;local iSigVal3 = 0;local iSigVal4 = 0;
                            local hsig1 = 0;local hsig2 = 0;local hsig3 = 0;local hsig4 = 0;                            
                            local inst = mc.mcGetInstance(mInst);
                            hsig1, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT1);--LT X-
                            iSigVal1 = mc.mcSignalGetState(hsig1);
                            hsig2, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT2);--RT X+
                            iSigVal2 = mc.mcSignalGetState(hsig2);
                            hsig3, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT3);--UP Y+
                            iSigVal3 = mc.mcSignalGetState(hsig3);
                            hsig4, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT4);--DN Y-
                            iSigVal4 = mc.mcSignalGetState(hsig4);                            
                            if iSigVal1 == 1 then
                                picToUse = JoyBmpLT;--LT X-
                                mc.mcJogVelocityStart(inst, X, DirN);
                                scr.SetProperty('DebugTB', 'Label', 'input1 Active');
                                end
                            if iSigVal2 == 1 then
                                picToUse = JoyBmpRT;--RT X+
                                mc.mcJogVelocityStart(inst, X, DirP);
                                scr.SetProperty('DebugTB', 'Label', 'input2 Active');
                                end
                            if iSigVal3 == 1 then
                                picToUse = JoyBmpUP;
                                mc.mcJogVelocityStart(inst, Y, DirP); --UP Y+                            
                                scr.SetProperty('DebugTB', 'Label', 'input3 Active');
                            end  
                            if iSigVal4 == 1 then
                                picToUse = JoyBmpDN;--DN Y-
                                mc.mcJogVelocityStart(inst, Y, DirN);
                                scr.SetProperty('DebugTB', 'Label', 'input4 Active');
                            end
                            if iSigVal1 == 0 and iSigVal2 == 0 and iSigVal3 == 0 and iSigVal4 == 0 then
                                picToUse = JoyBmpCT;
                                local IsBtnJog = scr.GetProperty('btnJogLED', 'Value');
                                local val = tonumber(IsBtnJog);
                                if val == 0 then
                                    mc.mcJogVelocityStop(inst, X);
                                    mc.mcJogVelocityStop(inst, Y);
                                end
                                scr.SetProperty('DebugTB', 'Label', '');
                            end
                            local dc = wx.wxPaintDC(BitMapPanel);                            
                            dc:DrawBitmap(picToUse, 0,0, true);
                            dc:delete ();
                         end);
    panel:Fit();
    local window = panel:GetParent();
    window:Connect(wx.wxID_ANY, wx.wxEVT_SIZE,
                        function(event)
                            local wsize = event:GetSize();
                            panel:SetSize(wsize);
                            panel:FitInside();            
                        end);
end
main();
wx.wxGetApp():MainLoop();

 
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 04, 2015, 08:31:03 AM
What is the correct spot?  ...Screen Edit...Screen Load script?????
Title: Re: No Script Engine Found for ...
Post by: DazTheGas on June 04, 2015, 09:06:04 AM
add a lua panel within the editor.

DazTheGas
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 04, 2015, 05:40:46 PM
when you open poppabears file all the files you open and place them in the same place in mach4 so profile you put inside profile in M4 not the file named profile whats in the folder

so the folder plugins you open it and get the files out and put them in c\M4\plugins folder, same for the other 3 you don't place any code anywhere its all there already
Title: Re: No Script Engine Found for ...
Post by: dude1 on June 04, 2015, 05:42:10 PM
if still not sure just say and I will do some screen shots for you
Title: Re: No Script Engine Found for ...
Post by: TimGS on June 04, 2015, 07:57:32 PM
No Script Engine Found for ...  SOLVED  ;D

Thank You Steve!!!!!

I opened Mach Plugins and did not even see Lua.....  I was missing "mcLua.m4pw" .... I have know idea how or why....but my problem is solved!!!
Title: Re: No Script Engine Found for ...
Post by: Osker on May 17, 2018, 07:37:29 PM
I am getting the "No Script Engine Found" error.  From the operator tab I select the edit scripts option.  It takes me to the profile's macro folder.  Since this is the first script in the new profile's folder, the folder is empty and the editor does not open.  That prevents me from being able to create a new script. My solution was to copy a script from the Mach4Mill profile into the new profile, expecting the script editor to open; allowing me to create a new script.  Instead, I get the "No Script Engine Found" error and no opportunity to create a new script.


Any suggestions for how to properly create a new script would be appreciated.

Regards,

Dan

Title: Re: No Script Engine Found for ...
Post by: joeaverage on May 17, 2018, 07:45:31 PM
Hi,
just confirm that the Lua plugin is enabled. In early builds Configure/Mach/Plugins in the most recent
Configure/Control/Plugins.

Craig
Title: Re: No Script Engine Found for ...
Post by: Osker on May 18, 2018, 11:03:03 AM
Craig,

You nailed it!  The Lua plugin is now enabled and working. 

Thanks,

Dan
Title: Re: No Script Engine Found for ...
Post by: joeaverage on May 18, 2018, 06:42:03 PM
Hi Dan,
just as a matter of interest what build of Mach are you running?

I downloaded 3756 which was a development version at the  time but it has the new Zero Brane editor and is a very good step up from the previous Lua editor.
Amongst other things you can launch it without actually having any macros or whatever for it to act on. It has a navigation panel so you can scan around within Machs
directory to find what you want. This makes it possible to have say a macro that you are working on to go in your own profile but have an example macro from
the Examples folder and screen scripts, ie not macros at all, ALL open and available on the desktop as separate tabs, each editable and can be run in debug mode
with much increased facilities compared to previously.

Byranna has just released a video on it.

Craig
Title: Re: No Script Engine Found for ...
Post by: Osker on May 18, 2018, 07:11:55 PM
Craig,

I am running MACH4 Hobby Ver. 4.2.0.3481 Build 3481.  I just downloaded Ver 4.2.0.3804 and will install it tomorrow.  Thanks for the heads up.  Since I am still transitioning from MACH3, I had rather be learning the most current version.

Today's big accomplishment was scripting a very simple M6 for manual tool changing.  DazTheGas's videos were very helpful, although I only need to pause and display a "Change Tool and Press Cycle Start" message.


Dan

Dan
Title: Re: No Script Engine Found for ...
Post by: joeaverage on May 18, 2018, 07:21:55 PM
Hi Dan,
when you update to the latest build you should have BOTH an individually named profile AND screenset. This is a post I made a wee
while ago that explains why:

http://www.machsupport.com/forum/index.php/topic,37337.msg255420.html#msg255420 (http://www.machsupport.com/forum/index.php/topic,37337.msg255420.html#msg255420)

Craig
Title: Re: No Script Engine Found for ...
Post by: Osker on May 18, 2018, 07:29:23 PM
Craig,
Thanks for the heads up   I read your explanation and the reasons are logical.  I would have been caught by the lack of a unique Screenset.  Will do that tomorrow.  You are rapidly elevating your status from Mach4 Guru, to Mach4 Wizard :>)


Dan
Title: Re: No Script Engine Found for ...
Post by: Azalin on October 15, 2021, 02:56:25 PM
Enable the mcLua plugin. 

Steve

Thanks a lot for this. It worked for me.