Recently Browsing 0 members
No registered users viewing this page.
Thank you so much in advance for your help! I've been using AUTOIT for manipulating gcode. So far I've just worked through the excellent help examples and although I'm sure the resulting code is clumsy it has functioned
However now I'm trying to improve and advance things and I've stumbled across REGEX.. and I'm a bit stuck. What I would like to be able to do is to 'move'/'transform' the gcode in a file and re-write it to a new file. I only need to move it in one direction(X). At the heart of this I need a script to extract all the X values and then ADD or SUBTRACT an adjustment factor to transform and rewrite the code accordingly.
So far using an example script and an example input -
Local $iMove = -4
Local $sInput = '"G1 X45.036 Y6.934 F7800.000 G1 Z0.600 F7800.000 G1 F900 G1 X48.036 Y1.076 E0.58925"'
Local $sOutput = StringRegExpReplace($sInput, '(?<=[X])\d+.\d+', '\0')
This identifies the correct values i.e 45.036 and 48.036 but is there a way to dyamically adjust them before they are replaced, by for example a factor of -4 ($iMove above). So far I can't seem to do math on the '\0' value i.e '\0'+ -4 ?
Many thanks for your time and expertise!
i am trying to get number from string using this code :
#include <IE.au3> $oIE = _IEAttach ("Edu.corner") Local $aName = "Student name & Code:", $iaName = "0" Local $oTds = _IETagNameGetCollection($oIE, "td") For $oTd In $oTds If $oTd.InnerText = $aName Then $iaName = $oTd.NextElementSibling.InnerText $iGet = StringRegExpReplace($iaName, "\D", "") EndIf Next MsgBox(0, "", $iGet) it was get number like 52503058
But, I want to get only student code 5250. (Different student have different code, sometime its 3 digits, Sometime 4)
Is there a way to output the regex matches into a file?
I have a script to compare two files and check for regex matches.
I want to output the matching regex of 'testexample.txt' to another file.
#include <MsgBoxConstants.au3> #include <Array.au3> $Read = FileReadToArray("C:\Users\admin\Documents\testexample.txt") $Dictionary = FileReadToArray("C:\Users\admin\Documents\example.txt") For $p = 0 To UBound($Dictionary) - 1 Step 1 $pattern = $Dictionary[$p] For $i = 0 To UBound($Read) - 1 Step 1 $regex = $Read[$i] If StringRegExp($regex, $pattern, 0) Then MsgBox(0, "ResultsPass", "The string is in the file, highlighted strings: " ) Else MsgBox(0, "ResultsFail", "The string isn't in the file.") EndIf Next Next
I need some help to parse the Green highlighted value with from below text:
RESISTOR THICK FILM 4.64K ±1% 1/4W ±100PPM/°C 1206 SMT
RESISTOR THICK FILM 3.83K ±1% 1/4W ±100PPM/°C 1206 SMT
RESISTOR CARBON FILM 22K ±10% 1/2W AXIAL THT
RESISTOR WIREWOUND 22 ±5% 3W ±30PPM/°C AXIAL THT
RESISTOR METAL OXIDE 4.7K ±5% 2 W ±300PPM/°C AXIAL THT
RESISTOR THICK FILM 0 1/8W 0805 SMT
I am using positive look behind.:
(?<=FILM|WOUND|OXIDE).+ Can only pull this off:
4.64K ±1% 1/4W ±100PPM/°C 1206 SMT 3.83K ±1% 1/4W ±100PPM/°C 1206 SMT 22K ±10% 1/2W AXIAL THT 22 ±5% 3W ±30PPM/°C AXIAL THT 4.7K ±5% 2 W ±300PPM/°C AXIAL THT 0 1/8W 0805 SMT I'm trying the \b word boundary to no avail at this point. Appreciate if anyone would guide me on this?