
goodmanjl531
Active Members-
Posts
62 -
Joined
-
Last visited
Everything posted by goodmanjl531
-
GUI Button text disapearing
goodmanjl531 replied to goodmanjl531's topic in AutoIt GUI Help and Support
@ioa747 Nice work on getting rid of excessive code, I did not know about the Ternary code, that removes so much garbage on my simple binary results. Thanks for you input and thanks for bring the missing 25th field.. -
GUI Button text disapearing
goodmanjl531 replied to goodmanjl531's topic in AutoIt GUI Help and Support
I fixed my loop only going to 24 and only update the labels no need to update the buttons as they never change. and cleaned up my updates to make sure i call the (only) form im using to avoid anything getting weird. Func Update_Form($RecordName, $record, $record_parsed, $Label) WinSetTitle($Form_record, "", $RecordName) ControlSetText($Form_record, "", $GUI_input_parsed[1], $RecordName) ControlSetText($Form_record, "", $Lbl_Record, "Record " & $row & " of " & $MaxRecords) For $ind = 1 To 24 ControlSetText($Form_record, "", $GUI_LBL[$ind], $Label[$ind]) ControlSetText($Form_record, "", $GUI_input[$ind], $record[$ind]) ControlSetText($Form_record, "", $GUI_input_parsed[$ind], $record_parsed[$ind]) Next ControlSetText($Form_record, "", $GUI_input_parsed[1], $RecordName) ControlFocus($Form_record, "", $Btn_Next) EndFunc ;==>Update_Form above is what i am using without isssue. I also tried your advice with guictrlsetdata and it works as well ( When searching for how to update I found the ControlSetText first and it worked.) Func Update_Form($RecordName, $record, $record_parsed, $Label) WinSetTitle($Form_record, "", $RecordName) GUICtrlSetData($GUI_input_parsed[1], $RecordName) GUICtrlSetData($Lbl_Record, "Record " & $row & " of " & $MaxRecords) For $ind = 1 To 24 GUICtrlSetData( $GUI_LBL[$ind], $Label[$ind]) GUICtrlSetData($GUI_input[$ind], $record[$ind]) GUICtrlSetData( $GUI_input_parsed[$ind], $record_parsed[$ind]) Next GUICtrlSetData( $GUI_input_parsed[1], $RecordName) ControlFocus($Form_record, "", $Btn_Next) EndFunc ;==>Update_Form Thanks again to all for their advice and help on this. I'm thinking i went with 25 at first thinking as an array starts with 0 as first record messed me up but i dont use first array record [0] ..... -
GUI Button text disapearing
goodmanjl531 replied to goodmanjl531's topic in AutoIt GUI Help and Support
@pixelsearch That was it, not sure why i was going to 25 on my loop when i had 24 of each but thanks so much for helping to catch this. -
I have a program with a GUI interface that is mainly for decoding files. it has multiple label fields to show raw/decoded/parsed data. It has 3 buttons at button that work (next Record, Previous Record and Exit) The issue is the text will disappear randomly on the buttons. I refresh the labels for each new record as it is decoded, but I cannot figure our why the button text disappears. everything works correctly except the fact the words on my buttons go away and come back randomly. I have redacted a majority of the code as it is redundant for the different records i decode and will make it easier as it still has an error with less code. 1 button missing text 2 buttons missing text here is some sample text used that will decode.. 0010048150 0000500730000010000000000399000000039900000003990000000000010000000399010000000000000 0010048627 0000500730000010000000000399000000039900000003990000000000010000000399011000000000000 0010047109 0000500730000010000000000399000000039900000003990000000000010000000399011000000000000 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> Global $Form_record, $MaxRecords, $Form_Main, $Btn_Exit, $Btn_Next, $Btn_Prev, $record[26], $record_parsed[26], $Label7, $Label[26], $GUI_LBL[26], $GUI_input[26], $GUI_input_parsed[26], $TlogArray, $sFile_tlog_path = "C:\TS\tlog.new" _FileReadToArray($sFile_tlog_path, $TlogArray) ; Read TLOG file and add to an array to be able to read line by line $Totalrows = UBound($TlogArray) $MaxRecords = $Totalrows - 1 For $ind = 1 To 25 $record[$ind] = " " $record_parsed[$ind] = " " $Label[$ind] = " " Next $RecordName = "TLOG Decoder" Call("Build_Form", $RecordName, $record, $record_parsed, $Label) GUISetState(@SW_SHOW, $Form_record) Sleep(1000) $row = 1 Do $tempRec = $TlogArray[$row] $rectype = StringLeft($tempRec, 3) Select Case $rectype = "001" $RecordName = "String Type 001 - Merchandise Item" Call("REC001", $tempRec) Case $rectype = "004" $RecordName = "String Type 004 - Fee" Call("REC004", $tempRec) Case Else ; NON Coded response MsgBox(0, "Claires TLOG DECODER - JLG", "Code " & $rectype & " Not found") EndSelect Call("Update_Form", $RecordName, $record, $record_parsed, $Label) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($Form_record) Exit Case $Btn_Exit GUIDelete($Form_record) Exit Case $Btn_Next $row += 1 ExitLoop Case $Btn_Prev $row -= 1 ExitLoop EndSwitch WEnd If $row > $MaxRecords Then MsgBox(0, "TLOG Decoder", "Last Record Nothing After") $row -= 1 EndIf If $row < 1 Then MsgBox(0, "TLOG Decoder", "First record nothing prior") $row = 1 EndIf Until $row > $MaxRecords Exit ; **** END OF MAIN PROGRAM*** Func Dollar($record) Return ("$ " & StringFormat("%.2f", $record / 100)) EndFunc ;==>Dollar Func ConvertToDate($record) Return (StringTrimRight($record, 6) & "/" & StringMid($record, 3, 2) & "/" & StringTrimLeft($record, 4)) EndFunc ;==>ConvertToDate Func ConvertToPercentage($record) Return (StringFormat("%.5f,", $record / 100000) & " %") EndFunc ;==>ConvertToPercentage Func ConvertToXDecimals($record, $Precision) Switch $Precision Case 1 $mult = 10 $newnumb = (StringFormat("%.1f", $record / $mult)) Case 2 $mult = 100 $newnumb = (StringFormat("%.2f", $record / $mult)) Case 3 $mult = 1000 $newnumb = (StringFormat("%.3f", $record / $mult)) Case 4 $mult = 10000 $newnumb = (StringFormat("%.4f", $record / $mult)) Case 5 $mult = 100000 $newnumb = (StringFormat("%.5f", $record / $mult)) Case 6 $mult = 1000000 $newnumb = (StringFormat("%.6f", $record / $mult)) EndSwitch Return ($newnumb) EndFunc ;==>ConvertToXDecimals Func Sign($record) If $record = "0" Then Return ("Positive") Else Return ("Negative") EndIf EndFunc ;==>Sign Func Build_Form($RecordName, $record, $record_parsed, $Label) ;--> Build form For $ind = 1 To 25 $record[$ind] = " " $record_parsed[$ind] = " " $Label[$ind] = " " Next $Form_record = GUICreate("TLOG DECODER 101 - JLG", 1623, 798, 228, 88) GUICtrlCreateLabel("Description", 24, 8, 145, 21, $SS_CENTER) $GUI_LBL[1] = GUICtrlCreateLabel("1", 24, 50, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[2] = GUICtrlCreateLabel("2", 24, 126, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[3] = GUICtrlCreateLabel("3", 24, 203, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[4] = GUICtrlCreateLabel("4", 24, 281, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[5] = GUICtrlCreateLabel("5", 24, 358, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[6] = GUICtrlCreateLabel("6", 24, 436, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[7] = GUICtrlCreateLabel("7", 24, 513, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[8] = GUICtrlCreateLabel("8", 24, 591, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlCreateLabel("RAW", 175, 8, 145, 21, $SS_CENTER) $GUI_input[1] = GUICtrlCreateLabel("9", 175, 50, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[2] = GUICtrlCreateLabel("10", 175, 126, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[3] = GUICtrlCreateLabel("11", 175, 203, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[4] = GUICtrlCreateLabel("12", 175, 281, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[5] = GUICtrlCreateLabel("13", 175, 358, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[6] = GUICtrlCreateLabel("14", 175, 436, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[7] = GUICtrlCreateLabel("15", 175, 513, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[8] = GUICtrlCreateLabel("16", 175, 591, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlCreateLabel("PARSED", 329, 8, 145, 21, $SS_CENTER) $GUI_input_parsed[1] = GUICtrlCreateLabel("17", 329, 50, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[2] = GUICtrlCreateLabel("18", 329, 126, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[3] = GUICtrlCreateLabel("19", 329, 203, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[4] = GUICtrlCreateLabel("20", 329, 281, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[5] = GUICtrlCreateLabel("21", 329, 358, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[6] = GUICtrlCreateLabel("22", 329, 436, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[7] = GUICtrlCreateLabel("23", 329, 513, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[8] = GUICtrlCreateLabel("24", 329, 591, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlCreateLabel("Description", 538, 17, 114, 21, $SS_CENTER) $GUI_LBL[9] = GUICtrlCreateLabel("25", 538, 50, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[10] = GUICtrlCreateLabel("26", 538, 126, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[11] = GUICtrlCreateLabel("27", 538, 203, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[12] = GUICtrlCreateLabel("28", 538, 281, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[13] = GUICtrlCreateLabel("29", 538, 358, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[14] = GUICtrlCreateLabel("30", 538, 436, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[15] = GUICtrlCreateLabel("31", 538, 513, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[16] = GUICtrlCreateLabel("32", 538, 591, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlCreateLabel("RAW", 690, 17, 145, 21, $SS_CENTER) $GUI_input[9] = GUICtrlCreateLabel("33", 690, 50, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[10] = GUICtrlCreateLabel("34", 690, 126, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[11] = GUICtrlCreateLabel("35", 690, 203, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[12] = GUICtrlCreateLabel("36", 690, 281, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[13] = GUICtrlCreateLabel("37", 690, 358, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[14] = GUICtrlCreateLabel("38", 690, 436, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[15] = GUICtrlCreateLabel("39", 690, 513, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[16] = GUICtrlCreateLabel("40", 690, 591, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlCreateLabel("PARSED", 845, 17, 145, 21, $SS_CENTER) $GUI_input_parsed[9] = GUICtrlCreateLabel("41", 845, 50, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[10] = GUICtrlCreateLabel("42", 845, 126, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[11] = GUICtrlCreateLabel("43", 845, 203, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[12] = GUICtrlCreateLabel("44", 845, 281, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[13] = GUICtrlCreateLabel("45", 845, 358, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[14] = GUICtrlCreateLabel("46", 845, 436, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[15] = GUICtrlCreateLabel("47", 845, 513, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[16] = GUICtrlCreateLabel("48", 845, 591, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlCreateLabel("Description", 1045, 17, 114, 21, $SS_CENTER) $GUI_LBL[17] = GUICtrlCreateLabel("49", 1045, 50, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[18] = GUICtrlCreateLabel("50", 1045, 126, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[19] = GUICtrlCreateLabel("51", 1045, 203, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[20] = GUICtrlCreateLabel("52", 1045, 281, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[21] = GUICtrlCreateLabel("53", 1045, 358, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[22] = GUICtrlCreateLabel("54", 1045, 436, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[23] = GUICtrlCreateLabel("55", 1045, 513, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_LBL[24] = GUICtrlCreateLabel("56", 1045, 591, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlCreateLabel("RAW", 1199, 17, 145, 21, $SS_CENTER) $GUI_input[17] = GUICtrlCreateLabel("57", 1199, 50, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[18] = GUICtrlCreateLabel("58", 1199, 126, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[19] = GUICtrlCreateLabel("59", 1199, 203, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[20] = GUICtrlCreateLabel("60", 1199, 281, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[21] = GUICtrlCreateLabel("61", 1199, 358, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[22] = GUICtrlCreateLabel("62", 1199, 436, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[23] = GUICtrlCreateLabel("63", 1199, 513, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input[24] = GUICtrlCreateLabel("64", 1199, 591, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlCreateLabel("PARSED", 1355, 17, 145, 21, $SS_CENTER) $GUI_input_parsed[17] = GUICtrlCreateLabel("65", 1355, 50, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[18] = GUICtrlCreateLabel("66", 1355, 126, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[19] = GUICtrlCreateLabel("67", 1355, 203, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[20] = GUICtrlCreateLabel("68", 1355, 281, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[21] = GUICtrlCreateLabel("69", 1355, 358, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[22] = GUICtrlCreateLabel("70", 1355, 436, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[23] = GUICtrlCreateLabel("71", 1355, 513, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $GUI_input_parsed[24] = GUICtrlCreateLabel("72", 1355, 591, 145, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $Btn_Prev = GUICtrlCreateButton("Previous Record", 499, 737, 209, 33) $Btn_Exit = GUICtrlCreateButton("Exit", 232, 736, 209, 33) $Btn_Next = GUICtrlCreateButton("Next Record", 1072, 736, 209, 33) $Label7 = GUICtrlCreateLabel("Record#", 776, 736, 166, 25) EndFunc ;==>Build_Form Func Update_Form($RecordName, $record, $record_parsed, $Label) ; MsgBox(0, "", "update - in") ;GUICtrlSetBkColor(-1, 0xFFFFFF) WinSetTitle($Form_record, "", $RecordName) ControlSetText("", "", $Label7, "Record " & $row & " of " & $MaxRecords) ControlSetText("", "", $Btn_Exit, "Exit") ControlSetText("", "", $Btn_Next, "Next Record") For $ind = 1 To 25 ControlSetText("", "", $GUI_LBL[$ind], $Label[$ind]) ControlSetText("", "", $GUI_input[$ind], $record[$ind]) ControlSetText("", "", $GUI_input_parsed[$ind], $record_parsed[$ind]) Next ControlSetText("", "", $GUI_input_parsed[1], $RecordName) GUISetState(@SW_SHOW, $Form_record) ; MsgBox(0, "", "update - out") EndFunc ;==>Update_Form Func REC001($TLOG) ;String type001 Merhcandise Item For $ind = 1 To 25 $record[$ind] = " " $record_parsed[$ind] = " " $Label[$ind] = "Not Used" Next $record[1] = StringMid($TLOG, 1, 3) $record[2] = StringMid($TLOG, 4, 1) If $record[2] = "1" Then $record_parsed[2] = "Voided" Else $record_parsed[2] = "Not Voided" EndIf $record[3] = StringMid($TLOG, 5, 1) If $record[3] = "1" Then $record_parsed[3] = "Exchanged" Else $record_parsed[3] = "Not Exchanged" EndIf $record[4] = StringMid($TLOG, 6, 24) $record[5] = StringMid($TLOG, 30, 1) If $record[5] = "1" Then $record_parsed[5] = "Class" Else $record_parsed[5] = "SKU" EndIf $record[6] = StringMid($TLOG, 31, 4) $record[7] = StringMid($TLOG, 35, 4) $record[8] = StringMid($TLOG, 39, 9) ;$record_parsed[8] = $record[8] / 1000 $record_parsed[8] = Call("ConvertToXDecimals", $record[8], 3) $record[9] = StringMid($TLOG, 48, 10) $record_parsed[9] = Call("Dollar", $record[9]) $record[10] = StringMid($TLOG, 58, 10) $record_parsed[10] = Call("Dollar", $record[10]) $record[11] = StringMid($TLOG, 68, 10) $record_parsed[11] = Call("Dollar", $record[11]) $record[12] = StringMid($TLOG, 78, 10) $record[13] = StringMid($TLOG, 88, 2) $record[14] = StringMid($TLOG, 90, 10) $record_parsed[14] = Call("Dollar", $record[14]) $record[15] = StringMid($TLOG, 100, 1) $record[16] = StringMid($TLOG, 101, 1) $record[17] = StringMid($TLOG, 102, 1) $record[18] = StringMid($TLOG, 103, 2) $record[19] = StringMid($TLOG, 105, 1) $record[20] = StringMid($TLOG, 106, 1) $record[21] = StringMid($TLOG, 107, 1) $record[22] = StringMid($TLOG, 108, 1) $record[23] = StringMid($TLOG, 109, 2) $record[24] = StringMid($TLOG, 111, 1) $record[25] = StringMid($TLOG, 112, 3) $Label[1] = "Identifier" $Label[2] = "Void Indicator" $Label[3] = "Exchange Indicator" $Label[4] = "Item Number" $Label[5] = "Sku/Class Indicator" $Label[6] = "Department Number" $Label[7] = "Class Number" $Label[8] = "Quantity" $Label[9] = "Price Original" $Label[10] = "Price On Lookup" $Label[11] = "Price Before Discount" $Label[12] = "Reserved for Future" $Label[13] = "Price Indicator" $Label[14] = "Extended Total" $Label[15] = "Not On File" $Label[16] = "Entry Indicator" $Label[17] = "Taxable Indicator " $Label[18] = "Item Status" $Label[19] = "Raincheck " $Label[20] = "Gift Item" $Label[21] = "Package" $Label[22] = "Send Item Indicator" $Label[23] = "Send to Location" $Label[24] = "Team Associate Item" $Label[25] = "Team Number" EndFunc ;==>REC001 Func REC004($TLOG) ; StringType:004 Fee For $ind = 1 To 25 $record[$ind] = " " $record_parsed[$ind] = " " $Label[$ind] = "Not Used" Next $record[1] = StringMid($TLOG, 1, 3) $record[2] = StringMid($TLOG, 4, 1) $record[3] = StringMid($TLOG, 5, 8) $record[4] = StringMid($TLOG, 13, 10) $record[5] = StringMid($TLOG, 23, 1) $record[6] = StringMid($TLOG, 24, 1) $record[7] = StringMid($TLOG, 25, 1) $record[8] = StringMid($TLOG, 26, 2) $record[9] = StringMid($TLOG, 28, 10) $record[10] = StringMid($TLOG, 38, 1) If $record[2] = "1" Then $record_parsed[2] = "Voided" Else $record_parsed[2] = "Not Voided" EndIf $record_parsed[4] = Call("Dollar", $record[4]) Switch $record[5] Case "0" $record_parsed[5] = "Positive" Case "1" $record_parsed[5] = "Negative" Case "2" $record_parsed[5] = "Non Refundable Fee" EndSwitch Switch $record[6] Case "1" $record_parsed[6] = "Transaction-based" Case "0" $record_parsed[6] = "Item-based" EndSwitch Switch $record[7] Case "1" $record_parsed[7] = "Fee is returanble" Case "0" $record_parsed[7] = "Fee is not returnable" EndSwitch Switch $record[8] Case "1" $record_parsed[8] = "Amount-based" Case "0" $record_parsed[8] = "Percentage-based" EndSwitch $Label[1] = "Identifier" $Label[2] = "Void Indicator" $Label[3] = "Fee Code" $Label[4] = "Amount" $Label[5] = "Status Indicator" $Label[6] = "Fee Type Indicator" $Label[7] = "Return Indicator" $Label[8] = "Fee Calculation Type" $Label[9] = "Fee Value" $Label[10] = "Send Fee" EndFunc ;==>REC004 Thanks in advance for any help on this. plkace this text 0010048150 0000500730000010000000000399000000039900000003990000000000010000000399010000000000000 0010048627 0000500730000010000000000399000000039900000003990000000000010000000399011000000000000 0010047109 0000500730000010000000000399000000039900000003990000000000010000000399011000000000000 in a file named tlog.new in c:\ts\ or edit the variable line to place the file wherever you want.
-
i was able to get it figured out.. #include <Inet.au3> #include <json.au3> $url = "https://.flowgear.net/CLIST1?auth-key=<AUTHKEYHERE>" $data = _INetGetSource($url) $json = _JSON_Parse($data) $text = _JSON_Get($json, 'Data') ConsoleWrite($text)
-
I have search around in the forums, but not being very well versed in API calls makes it difficult to figure out what im really looking for so any help will be greatly appreciated. I need to make a call to the API URL and get the reply back and drop it into a text file. if i put the url in a webbrowser with the key i can get a respsonse, but not sure how to get this into a text file web response looks like this I only want the data... I have a URL and an authorization key but not having any luck... get_authentication_test() Func get_authentication_test() Local $oHttp = Null, _ $oComErr = Null Local $iHttpStatus = 0 Local $sResponse = "", _ $sPostData = "" ConsoleWrite(@CRLF & "Executing API" & @CRLF) ;Set COM error handler $oComErr = ObjEvent("AutoIT.Error", "com_error_handler") ;Create a HTTP COM object $oHttp = ObjCreate("winhttp.winhttprequest.5.1") If @error Then ConsoleWrite("Unable to create http request object." & @CRLF) Exit -1 EndIf ConsoleWrite("WinHttpRequest object created." & @CRLF) With $oHttp ;Open GET request .Open("GET", "https://.flowgear.net/CLIST4", False) ;Set request headers and options .SetRequestHeader("Content-Type", "application/json") ;Send request ;.Send('{"username":"admin","password":"123","clientId":"AUTOIT_TEST","clientSecret":"E5AE290AB76A4B1E"}') original .Send('{"clientSecret":"AUTHKEYHERE"}') If @error Then ConsoleWrite(StringFormat("SEND ERROR: (0x%X) %s", $oComErr.Number, $oComErr.Description) & @CRLF) Return EndIf ;Get status code and response $iHttpStatus = .Status $sResponse = .ResponseText ;If status code isn't okay If $iHttpStatus <> 200 Then ConsoleWrite("HTTP Status : " & String($iHttpStatus) & @CRLF) ConsoleWrite("HTTP Response: " & @CRLF & $sResponse & @CRLF) Return EndIf EndWith ConsoleWrite("API Response:" & @CRLF & $sResponse & @CRLF) EndFunc Func com_error_handler($oError) #forceref $oError Return EndFunc got above code from ..
-
I found my issue, i was pulling incorrect data on the first line $pretax = $storedata_5[$Line5][9] $e9 = StringFormat("%.8f", $pretax) & "|"
-
Hoping for quick help here. I ve looked at other posts and the autoit help on the stringformat command and its not helpful.. I need to take a number i pulled from an array and make sure it has 7 significant digits. i,e, 0.08375 is what is in the array i need it to show 0.0837500 not 0.08375 I have trying every way to using string format and nothing seems to work.. $pretax = $storedata_5[$Line5][10] $e11 =StringFormat($pretax,"%.8f") &"|" This is a puill from an excel sheet and it is stored as a numeric, above doesnt nothing does not add any trailing zeros. thanks in advanced.
-
Unwanted Data conversion in Excel
goodmanjl531 replied to goodmanjl531's topic in AutoIt General Help and Support
I was able to convert my dates to a standard date format and just use sting manipulation to create date in format i need. $predate = $storedata_5[$Line5][11] $e12 = StringLeft($predate, 4) & "-" & StringMid($predate, 5, 2) & "-" & StringMid($predate, 8, 2) & " 00:00:00.000|" $predate = $storedata_5[$Line5][12] $e13 = StringLeft($predate, 4) & "-" & StringMid($predate, 5, 2) & "-" & StringMid($predate, 8, 2) & " 00:00:00.000|" -
Unwanted Data conversion in Excel
goodmanjl531 replied to goodmanjl531's topic in AutoIt General Help and Support
i get no display when i use $storedata_5 = _Excel_RangeRead($oWorkbook, "TAX_RATE_RULE", "GROUP5",3) _ArrayDisplay($storedata_5,"TAX_RATE_RULE") getting error code of 8 8 - $iReturn = 3 can only return a single cell. $vRange specified > 1 cell. is there anyway around the 1 cell limit on $iReturn = 3 ? -
Unwanted Data conversion in Excel
goodmanjl531 replied to goodmanjl531's topic in AutoIt General Help and Support
I switched $storedata_5 = _Excel_RangeRead($oWorkbook, "TAX_RATE_RULE", "GROUP5",3) and now i get no data at all -
I have a complex excel sheet that has various data including taxes with trailing zeros(need 8 significant digits past decimal) i need to keep and date/time in a specific format (YYYY-MM-DD HH:MM:SS.000). I am using _Excel_RAngerRead to put all data in an array then pull data out to write to a text file for other uses, but it drops my trailing zeros and converts my dates to decimal anty ideas how to preserve format from excel to the text file? my spreadsheet will show below but when i run the script io will get INSERT|TAX_RATE_RULE|NA-US|00601|1|1||||0.08375|FULL|20200201000000|21991231000000||||*|* INSERT|TAX_RATE_RULE|NA-US|00602|1|1||||0.0675|FULL|20200201000000|20210731000000||||*|* INSERT|TAX_RATE_RULE|NA-US|00602|1|2||||0.0725|FULL|20210801000000|21991231000000||||*|* IT should look like below with proper date and significate digits on end INSERT|TAX_RATE_RULE|NA-US|00601|1|1||||0.083750|FULL|2020-02-01 00:00:00.000|2199-12-31 00:00:00.000||||*|* INSERT|TAX_RATE_RULE|NA-US|00602|1|1||||0.067500|FULL|2020-02-01 00:00:00.000|2021-07-31 00:00:00.000||||*|* INSERT|TAX_RATE_RULE|NA-US|00602|1|2||||0.072500|FULL|2021-08-01 00:00:00.000|2199-12-31 00:00:00.000||||*|* below is my code for this section (note some extra code removed for visibility Local $oExcel = _Excel_Open() If @error Then Exit MsgBox(16, "Excel UDF: _Excel_BookOpen", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) $sWorkbook1 = "C:\TS\tax\Tables.xlsx" ;******WORKBOOK to pull details ********** Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook1) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpen Example 1", "Error opening '" & $sWorkbook1 & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) $storedata_5 = _Excel_RangeRead($oWorkbook, "TAX_RATE_RULE", "GROUP5") For $Line5 = 1 To UBound($storedata_5) - 1 $e1 = $storedata_5[$Line5][0] & "|" $e2 = $storedata_5[$Line5][1] & "|" $e3 = $storedata_5[$Line5][2] & "|" $e4 = $storedata_5[$Line5][3] & "|" $e5 = $storedata_5[$Line5][4] & "|" $e6 = $storedata_5[$Line5][5] & "|" $e7 = $storedata_5[$Line5][6] & "|" $e8 = $storedata_5[$Line5][7] & "|" $e9 = $storedata_5[$Line5][8] & "|" $e10 = $storedata_5[$Line5][9] & "|" $e11 = $storedata_5[$Line5][10] & "|" $e12 = $storedata_5[$Line5][11] & "|" $e13 = $storedata_5[$Line5][12] & "|" $e14 = $storedata_5[$Line5][13] & "|" $e15 = $storedata_5[$Line5][14] & "|" $e16 = $storedata_5[$Line5][15] & "|" $e17 = $storedata_5[$Line5][16] & "|" $e18 = $storedata_5[$Line5][17] $CPF5 = FileOpen($file5, 1) FileWriteLine($CPF5, $e1 & $e2 & $e3 & $e4 & $e5 & $e6 & $e7 & $e8 & $e9 & $e10 & $e11 & $e12 & $e13 & $e14 & $e15 & $e16 & $e17 & $e18) Next FileClose($CPF5) Thanks in advance for help/ideas on this.
-
Script/Text/File Manager - Update 4/6/2015
goodmanjl531 replied to Valuater's topic in AutoIt Example Scripts
can you set up you program to search for multiple files with different names then copy them to another folder. i.e. *dog123 *dog542 *dog126 *dog1123 -
i run a mail merge on a gew word documents using an excel file as my source. I update the excel sheet first then save, then i open the word document click YES for the use my excel document and run SQL Then i will go to Mailings and click Finish & merge-->Edit new documents then copy all lines from the new document and dump into a simple text editor to finish I tried below code with no luck.. #include <Excel.au3> #include <MsgBoxConstants.au3> #include <Word.au3> Const $wdLabels = 0 Const $wdSendToNewDocument = 1 Const $wdSendToPrinter = 0 ; S:\IT\NEW-EPOS\Xstore-Image\XStoreBase\mnts\Tax\ NA TAX Tables.xlsx ; Create application object ;Local $oExcel = _Excel_Open() ;If @error Then Exit MsgBox(64, "Merge App", "Error creating the Excel application object." & @CRLF & "Missing Excel application") ; ***************************************************************************** ; Open an existing workbook and enter details for label(s). ; ***************************************************************************** ;Local $sWorkbook = "S:\IT\NEW-EPOS\Xstore-Image\XStoreBase\mnts\Tax\NA TAX Tables.xlsx" ;“file location“ ;Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook) ;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Merge App", "Error opening '" & $sWorkbook & "'." & @CRLF & "Missing necessary documents to run this application. Please contact IT Dept.") ;MsgBox(64, "Merge Apps", "Fill out. Click OK once completed.") ; Close the workbook with saving ;_Excel_BookClose($oWorkbook, True) $oWord=_Word_Create() Dim $sWordMailMergeDoc = "S:\IT\NEW-EPOS\Xstore-Image\XStoreBase\mnts\Tax\3.0-Tax_authority.docx" ;“file location“ Dim $oWordMailMergeDoc = _Word_DocOpen($oWord,$sWordMailMergeDoc) Dim $sDataSourceFileName = "S:\IT\NEW-EPOS\Xstore-Image\XStoreBase\mnts\Tax\"; NA TAX Tables.xlsx" ;“file location xlsx“ ;Get the exact data source connection string from your merge document Dim $sDataSourceConnectionString = 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=' & $sDataSourceFileName & ';Mode=Read;Extended Properties="HDR=YES;IMEX=1;FMT=XLSX;' Dim $sSQLStatement = 'SELECT * FROM `Merge App Data$`' With $oWordMailMergeDoc.MailMerge .MainDocumentType = $wdLabels .Destination = $wdSendToNewDocument .OpenDataSource($sDataSourceFileName, 0, False, False, True, False, "", "", False, "", "", $sDataSourceConnectionString, $sSQLStatement, "", Default, 1) .Datasource.FirstRecord = 1 .Datasource.LastRecord = 10 .Execute() EndWith _Word_Quit($oWord) ; close MS Word ANy ideas on how this could be automated ? I have 5 word docs to run the mail merge in. Thanks in advance
-
Move all files/folders/subfolders with progress bar
goodmanjl531 replied to Sky05's topic in AutoIt General Help and Support
@Subz First Great script!!!! can this be adapted easily for file deletion? I would also guess if I want this function to COPY instead of move I would simply change FileMove($g_sSource & "\" & $aSource[$i], $g_sTarget & "\" & $aSource[$i], 9) to FileCopy($g_sSource & "\" & $aSource[$i], $g_sTarget & "\" & $aSource[$i], 9) could you use DirCopy as well? -
Forgot about stringreplace function it worked perfectly i just added that to my output stream. Send("<start dtype=" & "{ASC 34}" & "Date" & "{ASC 34}" & ">" & StringReplace($currentFYWeekDate,"/","-") & "</start>"& @CR) Send("<end dtype=" & "{ASC 34}" & "Date" & "{ASC 34}" & ">" & StringReplace($currentFYweekDTEnd,"/","-") & "</end>"& @CR) Thanks for the help 🙂
-
I need to print out dates in a specfic format YYYY-MM-DD I can get it to work for the first time but since i am using _dateAdd function it converts my date to YYYY/MM/DD Any ideas on what im missing to convert it to the - instead of the / when outputting the data? $Date_FY_YearStart = GUICtrlCreateDate("2022-01-01", 23, 96, 134, 105) Local $sStyle = "yyyy-mm-dd" GUICtrlSendMsg($Date_FY_YearStart, $DTM_SETFORMATW, 0, $sStyle) $currentFYWeekDate = $FYStart $currentFYweekDTEnd = _DateAdd('D', 6, $FYStart) Send("<start dtype=" & "{ASC 34}" & "Date" & "{ASC 34}" & ">" & $currentFYWeekDate & "</start>"& @CR) Thanks in advance for any help.
-
date input and manipulation
goodmanjl531 replied to goodmanjl531's topic in AutoIt General Help and Support
figured out the issue i changed to. $Date_FY_YearStart = GUICtrlCreateDate("2022/01/01", 23, 96, 134, 105) Local $sStyle = "yyyy/MM/dd" GUICtrlSendMsg($Date_FY_YearStart, $DTM_SETFORMATW, 0, $sStyle) and it works. -
date input and manipulation
goodmanjl531 replied to goodmanjl531's topic in AutoIt General Help and Support
the input is pulled from the GUI $Date_FS = GUICtrlCreateDate("2022/01/01", 23, 96, 134, 105) $FYStart = GUICtrlRead($Date_FS) $currentFYWeekDate=$FYStart $currentFYweekDTEnd=_DateAdd('D',6,$currentFYWeekDate) -
date input and manipulation
goodmanjl531 replied to goodmanjl531's topic in AutoIt General Help and Support
i get error code 3 invalid date which is odd as the date before the function is a proper date -
I am trying to create a calendar generator I use a date control GUI to pick start date. I then need to add 6 days to get the last day of the week picked. Then i want to add a week to each to move week by week( I am assuming original date will be a sunday) part of my code... the msgbox with the $currentFYweekDTEnd shows a 0 then when i add the 2 dates at the end i get errors. so the _dateadd is not working right. Thanks in Advance for any and all help #include <date.au3> #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1_1 = GUICreate("Fiscal Year Builder", 385, 487, 285, 125) $Input_Fiscal_Year = GUICtrlCreateInput("YYYY", 191, 16, 78, 21) $Label1 = GUICtrlCreateLabel("Fiscal Year", 39, 16, 53, 17) $Group1 = GUICtrlCreateGroup("Weeks per QTR", 191, 224, 110, 97) $Radio1 = GUICtrlCreateRadio("4-5-4", 215, 248, 81, 25) GUICtrlSetState(-1, $GUI_CHECKED) $Radio2 = GUICtrlCreateRadio("4-5-5", 215, 288, 89, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Weeks in Year", 23, 224, 110, 97) $Radio3 = GUICtrlCreateRadio("52", 39, 248, 65, 33) GUICtrlSetState(-1, $GUI_CHECKED) $Radio4 = GUICtrlCreateRadio("53", 39, 288, 65, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Date_FS = GUICtrlCreateDate("2022/01/01", 23, 96, 134, 105) $Button1 = GUICtrlCreateButton("Generate", 95, 344, 166, 81) $DATE_FE = GUICtrlCreateDate("2022/01/01", 191, 99, 134, 105) $Label2 = GUICtrlCreateLabel("Fiscal Start Date", 39, 56, 79, 17) $Label3 = GUICtrlCreateLabel("Fiscal End Date", 191, 56, 76, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 createcalendar() EndSwitch wend Exit func createcalendar() $Fiscal_Year=GUICtrlRead($Input_Fiscal_Year) $weeks454=GUICtrlread($Radio1) $weeks455=GUICtrlRead($Radio2) $52weeks=GUICtrlRead($Radio3) $53weeks=GUICtrlRead($Radio4) $FYStart = GUICtrlRead($Date_FS) $FYEnd = GUICtrlRead($DATE_FE) If $weeks454 =1 then $weeks1=4 $weeks2=5 $weeks3=4 Else $weeks1=4 $weeks2=5 $weeks3=5 EndIf If $52weeks = 1 Then $TotalWeeks=52 Else $TotalWeeks=53 EndIf ;MAIn Counters $current_month=1 $current_Qtr=1 $current_week=1 $monthsInQtr=1 $CurrentWeekInMonth=1 $currentFYWeekDate=$FYStart $currentFYweekDTEnd=_DateAdd('d',6,$currentFYWeekDate) MsgBox(0,""," S Date:"& $currentFYWeekDate &@CRLF &"E DATE:"&$currentFYweekDTEnd) While $current_week <= $TotalWeeks Select Case $current_month = 1 or 4 or 7 or 10 $TotalWeekInMonth = $weeks1 Case $current_month = 2 or 5 or 8 or 11 $TotalWeekInMonth = $weeks2 Case $current_month = 3 or 6 or 9 or 12 $TotalWeekInMonth = $weeks3 EndSelect MsgBox(0,"","FY:" & $Fiscal_Year & @CRLF &"QTR:" & $current_Qtr & @CRLF & "Month:" & $current_month & @CRLF & "Week:" & $current_week & @CRLF & "Start date:" &$currentFYWeekDate & @CRLF & "End date: " & $currentFYweekDTEnd) $current_week = $current_week + 1 $CurrentWeekInMonth = $CurrentWeekInMonth+1 $currentFYWeekDate = _DateAdd('w',1,$currentFYWeekDate) $currentFYweekDTEnd= _DateAdd('w',1,$currentFYweekDTEnd) If $CurrentWeekInMonth > $TotalWeekInMonth Then $CurrentWeekInMonth=1 $current_month =$current_month +1 $monthsInQtr =$monthsInQtr + 1 EndIf If $monthsInQtr = 4 Then $current_Qtr =$current_Qtr +1 $monthsInQtr = 1 EndIf WEnd EndFunc
-
call a spowershell script to run elevated
goodmanjl531 replied to goodmanjl531's topic in AutoIt General Help and Support
was able to find answer.. RunAsWait($sUserName, @ComputerName, $sPassword, 0, "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy Bypass -file c:\ts\Reconfigure-Printer-V0.5.ps1") -
I am trying to run a powershell script elevated that will add a new printer port. the powershell script works fine when call from an elevated command prompt but I can't seem to call this via auto it. Local $sUserName = "" ; Place Admin User ID here. Local $sPassword = "" ; Place Admin Password here. #include <Date.au3> SplashTextOn(" Inc.","Running Printer IP update Please Wait.....","-1","-1","-1","-1",0,"","","") _WriteLog("Installation Started : ") FileInstall("C:\TS\CloudScripts\Reconfigure-Printer-V0.5.ps1","C:\ts\Reconfigure-Printer-V0.5.ps1",1) $Result = RunAsWait($sUserName, @ComputerName, $sPassword, 0,@ComSpec & " /c " & 'powershell.exe -file Reconfigure-Printer-V0.5.ps1', "", @SW_HIDE) _WriteLog("POWERSHELL SCRIPT RAN : " & $Result) ;$Result=RunAsWait($sUserName, @ComputerName, $sPassword, 0, "powershell.exe -file Reconfigure-Printer-V0.5.ps1"); Run Powershell script to rest printer ;_WriteLog("CBTS Powersehll script executed :"& $Result) Sleep(5000) _WriteLog("Installation Completed: ") SplashOff() SplashTextOn(" Inc.","Printer RE-IP Complete","-1","-1","-1","-1",0,"","","") Sleep(5000) SplashOff() Func _WriteLog($Message) FileWriteLine(@ScriptDir & "\" & @ScriptName & ".log", @YEAR & @MON & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & ": " & $Message) EndFunc ;==>_WriteLog