
graybags
Active Members-
Posts
52 -
Joined
-
Last visited
Everything posted by graybags
-
How would I use the AD udf for this?
graybags replied to graybags's topic in AutoIt General Help and Support
That was one of the first things I tried, but it didn't work, just gave me a -1 error. -
Hi, I'm currently using this script to generate an array called $usernames which just contains the members of an AD group: #include <Array.au3> $objGroup = ObjGet("LDAP://cn=just_a_group,ou=groups,dc=here,dc=com") $objGroup.GetInfo $arrMemberOf = $objGroup.GetEx("member") Local $usernames[UBound($arrMemberOf)] For $i = 0 To UBound($arrMemberOf) - 1 $usernames[$i] = $arrMemberOf[$i] Next It works fine, but I never wrote it and I'd normally use the AD udf to do it. But I've tried and failed! How would I do the above with the AD udf? Thanks, Graybags
-
Ah yes, that works thanks. I've run it for a workbook I have and I'm selecting various sheets. For one it's still listing a huge list of rows (1871) for a worksheet with only 38 used ones. I've scrolled down to that row and indeed that row and beyond have cells with borders, so someone has obviously done something odd with spreadsheet in the past, and I don't have any control of that. If I create a blank sheet and copy and paste the "real" data the console tells me tells me: $A1:$A38 $B1:$B38 $C1:$C38 $D1:$D38 $E1:$E38 $F1:$F38 $G1:$G38 $H1:$H38 $I1:$I38 $J1:$J38 ...which is correct. But I can't correct every sheet like I did as the user chooses the sheets. It looks like I might have to bite the bullet and just ask the user to input the tab. Thanks again for your help, I thought we were getting close. Somebody needs to write a UsedRangeWithDataActuallyInACell function
-
#include <Excel.au3> #include <MsgBoxConstants.au3> ; Create application object Local $oExcel = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpen Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; Open an existing workbook and return its object identifier. Local $sWorkbook = @ScriptDir & "\test.xlsx" Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpen Example 1", "Error opening '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpen Example 1", "Workbook '" & $sWorkbook & "' has been opened successfully." & @CRLF & @CRLF & "Creation Date: " & $oWorkbook.BuiltinDocumentProperties("Creation Date").Value) ; Read data from a single cell on the active sheet of the specified workbook Local $sResult = _Excel_RangeRead($oWorkbook, Default, "A1") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 1", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 1", "Data successfully read." & @CRLF & "Value of cell A1: " & $sResult) $oWorksheet = $oWorkbook.Sheets(2).Activate For $oColumn In $oWorksheet.UsedRange.Columns ConsoleWrite($oColumn.Address(False, True) & @CRLF) Next ok, just using that as a really simple example to test things, i'm getting an error: Variable must be of type "Object".: For $oColumn In $oWorksheet.UsedRange.Columns For $oColumn In $oWorksheet^ ERROR what have I done wrong???
-
Yeah, i figured Excel would remember a cell that had been touched and deleted and label that as used. Damn. I was hoping there was a way to see if the column something in, kind of a CurrentlyUsedRange object The headers on each worksheet are different, so I can't do that. Oh well, thanks for reading, I'll guess I have to just get the user to manually imput their column like I am.
-
Hi, This has really stumped me! My script so far allows a user to open a workbook and then reads in the names of the worksheets into an array. But now I need to get the user to choose which column in their chosen worksheet has the data they are interested in, by bringing up a list of the used columns on the worksheet. So they browse to a workbook, then they select the worksheet from a list, and then I'd like another list to appear showing "A B C D..." on so on, for however many columns that worksheet uses. Is that possible? Thanks!
-
How to close a gui quicker than it does!
graybags replied to graybags's topic in AutoIt General Help and Support
Oh dear, that must have been a typo! 🥴 -
How to close a gui quicker than it does!
graybags replied to graybags's topic in AutoIt General Help and Support
Excellent, thanks for the replies above. Both of those worked perfectly, but I could only mark one as the solution. -
How to close a gui quicker than it does!
graybags replied to graybags's topic in AutoIt General Help and Support
Thanks for the reply. No, that still doesn't close the gui as soon as the "X" is clicked. -
Hi, I've got a really simple script that just shows the time of a remote computer. But, due to the way it's written, I can't close the gui immediately. Is there a way around this? Thanks, Graybags #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <array.au3> $Computer = "xxx" Local $timestamp $GUI = GUICreate( $computer & " time", 150, 80, "", "", BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD)) WinSetOnTop ($GUI, "", 1) GUICtrlSetFont ( -1, "10", "800", "", "Consolas" ) GUICtrlCreateLabel( $timestamp, 20, 10, 120, 350) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch $aTime = TimeCalc($Computer) WEnd Func TimeCalc($Computer) $Cmd_out = _GetDOSOutput("net time \\" & $Computer) If $Cmd_out <> "" Then $Cmd_array = StringSplit($Cmd_out, "is ", 1) $Cmd_array2 = StringSplit($Cmd_array[2], @CRLF, 1) $Cmd_array3 = StringSplit($Cmd_array2[1], " ", 1) $timestamp = $cmd_array3[2] GUICtrlSetFont ( -1, "18", "800", "", "Consolas" ) GUICtrlSetData ( -1, $timestamp ) Sleep(60000) EndIf EndFunc Func _GetDOSOutput($sCommand) Local $iPID, $sOutput = "" $iPID = Run('"' & @ComSpec & '" /c ' & $sCommand, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $sOutput &= StdoutRead($iPID, False, False) If @error Then ExitLoop EndIf WEnd Return $sOutput EndFunc
-
Hi, This looks like a really handy UDF. We've just migrated all our printers from one server to another. Is there a way I could use the UDF to create a script that could be run on a user's PC, that would delete all the printer connections on the old server? i.e. _RemovePrinter \\ser000001\* Thanks, Graybags