Hello,
i thank you guys who give tons of help.

With help from Daz, I've been able to run M6 so far.
But I'd like to shorten the time needed for tool change.
What code should I insert to probing twice?
(First with relatively fast feed(I think F300 would be enough), the second with slow/precise probing feed(F50 will do))
I think I need to back off about 2mm when the first probing is done. then the second probing starts.
Here is my M6 code I have used so far.
What should I add to the red below?
============================================================
function m6()
local inst = mc.mcGetInstance();
local xstart = mc.mcAxisGetPos(inst,0)
local ystart = mc.mcAxisGetPos(inst,1)
local guesslen = -100
local selectedtool = mc.mcToolGetSelected(inst)
local currenttool = mc.mcToolGetCurrent(inst)
local toollen = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, currenttool)
if toollen == 0 then toollen = 50 end
local probestart = guesslen + toollen
if selectedtool == currenttool then
return
mc.mcCntlSetLastError(inst, "Selected Tool = Current Tool")
else
mc.mcCntlGcodeExecuteWait(inst,"M05")
mc.mcCntlGcodeExecuteWait(inst,"M09")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G00 Z0.000")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G00 X1.700 Y1.100")
mc.mcCntlGcodeExecuteWait(inst,"G04 P4000")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G00 Z"..probestart)
mc.mcCntlGcodeExecuteWait(inst,"G91 G31 Z-60 F100")
mc.mcCntlGcodeExecuteWait(inst,"M07")
local toolz = mc.mcAxisGetPos(inst,2)
mc.mcCntlGcodeExecuteWait(inst,"M09") mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G00 Z0.000")
local changetoo = mc.mcToolGetDesc(inst, selectedtool)
wx.wxMessageBox("Please change to tool number "..selectedtool.." "..changetoo.." and press OK to continue")
currenttool = selectedtool
toollen = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, currenttool)
if toollen == 0 then toollen = 50 end
probestart = guesslen + toollen
mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G00 X1.700 Y1.100")
mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G00 Z"..probestart)
mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-60 F100")
mc.mcAxisSetPos(inst, 2 , toolz)
mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G00 Z0.000")
-- mc.mcCntlGcodeExecuteWait(inst,"M03")
-- mc.mcCntlGcodeExecuteWait(inst, "G90 G00 X"..xstart)
-- mc.mcCntlGcodeExecuteWait(inst, "G90 G00 Y"..ystart)
mc.mcCntlGcodeExecuteWait(inst, "G90 G00 X"..xstart.." Y"..ystart)
-- mc.mcCntlGcodeExecuteWait(inst,"G04 P3000")
mc.mcToolSetCurrent(inst, selectedtool)
mc.mcCntlSetLastError(inst, "Toolchange Finished")
--wx.wxMessageBox('Toolchange Finished')
end
end
if (mc.mcInEditor() == 1) then
m6()
end