KevinC Posted August 19, 2009 Share Posted August 19, 2009 I am taking over for someone that wrote this program and have never used AutoIt before, I need to add a second Variable to this part of the script but have no Idea how. Can anyone help out? This is what I have now. I want to add a second Rev to this. Rev "H1" $cur_eco_rev = "H" $data = "" Dim $v_Array[1] Dim $i_Array[1] Dim $assy_Elements[1][11] Thanks Kevin Link to comment Share on other sites More sharing options...
Scriptonize Posted August 19, 2009 Share Posted August 19, 2009 I am taking over for someone that wrote this program and have never used AutoIt before, I need to add a second Variable to this part of the script but have no Idea how. Can anyone help out? This is what I have now. I want to add a second Rev to this. Rev "H1" $cur_eco_rev = "H" $data = "" Dim $v_Array[1] Dim $i_Array[1] Dim $assy_Elements[1][11] Thanks Kevin I cannot make any sense of this. I may guess many things, but what is it what you wanna do? If you learn from It, it's not a mistake Link to comment Share on other sites More sharing options...
KevinC Posted August 19, 2009 Author Share Posted August 19, 2009 I cannot make any sense of this.I may guess many things, but what is it what you wanna do?Sorry,I want it to look for Rev "H" or Rev "H1"Right now if it see anything other then Rev H it will stop running. I want to add look for Rev H or H1 to the script.ThanksKevin Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 19, 2009 Moderators Share Posted August 19, 2009 KevinC,,First of all, welcome to the AutoIt forums.However, I am afraid that we are not mind readers and we need a bit more information than you have so far posted. >_< If I understand correctly, you have inherited the responsibility of an AutoIt script without any knowledge of AutoIt. So, after my condolences, I would suggest that reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here. You will no doubt have to deal with other problems in the future and you might as well have a stab at understanding what you have inherited. Tell your boss it is work-related (which it certainly is) and you might even enjoy it! Returning to your specific problem, you seem to need a change to a search algorithm to include your "Rev H1" as well as "Rev H". What you have offered us gives us no clue as to what this algorithm is, so you need to post more code. If you are concerned about posting the whole thing on an open forum, please feel free to send it to me via PM - at least you will then know who to blame if it goes public. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
KevinC Posted August 19, 2009 Author Share Posted August 19, 2009 Hi M23 yes you are correct. I am looking through the links that you gave me. Thanks. Here is more of the code. If you need more let me know and I can send all of it over. Case $msg = $k_oECO ; Open new book, make it visible $i_path_eco = FileOpenDialog("Open ECO", GUICtrlRead($t_tmp_path) & "\", "MS Excel Files (*.xl*;*.xls)") If @error = 1 Then Sleep(10) Else ; Open new book, make it visible Local $oExcel = _ExcelBookOpen($i_path_eco, 1) ; Check ECO Revision $g_eco_rev = _ExcelReadCell($oExcel, "A43") ; Check if ECO is current (CURRENT REV: H) $g_rev = StringRight($g_eco_rev, 1) If $oExcel = 0 Then MsgBox(0, "Invalid ECO", "MMR cannot find the specified ECO.") ElseIf $g_rev <> $cur_eco_rev Then MsgBox(0, "Invalid ECO Revision", "MMR cannot process ECO with revision older than Rev H") ; Terminate Program if ECO Rev is older that Rev H Else WinWaitActive("Microsoft Excel -") ; Get ECO Number GLOBAL $g_eco_num = _ExcelReadCell($oExcel, "Y2") ; Get Originator GLOBAL $g_eco_orig = _ExcelReadCell($oExcel, "A6") ; Get Model GLOBAL $g_eco_mdl = _ExcelReadCell($oExcel, "D6") ; Get Reason $g_eco_rsn_1 = _ExcelReadCell($oExcel, "J14") ; Reading additional sheets if applicable. $mySheetList = _ExcelSheetList($oExcel) ;_ArrayDisplay($mySheetList) ; debug $g_sheet = "" For $sht_array = 0 To Ubound($mySheetList)-1 $g_sheet = $g_sheet & $mySheetList[$sht_array] ; Grabbing names of each Sheet. Next ;$eco_sht = StringRegExp($g_sheet, ".(ECO)", 3) ; debug ;$bom_sht = StringRegExp($g_sheet, ".(BOM)", 3) ; debug $hdn_sht_qty = Ubound(StringRegExp($g_sheet, ".(ASS)", 3)) ; Counting how many Hidden sheets $eco_sht_qty = Ubound(StringRegExp($g_sheet, ".(ECO)", 3)) ; Counting how many ECO sheets $bom_sht_qty = Ubound(StringRegExp($g_sheet, ".(BOM)", 3)) ; Counting how many BOM sheets ;MsgBox(0, "ECO sheet quantity", "There are " & $eco_sht_qty & " ECO sheets and " & $bom_sht_qty & " BOM sheets") ; debug If $hdn_sht_qty > 0 Then MsgBox(0, "ERROR", "MMR cannot continue. Please fix the ECO spreadsheet. Possible problem is caused by hidden sheets.") Else ; Unprotecting Spreadsheet _UnProtectSht() ; Gathering ECO datas _ReadCoverSht() ; Gathering BOM datas _ReadBomSht() ; Prep for M220 _m220prep() EndIf EndIf EndIf Thanks Kevin Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 19, 2009 Moderators Share Posted August 19, 2009 KevinC,Getting closer! >_< We are looking at a comparison here at Line 16:ElseIf $g_rev <> $cur_eco_rev ThenSomewhere earlier in the script is a line which defines the minimum update value $cur_eco_rev. It is almost certainly something like this:$cur_eco_rev = ???????Can you find the part of the script that has a line of that format in it? Then we can work on offering 2 choices to instead of the current one.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
KevinC Posted August 19, 2009 Author Share Posted August 19, 2009 KevinC, Getting closer! >_< We are looking at a comparison here at Line 16: ElseIf $g_rev <> $cur_eco_rev Then Somewhere earlier in the script is a line which defines the minimum update value $cur_eco_rev. It is almost certainly something like this: $cur_eco_rev = ??????? Can you find the part of the script that has a line of that format in it? Then we can work on offering 2 choices to instead of the current one. M23 The only place I see that is here: $cur_eco_rev = "H" $data = "" Dim $v_Array[1] Dim $i_Array[1] Dim $assy_Elements[1][11] If that is not enough let me know and I will send you the file. Thanks Kevin Link to comment Share on other sites More sharing options...
trancexx Posted August 19, 2009 Share Posted August 19, 2009 Try this: $cur_eco_rev = "H" $cur_eco_rev_NEW = "H1" ; Check ECO Revision $g_eco_rev = _ExcelReadCell($oExcel, "A43") ; Check if ECO is current (CURRENT REV: H) If $oExcel = 0 Then MsgBox(0, "Invalid ECO", "MMR cannot find the specified ECO.") ElseIf StringRight($g_eco_rev, 1) == $cur_eco_rev Or StringRight($g_eco_rev, 2) == $cur_eco_rev_NEW Then WinWaitActive("Microsoft Excel -") Else MsgBox(0, "Invalid ECO Revision", "MMR cannot process ECO with revision older than Rev H") ; Terminate Program if ECO Rev is older that Rev H ;... ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Scriptonize Posted August 19, 2009 Share Posted August 19, 2009 Hi again,It looks like $cur_eco_rev = "H" is defined as a constant.I'm not sure if it will brake anything elsewhere in the script, but the comparison could be changed into:ElseIf $g_rev <> "H" OR $g_rev <> "H1" Then....... If you learn from It, it's not a mistake Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 19, 2009 Moderators Share Posted August 19, 2009 (edited) KevinC,OK, I think we are there.Where you had:$cur_eco_rev0 = "H"change it to read:$cur_eco_rev0 = "H" $cur_eco_rev1 = "H1"Then where it says:$g_rev = StringRight($g_eco_rev, 1)change it to read:$g_rev0 = StringRight($g_eco_rev, 1) $g_rev1 = StringRight($g_eco_rev, 2)Finally, where it says:ElseIf $g_rev <> $cur_eco_rev Thenchange it to read:ElseIf $g_rev0 <> $cur_eco_rev0 And $g_rev1 <> $cur_eco_rev1 ThenAnd you should be good to go. it should also give you a good idea of what to do when H2 comes along.... I was not joking about learning AutoIt, by the way. If it is useful to your company, then it is worth them giving you the time to learn. And it is a marketable skill for you.... M23Edit: I see I was beaten to it by trancexx - no surprise there. Scriptonize; close, but no cigar - you need to use StringRight(#, 2) to read "H1" >_< Edited August 19, 2009 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
KevinC Posted August 19, 2009 Author Share Posted August 19, 2009 Thanks for everyones help, That did it M23. I figured I needed an if statement. Didn't even think about "And" I will know what to do when the Rev changes again.... >_< Kevin Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 19, 2009 Moderators Share Posted August 19, 2009 KevinC, And if you have any problems, you know who to call....... >_< M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 19, 2009 Share Posted August 19, 2009 KevinC,And if you have any problems, you know who to call....... M23He should call Zorro? >_<(sorry couldn't resist!) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 19, 2009 Moderators Share Posted August 19, 2009 (edited) AdmiralAlkex, If the mask fits.... M23 P.S. If only Catherine Zeta-Jones was included....... >_< Edit: speeling Edited August 19, 2009 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 19, 2009 Share Posted August 19, 2009 P.S. If only Catherine Zeta-Jones was included....... >_<Yeah I know what you mean, she's one fine lady .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface 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