jchd Posted August 2, 2013 Share Posted August 2, 2013 Ah, OK. So is everthing working as you want it to? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Wombat Posted August 2, 2013 Author Share Posted August 2, 2013 (edited) Ah, OK. So is everthing working as you want it to? Very close, how would I specify that it only searches for the M47 directly above the first M0 and not every M47 in the file?also, kylomas and Edano may wanna look at my post previous to this one as i had to heavily edit it with more data Edited August 2, 2013 by Wombat Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
jchd Posted August 2, 2013 Share Posted August 2, 2013 Try this If StringRegExp ($TextCheck, "(?m)N\d+\.\dM47\RN\d+M0", 0) Then Again what surprises me is that the regexp wants Nxx.xM47 and will not match at NyyM47. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Wombat Posted August 2, 2013 Author Share Posted August 2, 2013 Try this If StringRegExp ($TextCheck, "(?m)N\d+\.\dM47\RN\d+M0", 0) Then Again what surprises me is that the regexp wants Nxx.xM47 and will not match at NyyM47. What is NyyM47? if it represents other M47's in the file under after the M0 code then yes is was indeed picking them up and that was my problem I had multiple M47's but not above the M0. So a flag of 0 was returning 1 but it wasn't searching porperly. I'm probably confusing you I'm sorry Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Edano Posted August 2, 2013 Share Posted August 2, 2013 i am still not convinced that it will be stable and reliable for special cases. you should thoroughly test it before you use it in a nuclear power plant.... [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
jchd Posted August 2, 2013 Share Posted August 2, 2013 (edited) I too am sorry: run this by yourself to convince you that this pattern just won't never match NyyM47 but only lines with a decimal point in the first number, like Nxx.xM47. If StringRegExp ("N01M47" & @CRLF & "N02M0" & @CRLF & "N03M47", "(?m)N\d+\.\dM47\R", 0) Then MsgBox(0, "", "Match!") @Edano: Which special cases do you have in mind? Edited August 2, 2013 by jchd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Edano Posted August 2, 2013 Share Posted August 2, 2013 @Edano: Which special cases do you have in mind? . it would be better to see more samples. it's only tested on a tiny reproducer ..... [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
jchd Posted August 2, 2013 Share Posted August 2, 2013 The number of samples is not the main point. Data format specifications strictly governs how a program must be coded. The pattern will work as long as the initial data format is NxxMyy (with x and y digits) and doesn't contain Nxx.xM47 lines unless these lines are inserted before the first NxxM0 line. At least, this was the specs exposed until now. Now that the OP says the regexp matches other lines I suspect there are untold extra rules. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Wombat Posted August 2, 2013 Author Share Posted August 2, 2013 When the M47 code is in the file at all the format is always: Nxx.xM47, You were right jchd, Func _On_Drop() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $i = 1 To $aDrop_List[0] GUICtrlSetData($Input1, $aDrop_List[$i]) Next Local $ReadInput1 = GUICtrlRead($Input1) Local $TextCheck = FileRead($ReadInput1) Local $CheckM47 = StringRegExp ($TextCheck, "(?m)N\d+\.\dM47\RN\d+M0", 0) If $CheckM47 = 1 Then $Graphic1 = GUICtrlCreateGraphic(48, 48, 40, 41) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0x00FF00) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 5, 4, 30, 31) GUICtrlSetGraphic(-1, $GUI_GR_REFRESH) ElseIf $CheckM47 = 0 Then $Graphic1 = GUICtrlCreateGraphic(48, 48, 40, 41) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0xFF0000) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 5, 4, 30, 31) GUICtrlSetGraphic(-1, $GUI_GR_REFRESH) EndIf EndFunc actually finds M47 even if it's above a M08, i tested by removing all the M47's from the file and then placing one by hand in above N34M08 as such: N33.1M47 N34M08 and the on_drop search still picked it up, which I only want it to pick up the one above the M0 not any M code containing 0 such as M08 still with me? Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Wombat Posted August 2, 2013 Author Share Posted August 2, 2013 (edited) btw here is an example of machine code similar to what I'm working with: N25M61 N26M0 N27M602 N28G53X57.859Y5.512 N29(*MSG,TOOL ID NO:10551) N30(*MSG,TL ROUND,X=0.551) N31M81 N32T1[1,0.551] N33M6[1,1] N34M08 The AddM47 function adds it above the M0 only, as i need it to, but if the code is as such: N25M61 N26M0 N27M602 N28G53X57.859Y5.512 N29(*MSG,TOOL ID NO:10551) N30(*MSG,TL ROUND,X=0.551) N31M81 N32T1[1,0.551] N33M6[1,1] N33.1M47 N34M08 Then the on_drop function still hits as finding the M47 and turns the ellipse green. I need to only check for the M47 above the M0 Edited August 2, 2013 by Wombat Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Edano Posted August 2, 2013 Share Posted August 2, 2013 aha ! i knew that it's more complicated [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Wombat Posted August 2, 2013 Author Share Posted August 2, 2013 aha ! i knew that it's more complicated the add function works perfect without flaw, I've tested it on multiple files, what is NOT working correctly is the search function built into the on_drop function. It is picking up the M08 which is odd because the AddM47 function does not even touch the M08 and only edits above the M0 code Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
jchd Posted August 2, 2013 Share Posted August 2, 2013 This matches what I suspected. You silly, you never told us about lines with decimal numbers as the first value... Anyway, I forgot to add a R at the end of the pattern so the M08 line matches M0. Hence use that instead: StringRegExp ($TextCheck, "(?m)N\d+\.\dM47\RN\d+M0\R", 0) Sorry for this mistake of mine. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Wombat Posted August 2, 2013 Author Share Posted August 2, 2013 This matches what I suspected. You silly, you never told us about lines with decimal numbers as the first value... Anyway, I forgot to add a R at the end of the pattern so the M08 line matches M0. Hence use that instead: StringRegExp ($TextCheck, "(?m)N\d+\.\dM47\RN\d+M0\R", 0) Sorry for this mistake of mine. equally my mistake, I should have supplied that sample code to begin with Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Edano Posted August 2, 2013 Share Posted August 2, 2013 (edited) aha, yes sir i begged for it Edited August 2, 2013 by Edano Wombat 1 [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Wombat Posted August 2, 2013 Author Share Posted August 2, 2013 (edited) This matches what I suspected. You silly, you never told us about lines with decimal numbers as the first value... Anyway, I forgot to add a R at the end of the pattern so the M08 line matches M0. Hence use that instead: StringRegExp ($TextCheck, "(?m)N\d+\.\dM47\RN\d+M0\R", 0) Sorry for this mistake of mine. This worked perfectly. Now the very last thing I have to do is figure out the method to remove the only the M47 from above the M0 so that this: N25M61 N25.1M47 N26M0 N27M602 Becomes: N25M61 N26M0 N27M602 without touching any other M47's in the code... Edit: and yes I am studying the StringRegExp flags used so that I'm learning and not regurgitating code, Edited August 2, 2013 by Wombat Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
jchd Posted August 2, 2013 Share Posted August 2, 2013 I was about to post that part before going to sleep a bit (it's 4:51 here!) Func Remove_M47(); This function removes the M47 code from the program Local $ReadInput1 = GUICtrlRead($Input1) Local $sText = FileRead($ReadInput1) Local $sTextDelM47 = StringRegExpReplace($sText, "(?m)(N\d+\.\dM47\R)(?=N\d+M0\R)", "", 1) MsgBox(0, "First added M47 now removed", $sTextM47) FileWrite($ReadInput1, $sTextDelM47) EndFunc Should work if you pray hard enough! Wombat 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Wombat Posted August 2, 2013 Author Share Posted August 2, 2013 expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <String.au3> #include <Array.au3> #include <File.au3> Opt("GUIOnEventMode", 1) ; GUI section starts here: $GUI = GUICreate("M47 Tool", 509, 136, 340, 175, Default, $WS_EX_ACCEPTFILES) GUISetIcon("C:\prog_res\Lab\test_res\config.ico", -1) GUISetOnEvent($GUI_EVENT_CLOSE, "Close_M47_Tool") $Input1 = GUICtrlCreateInput("", 92, 56, 329, 21) $Label1 = GUICtrlCreateLabel("Use this tool to add or remove the M47 code from a program", 11, 16, 486, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Add M47", 88, 88, 161, 41) GUICtrlSetCursor (-1, 0) GUICtrlSetOnEvent(-1, "Add_M47") $Button2 = GUICtrlCreateButton("Remove M47", 260, 88, 161, 41) GUICtrlSetCursor (-1, 0) GUICtrlSetOnEvent(-1, "Remove_M47") $Button3 = GUICtrlCreateButton("", 440, 48, 49, 41, $BS_ICON) GUICtrlSetImage(-1, "C:\prog_res\Lab\test_res\reload%2032.ico", -1) GUICtrlSetTip(-1, "Reload Tool") GUICtrlSetCursor (-1, 0) GUICtrlSetOnEvent(-1, "Tool_Reload") $Button4 = GUICtrlCreateButton("?", 456, 104, 33, 25, $BS_PUSHBOX) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFFF00) GUICtrlSetBkColor(-1, 0xD4D0C8) GUICtrlSetTip(-1, "Open the Help file") GUICtrlSetCursor (-1, 4) GUICtrlSetOnEvent(-1, "Open_Help") $cDrop_Dummy = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, "_On_Drop") Global $Graphic1 Local $sText Global $aDrop_List GUISetState(@SW_SHOW) ; GUI section ends here. ;;;;;;;;;;;;;;;;;;;;; ; Register $WM_DROPFILES function to detect drops anywhere on the GUI <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUIRegisterMsg(0x233, "On_WM_DROPFILES") ; $WM_DROPFILES ;;;;;;;;;;;;;;;;;;;; While 1 WEnd Func _On_Drop() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $i = 1 To $aDrop_List[0] GUICtrlSetData($Input1, $aDrop_List[$i]) Next Local $ReadInput1 = GUICtrlRead($Input1) Local $TextCheck = FileRead($ReadInput1) Local $CheckM47 = StringRegExp ($TextCheck, "(?m)N\d+\.\dM47\RN\d+M0\R", 0) If $CheckM47 = 1 Then $Graphic1 = GUICtrlCreateGraphic(48, 48, 40, 41) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0x00FF00) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 5, 4, 30, 31) GUICtrlSetGraphic(-1, $GUI_GR_REFRESH) ElseIf $CheckM47 = 0 Then $Graphic1 = GUICtrlCreateGraphic(48, 48, 40, 41) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0xFF0000) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 5, 4, 30, 31) GUICtrlSetGraphic(-1, $GUI_GR_REFRESH) EndIf EndFunc ;==>_On_Drop;;; This adds the file path of the dropped item to the input box and checks for the M47 code displaying a green or red circle accordingly Func Input_Prog_Check(); Checks the program for the M47 code and displays either an error icon or success icon EndFunc Func Close_M47_Tool(); CLoses the Tool Exit EndFunc Func Add_M47(); This function adds the M47 code to the program GUICtrlDelete ($Graphic1) Local $ReadInput1 = GUICtrlRead($Input1) Local $TextCheck = FileRead($ReadInput1) Local $CheckM47 = StringRegExp ($TextCheck, "(?m)N\d+\.\dM47\RN\d+M0\R", 0) If $CheckM47 = 1 Then $Graphic1 = GUICtrlCreateGraphic(48, 48, 40, 41) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0x00FF00) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 5, 4, 30, 31) GUICtrlSetGraphic(-1, $GUI_GR_REFRESH) MsgBox(48, "Notice", "This program already contains the M47 code present" & @CRLF & "you will not be able to add it until" & @CRLF & "you remove it", 0, "M47 Tool") ElseIf $CheckM47 = 0 Then $Graphic1 = GUICtrlCreateGraphic(48, 48, 40, 41) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0xFFFF00) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 5, 4, 30, 31) GUICtrlSetGraphic(-1, $GUI_GR_REFRESH) Sleep(150) GUICtrlDelete ($Graphic1) $Graphic1 = GUICtrlCreateGraphic(48, 48, 40, 41) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0xFF0000) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 5, 4, 30, 31) GUICtrlSetGraphic(-1, $GUI_GR_REFRESH) Sleep(150) GUICtrlDelete ($Graphic1) $Graphic1 = GUICtrlCreateGraphic(48, 48, 40, 41) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0xFFFF00) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 5, 4, 30, 31) GUICtrlSetGraphic(-1, $GUI_GR_REFRESH) Local $ReadInput1 = GUICtrlRead($Input1) Local $sText = FileRead($ReadInput1) Local $sTextM47 = Execute("'" & StringRegExpReplace($sText, "(?m)(N\d+M\d+\R)?N(\d+)(M0\R)", "$1N' & StringFormat('%04.1f', $2 - 0.9) & 'M47" & @CRLF & "N$2$3", 1) & "'") FileDelete ($ReadInput1) FileWrite ($ReadInput1, $sTextM47) Sleep(150) GUICtrlDelete ($Graphic1) $Graphic1 = GUICtrlCreateGraphic(48, 48, 40, 41) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0x00FF00) GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 5, 4, 30, 31) GUICtrlSetGraphic(-1, $GUI_GR_REFRESH) EndIf EndFunc Func Remove_M47(); This function removes the M47 code from the program EndFunc Func Tool_Reload(); This function clears the $ReadInput1 var GUICtrlSetData ($Input1, "") GUICtrlDelete ($Graphic1) EndFunc Func Open_Help(); This function opens the help file to aid the user in adding or removing the M47 code $Form2 = GUICreate("Form2", 665, 834, 484, 50) GUISetOnEvent($GUI_EVENT_CLOSE, "Help_window_close") GUISetIcon("C:\prog_res\Lab\test_res\config.ico", -1) $Label1 = GUICtrlCreateLabel("M47 Help Window", 225, 8, 215, 33) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFFF00) GUICtrlSetBkColor(-1, 0xA0A0A4) $Pic1 = GUICtrlCreatePic("C:\prog_res\Lab\test_res\ScreenCap.bmp", 8, 56, 649, 363) $Label2 = GUICtrlCreateLabel("1: Indicates that the loaded program contains the M47 code", 59, 472, 476, 25) GUICtrlSetFont(-1, 12, 800, 0, "Franklin Gothic Medium") GUICtrlSetColor(-1, 0xFF0000) $Label3 = GUICtrlCreateLabel("2: Indicates that the Loaded Program does not contain the M47 code", 59, 519, 544, 25) GUICtrlSetFont(-1, 12, 800, 0, "Franklin Gothic Medium") GUICtrlSetColor(-1, 0xFF0000) $Label4 = GUICtrlCreateLabel("3: Use this button to add the M47 code", 59, 566, 312, 25) GUICtrlSetFont(-1, 12, 800, 0, "Franklin Gothic Medium") GUICtrlSetColor(-1, 0xFF0000) $Label5 = GUICtrlCreateLabel("4: Use this button to remove the M47 code", 59, 613, 338, 25) GUICtrlSetFont(-1, 12, 800, 0, "Franklin Gothic Medium") GUICtrlSetColor(-1, 0xFF0000) $Label6 = GUICtrlCreateLabel("5: Use this button to access the Help Window", 59, 660, 359, 25) GUICtrlSetFont(-1, 12, 800, 0, "Franklin Gothic Medium") GUICtrlSetColor(-1, 0xFF0000) $Label7 = GUICtrlCreateLabel("6: Use this button to reset the M47 Tool Window", 59, 707, 382, 25) GUICtrlSetFont(-1, 12, 800, 0, "Franklin Gothic Medium") GUICtrlSetColor(-1, 0xFF0000) $Label8 = GUICtrlCreateLabel("7: Either type in the full path, or drag and drop the file here", 59, 754, 644, 25) GUICtrlSetFont(-1, 12, 800, 0, "Franklin Gothic Medium") GUICtrlSetColor(-1, 0xFF0000) GUISetState(@SW_SHOW) EndFunc Func Help_window_close() GUIDelete ("M47 Help Window") EndFunc ; React to items dropped on the GUI <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Func On_WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam) ; Credit to ProgAndy for DLL calls #forceref $hWnd, $iMsg, $lParam Local $iSize, $pFileName ; Get number of files dropped Local $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 0) ; Reset array to correct size Global $aDrop_List[$aRet[0] + 1] = [$aRet[0]] ; And add item names For $i = 0 To $aRet[0] - 1 $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $iSize = $aRet[0] + 1 $pFileName = DllStructCreate("wchar[" & $iSize & "]") DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $iSize) $aDrop_List[$i + 1] = DllStructGetData($pFileName, 1) $pFileName = 0 Next ; Send the count to trigger the drop function in the main loop GUICtrlSendToDummy($cDrop_Dummy, $aDrop_List[0]) EndFunc ;==>On_WM_DROPFILES The code so far, ignore the ugly yellow flashing ellipse, Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
jchd Posted August 2, 2013 Share Posted August 2, 2013 See above This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
jchd Posted August 2, 2013 Share Posted August 2, 2013 Since we are at it, is it possible for the first M0 line (where we are going to insert an M47 with 0.9 substracted) to have a non integral first value. For instance, should we insert an M47 line in this sample: N01M23 N02M05 N03.5M0 <-- is that a possible format? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now