local inst = mc.mcGetInstance(); local currentfile = mc.mcCntlGetGcodeFileName(inst) source = io.open(currentfile) local indexval =0 local linenum=0 local StrValue = wx.wxGetTextFromUser("Enter in Text", "Searching For:", "M6"); UpperStrValue = string.upper(StrValue) LowerStrValue = string.lower(StrValue) while 1 do linenum = linenum + 1 lineread = source:read() if not lineread then break end if string.match(lineread,UpperStrValue) or string.match(lineread,LowerStrValue)then mc.mcCntlSetLastError(inst, "Line: "..linenum ..": ".. lineread .. "\n"); indexval = indexval + 1 end end if indexval == 0 then mc.mcCntlSetLastError(inst, "None Found\n"); elseif indexval == 1 then mc.mcCntlSetLastError(inst, "Found: " .. indexval .. " occurrence \n"); elseif indexval > 1 then mc.mcCntlSetLastError(inst, "Found: " .. indexval .. " occurrences \n"); end