Jump to content

Help With Variables Statement


 Share

Recommended Posts

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

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

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.

Thanks

Kevin

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

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

  • Moderators

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 Then

change it to read:

ElseIf $g_rev0 <> $cur_eco_rev0 And $g_rev1 <> $cur_eco_rev1 Then

And 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.... :(

M23

Edit: 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 by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

KevinC,

And if you have any problems, you know who to call....... >_<

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

AdmiralAlkex,

If the mask fits....

M23

P.S. If only Catherine Zeta-Jones was included....... >_<

Edit: speeling

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...