Search the Community
Showing results for tags 'columns'.
-
How to use _Excel_RangeSort to sort my excel file by three different headers Column A1, B1, and C1 have headers on which I want to sort by. The headers on which I want to sort are department, employee type, and name. I still really new to AutoIt so I do not actually know how to properly start this line or lines of code, to be honest. The example code is the best I can do. _Excel_RangeSort($OpenWorkbook, Default, "A1:C1", "1:1", $xlDescending, Default, $xlYes, Default, $xlSortRows) I just need to sort by those three headers in that order of department, employee type, and name, plus in descending order. any and all help would be greatly appreciated. Thank you!
-
Hello I am relatively new to the world of Microsoft Office and the Excel UDF. I am trying to loop through every row in a spreadsheet and get the text/values from each column in the given row... so far I have looked into the Help file for the Excel UDF and the wiki page for Excel UDF but I have no idea about how this is done ... This is all I have in my script: Global $oExcel = _Excel_Open(False, False, False, False, True) Global Const $sSpreadsheet = @ScriptDir & '\data.xlsx' Global $oSpreadsheet = _Excel_BookOpen($oExcel, $sSpreadsheet, True, False) ; ... I am placing my bet on the _Excel_Range functions... especially _Excel_RangeRead. I don't know how $vRange works so I would be glad if someone can point me in the right direction . What I would ideally like is to get all of the contents of the spreadsheet (it's just a normal text one) in a 2D array. Thanks in Advance!
-
I import CSV files which have various headers. Is there a way to simply keep only the ones I need and in the order I need them in? For example, if the array's first row's values are Foo Bar Test This, then I want to turn them to Foo This Bar. Here's how I do it "manually" with _ArrayColDelete and _ArraySwap, but I want to use something smarter like rearrange($aArray, ["Foo", "This", "Bar"]): #include <Array.au3> Local $aArray[4][4] = [["Foo", "Bar", "Test", "This"], [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] _ArrayDisplay($aArray, "Original") _ArrayColDelete($aArray, 2) ;2 stands for Test, but next time Test might not be 2, but it will still be called "Test" _ArraySwap($aArray, 1, 2, true) ;1 and 2 might be different next time, but their names will remain _ArrayDisplay($aArray, "Modified") If it helps, I do the same thing in VBA based on Sub Reorganize_columns (the second/alternative example in that page).
-
I am very new to Autoit and pretty new to scripting altogether.I have a PowerShell script that pulls owner info from folders on our file share server. There are 3 owners for every folder, Domain Admin, User setup for network scanning and the user. I am trying to copy the username only from this txt file. I have gotten as far as to being able to read the lines in the txt file but can't seem to read the columns. This is what i have so far. #include <File.au3> $file = "c:\test01.txt" FileOpen($file, 0) For $i = 5 to _FileCountLines($file) $line = FileReadLine($file, $i) msgbox(0,'','the line ' & $i & ' is ' & $line & 'and the column is') Next FileClose($file) This is the outcome..... This is the txt file I am trying to copy the ABC part without the MyDomain\. I know it's line 5 and columns 11-14 of the txt file but i can't figure out how to read it. I hope i'm explaining this correctly.
-
I know to use _Excel_RangeRead to read the Column titles by: getting the list of Worksheets using _Excel_SheetList, open each worksheet etc etc but could I do it by using _Excel_RangeFind. Anyway I don't know the command to set the Range to "dd/mm/yyyy" Could anybody give me an example above? - setting the formatting please Joe
-
Let's say that I want to loop the numbers 1 through 5, and on each iteration it should write to the next column in Excel. So, I just want to put the number 1 in A1, 2 in B1, 3 in C1, 4 in D1, and 5 in D1. How do I increase the column letter programamatically with the new Excel UDF? Thanks! For $iStartingColumn = 1 To 5 _Excel_RangeWrite($oWorkbook, Default, $iCC, $iStartingColumn & "1") Next
-
I recently managed to make a ListView sort correctly by clicking on it's columns, it does sort items very well but there's a very annoying thing >_< : every time after the items are sorted out, an item gets focused ! After I click a column, one item gets blue'd, like when its selected, even if its not ! Note that this happens only becuase of this function : _GUICtrlListView_SimpleSort Instead, the _GUICtrlListView_SortItems function is not doing this , but because of my luck,I must use _GUICtrlListView_SimpleSort ( but it is faster ) Here's my script to test to see what I mean: #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> $Form1 = GUICreate("Form1", 383, 307, 192, 124) $ListView1 = GUICtrlCreateListView("C1|C2|C3", 56, 16, 257, 241) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) $ListView1_0 = GUICtrlCreateListViewItem("1|5|6", $ListView1) $ListView1_1 = GUICtrlCreateListViewItem("2|7|8", $ListView1) $ListView1_2 = GUICtrlCreateListViewItem("3|9|10", $ListView1) $ListView1_3 = GUICtrlCreateListViewItem("4|11|12", $ListView1) GUISetState(@SW_SHOW) Global $toggle = 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ListView1 _GUICtrlListView_SimpleSort($ListView1, $toggle, GUICtrlGetState($ListView1)) EndSwitch WEnd How could I get rid of this item focus ?