-
Posts
32 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
stick3r's Achievements

Seeker (1/7)
0
Reputation
-
Excel NumberFormat not working correctly
stick3r replied to stick3r's topic in AutoIt General Help and Support
Whoo, this worked. Thanks! -
Excel NumberFormat not working correctly
stick3r replied to stick3r's topic in AutoIt General Help and Support
There are several of those. Country and Region - Sweden, Windows display language - English (United States), and in Region > Formats > Format: English (Sweden) -
Hi, I have excel with couple of sheets with numbers. I do some stuff with excel before and then I have this NumberFormat: 49252138,87 49252138,87 0,00 -22099,24 -22099,24 0,00 49230039,63 4,90 4,90 0,00 228390,07 0,00 228390,07 0,00 0,00 0,00 4,90 360000000,00 360000000,00 0,00 360000000,00 3349269,10 3349269,10 0,00 I change NumberFormat to Number, with 1000 separator and I get what I need - separated by dot and decimals separated by comma: 49.252.138,87 49.252.138,87 0,00 -22.099,24 -22.099,24 0,00 49.230.039,63 4,90 4,90 0,00 228.390,07 0,00 228.390,07 0,00 0,00 0,00 4,90 360.000.000,00 360.000.000,00 0,00 360.000.000,00 3.349.269,10 3.349.269,10 0,00 Macro recorded is this: Range("F42:H51").Select Selection.NumberFormat = "#,##0.00" I added this line to code: $o_Excel.Worksheets(2).Range("F42:H51").NumberFormat = "#,##0.00" What I get is this: 49252138,87000 49252138,87000 ,000 -22099,24000 -22099,24000 ,000 49230039,63000 4,9000 4,9000 ,000 228390,07000 ,000 228390,07000 ,000 ,000 ,000 4,9000 360000000,000 360000000,000 ,000 360000000,000 3349269,1000 3349269,1000 ,000 Any ideas how to fix this to show correctly? Thanks
-
stick3r reacted to a post in a topic: Conditional Formatting Excel VBA to AutoIT
-
Conditional Formatting Excel VBA to AutoIT
stick3r replied to BJR's topic in AutoIt General Help and Support
Hi, I have similar issue. Recorder Macro to have Conditional formatting for Less than 0 numbers to be in red: Range("B12:D38").Select Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _ Formula1:="=0" Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False My AutoIt Code with integrated above macro: #include <Excel.au3> $oExcel = _Excel_Open() Sleep(200) $oWB = _Excel_BookAttach("Template.xlsx", "filename") $oExcel.Range("B12:D38").Select $oExcel.Selection.FormatConditions.Add(1, 6, "=""0""", "") $oExcel.Selection.FormatConditions($oExcel.Selection.FormatConditions.Count).SetFirstPriority With $oExcel.Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 EndWith $oExcel.Selection.FormatConditions(1).StopIfTrue = False Problem is that AutoIt marks ALL numbers in red, not those less than 0. When recording macro and setting Conditional formatting manually, all works good and only less than 0 numbers are in red. Any ideas? Thanks. EDIT: Found the issue in line: $oExcel.Selection.FormatConditions.Add(1, 6, "=0", "") There were too many quotation marks... -
While loop calling GUI() several times
stick3r replied to stick3r's topic in AutoIt GUI Help and Support
Basically, what I need to do is, in case of wrong input from user, I want to come back to GUI() and give a chance for user to correct input and start again. In theory user might input some info many times in the row to GUI(), which can only be verified in the system. i.e. I check if input is 10 digits, but if it is legit number, only a system can tell. Something like below: Func Main() $arrGuiReturnData = GUI() $returnData = DataFromSystem($arrGuiReturnData) If @error = 1 Then Main() EndFunc Func GUI() While 1 GUISetState(@SW_SHOW) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btnGo GUISetState(@SW_HIDE) Return $arrGuiReturnData EndSwitch WEnd EndFunc What is the best way to come back to GUI() and give a chance to user to correct input? -
While loop calling GUI() several times
stick3r replied to stick3r's topic in AutoIt GUI Help and Support
What about second code? Is it better way? -
Hi, I have a code, where I start my script with func GUI(), hide GUi with GUISetState(@SW_Hide) and then call Main(), doing stuff in Main() and then in some cases I call GUI() again. Func GUI() While 1 GUISetState(@SW_SHOW) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btnGo GUISetState(@SW_Hide) Main() EndSwitch WEnd EndFunc Func Main() . . . GUI() EndFunc My question is: How many While loops are looping after I call GUI() second time from Main()? Am I creating second While 1..... loop, or does it open the same loop? And what if I Return something from func GUI(). Then I believe I exit func completely - therefore While loop ends for sure and next time I call Main, it starts func GUI() from scratch? Func Main() $arrGuiReturnData = GUI() . . Main() . . EndFunc Func GUI() While 1 GUISetState(@SW_SHOW) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btnGo GUISetState(@SW_HIDE) Return $arrGuiReturnData EndSwitch WEnd EndFunc
-
Hi, I used older version of AutoIt and ArrayDisplay had these buttons of Copy data, copy data and rows/columns number, Exit script. I am on latest version and these buttons are gone. It was very convenient. Is it possible to get it back?
-
Yeap, that is correct. This is that one table. I tried checking with it, but I am not sure how to do it correctly :) Since this web page is not public, I can not access and test it at home. I tried something like this and it did not work. Not sure if it was exactly the same. Is this the right logic? P.S. There are 3 links in a $arrTableData column - distribution, details and delete. Others are texts. $ColumnNumber = 1 For $objLink In $objLinks Local $strLinkText = _IEPropertyGet($objLink, "innerText") If StringInStr($strLinkText, "distribution") And $arrTableData[2][$ColumnNumber] = “Once” Then _IEAction($objLink, "click") _selectAddToSchedule() $ColumnNumber = $ColumnNumber + 1 EndIf Next
-
Hi, I am trying to improve my colleagues written script. He is not working here anymore, so I can not discuss with him :) This is a working code. It gets all links and clicks on one with "distribution" and then does other things in _selectAddToSchedule(). $objFrame = _IEFrameGetObjByName($g_objIE, "SCHED_FRAME") $objForm = _IEFormGetObjByName($objFrame, "form") Local $objTable = _IETableGetCollection($objForm, 0) Local $arrTableData = _IETableWriteToArray($objTable) Local $ColumnNumber = 1 Local $objLinks = _IELinkGetCollection($objForm) For $objLink In $objLinks Local $strLinkText = _IEPropertyGet($objLink, "innerText") If StringInStr($strLinkText, "distribution") Then _IEAction($objLink, "click") _selectAddToSchedule() EndIf Next What I need to do is not to click on "distribution" every time. There might be 5 distributions to click on and do things, but I only need it to click depending on one condition. Row Col 0 Col 1 Col 2 [0] Customer NAME NAME [1] Report Fx Fx [2] Interval Once Yearly [3] Next Report Date Fri 29 Mar Tue 31 Dec [4] Schd Id 9999 4009 [5] Active [6] No Suppr [7] distribution distribution [8] details details [9] delete delete Here is a table from the same form. In row 7 there is that link "distribution". But I only need it to click on distribution if row 2 is "Once". In this case only one time. No need to click second time, where row 2 is Yearly. Row 2 is not a link. Therefore it does not get into the collection of $objLinks. It is only text. Any ideas how to do it?
-
Hi, What I need is to split 1D array into 2D array and to have something like: Col0 Col1 Col2 Row0 B Erik Erikson Row1 A John Johnson I am trying to use help file and made something what does not work ;My $ArrayUnique is this: ;Row Col 0 ;[0] B,Erik,Erikson ;[1] A,John,Johnson ;[2] A,Martin,Martinson ;[3] E,Olaf,Olafson Local $aUniqueSplited[1][3] For $i = 0 To UBound($ArrayUnique) - 1 Local $sText = $ArrayUnique[$i] Local $aArray = StringSplit($sText, ',') For $y = 1 To $aArray[0] For $z = 0 To UBound($ArrayUnique) - 1 $aUniqueSplited[$z][$y-1] = $aArray[$y] Next Next Next First I create new array to be filled, but I dont know how many rows I am gonna have. Could be from 1 to 100 maybe. I need 3 columns, so this part is OK. And then it breaks here if I set my array to 1 row and I actually have 4 like in this example: $aUniqueSplited[$z][$y-1] = $aArray[$y] If I set row number to 4, then it fills all array with B Erik Erikson. What am I doing wrong?
-
Thank you for explaining!
-
Hi, I have this script and I need to reset all checkboxes to UNCHECKED when button is pressed. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form = GUICreate("Checklist", 190, 407, 1233, 178) Global $text = "" Global $CheckBox GUICtrlCreateTab(1, 1, 190, 365) GUICtrlCreateTabItem("TAB 1") Global $InputCaseID1 = GUICtrlCreateInput($text, 80, 25, 80, 21) Global $lblCaseID = GUICtrlCreateLabel("Case ID", 8, 30, 68, 18) Global $CheckBox1 = GUICtrlCreateCheckbox("1111111", 8, 48, 110, 17) Global $CheckBox2 = GUICtrlCreateCheckbox("2222222", 8, 72, 110, 17) Global $CheckBox3 = GUICtrlCreateCheckbox("333333333", 8, 96, 110, 17) Global $CheckBox4 = GUICtrlCreateCheckbox("444444444", 8, 120, 110, 17) Global $CheckBox5 = GUICtrlCreateCheckbox("55555555", 8, 144, 110, 17) Global $CheckBox6 = GUICtrlCreateCheckbox("666666666", 8, 168, 110, 17) Global $CheckBox7 = GUICtrlCreateCheckbox("77777777", 8, 192, 150, 17) Global $CheckBox8 = GUICtrlCreateCheckbox("888888888", 8, 216, 150, 17) Global $CheckBox9 = GUICtrlCreateCheckbox("99999999", 8, 240, 110, 17) Global $CheckBox10 = GUICtrlCreateCheckbox("45646", 8, 264, 110, 17) Global $CheckBox11 = GUICtrlCreateCheckbox("4345634", 8, 288, 97, 17) Global $CheckBox12 = GUICtrlCreateCheckbox("4563456", 8, 312, 97, 17) Global $CheckBox13 = GUICtrlCreateCheckbox("456456", 8, 336, 97, 17) GUICtrlCreateTabItem("TAB 2") Global $InputCaseID2 = GUICtrlCreateInput("", 80, 25, 80, 21) Global $lblCaseID = GUICtrlCreateLabel("Case ID", 8, 30, 68, 18) Global $CheckBox14 = GUICtrlCreateCheckbox("AAAAAAA", 8, 48, 110, 17) Global $CheckBox15 = GUICtrlCreateCheckbox("PPPPPPPPP", 8, 72, 110, 17) Global $CheckBox16 = GUICtrlCreateCheckbox("BBBBBBBB", 8, 96, 110, 17) Global $CheckBox17 = GUICtrlCreateCheckbox("CCCCCCCCCCCCC", 8, 120, 110, 17) Global $CheckBox18 = GUICtrlCreateCheckbox("DDDDDDDDDDDDD", 8, 144, 110, 17) Global $CheckBox19 = GUICtrlCreateCheckbox("EEEEEEEEEE", 8, 168, 110, 17) Global $CheckBox20 = GUICtrlCreateCheckbox("FFFFFFFFFFF", 8, 192, 150, 17) Global $CheckBox21 = GUICtrlCreateCheckbox("GGGGGGGGGG", 8, 216, 150, 17) Global $CheckBox22 = GUICtrlCreateCheckbox("HHHHHHHHH", 8, 240, 110, 17) Global $CheckBox23 = GUICtrlCreateCheckbox("IIIIIIIII", 8, 264, 110, 17) Global $CheckBox24 = GUICtrlCreateCheckbox("JJJJJJJ", 8, 288, 97, 17) Global $CheckBox25 = GUICtrlCreateCheckbox("KKKKKKKKKKK", 8, 312, 97, 17) Global $CheckBox26 = GUICtrlCreateCheckbox("LLLLLLLLL", 8, 336, 97, 17) GUICtrlCreateTabItem("") Global $CheckBoxAlwaysOnTop = GUICtrlCreateCheckbox("Always on Top", 8, 380, 97, 17) Global $btnReset = GUICtrlCreateButton("RESET", 104, 365, 75, 41) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $CheckBoxAlwaysOnTop _SetAlwaysOnTop() Case $btnReset For $i = 7 To 19 Step 1 ;Remove checked CheckBoxes GUICtrlSetState($CheckBox&$i, $GUI_UNCHECKED) Next For $i = 23 To 35 Step 1 GUICtrlSetState($CheckBox&$i, $GUI_UNCHECKED) Next GUICtrlSetData($InputCaseID1, "") GUICtrlSetData($InputCaseID2, "") EndSwitch WEnd Func _SetAlwaysOnTop() If GUICtrlRead($CheckBoxAlwaysOnTop) = $GUI_CHECKED Then WinSetOnTop($Form, "", 1) ;On top Else WinSetOnTop($Form, "", 0) ;Not on top EndIf EndFunc ;==>_SetAlwaysOnTop My question is: Why this For loop for GUICtrlSetState($CheckBox&$i, $GUI_UNCHECKED) does not work properly I have $CheckBox1, $CheckBox2.......till $CheckBox26 and with For $i = 1 To 26 it does not work. It only unchecks few of them, but not all. Later I have discovered that For $i = 7 To 19 removes $CheckBox1 to $CheckBox13 and For $i = 23 To 35 removes $CheckBox14 to $CheckBox26 Any idea why?
-
How to filter Excel column with part of the value
stick3r replied to stick3r's topic in AutoIt General Help and Support
Thanks, @FrancescoDiMuro This is a possible solution, but it would work better for me to have all columns together with filtered numbers, as there is also important information in other columns I will have to work with. @water, I have found a solution with _Excel_FilterSet, as $mynumber should always be 5 digits and then 3 extra, so this should find everything I need. _Excel_FilterSet($oWorkbook, Default, "A1", 1, ">=" & $mynumber & "000", 1, "<=" & $mynumber & "999") I have found something strange with asterisk code. $oExcel.ActiveSheet.Columns("B").AutoFilter(1, "A*", $xlFilterValues) This actually works on other columns and find everything starting with "A", but not on column A with the numbers. I have tried to copy paste column A to any other, but still it would not filter correctly. I will try to play with it and maybe I will find the issue, and if you will come up with some ideas, please come back. Thanks for your help. -
How to filter Excel column with part of the value
stick3r replied to stick3r's topic in AutoIt General Help and Support
At the beginning it was General, but I have tried Text and Numbers now, still the same empty filtered excel.