Jump to content

nhalme

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by nhalme

  1. Thanks GEOSoft! Your advice solved the problem.
  2. Hi, Im trying to list all the groups in an OU in a list control (GUICtrlCreateList). The idea is taken from "Hey, Scripting Guy! How Can I List All the Groups in an OU?" And the idea is done in HTA like this: <html> <head> <title>List All the Groups in an OU</title> <HTA:APPLICATION ID="HTA" APPLICATIONNAME="ADGroups" SCROLL="yes" SINGLEINSTANCE="yes" WINDOWSTATE="normal" > </head> <script Language="VBScript"> Sub Window_onload Set objOU = GetObject("LDAP://ou=Security Groups,ou=Managed Objects,dc=contoso,dc=com") ObjOU.Filter= Array("Group") For Each objGroup in objOU Set objOption = document.createElement("OPTION") objOption.Text = objGroup.Name objOption.Value = objGroup.Name AppsGroups.Add(objOption) Next End Sub </SCRIPT> <body> <select size="5" name="AppsGroups"></select> </body> </html>So Im trying to do the same with AutoIT. I want to use list control (GUICtrlCreateList) to display the results. I can get the results to a txt file: #include <Array.au3> Local $colCroups, $sTmp, $Array[1] = ["Group"] $colGroups = ObjGet("LDAP://ou=Security Groups,ou=Managed Objects,dc=contoso,dc=com") $colGroups.Filter = $Array $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf For $objGroup In $colGroups $sTmp = $objGroup.Name & @CRLF FileWrite($file, $sTmp) Next FileClose($file)or display it in an array (thanks to smashly): #include <Array.au3> $ListGroups = _ListGroups() If Not @error Then _ArrayDisplay($ListGroups, "List Groups") Func _ListGroups() Local $colCroups, $sTmp, $Array[1] = ["Group"] $colGroups = ObjGet("LDAP://ou=Security Groups,ou=Managed Objects,dc=contoso,dc=com") If Not IsObj($colGroups) Then Return SetError(1, 0, 0) $colGroups.Filter = $Array For $objGroup In $colGroups $sTmp &= $objGroup.Name & "|" Next Return SetError(0, 0, StringSplit(StringTrimRight($sTmp, 1), "|")) EndFunc ;==>_ListGroupsbut not in a list control. Can someone help me? Should not that hard, but I just cannot solve this by myself. Here is one of my tests to get it work: #include <Array.au3> $MainGUI=GUICreate("List AD Groups", 220, 250, 100, 200) Global $colCroups, $sTmp, $Array[1] = ["Group"] $colGroups = ObjGet("LDAP://ou=Security Groups,ou=Managed Objects,dc=contoso,dc=com") $colGroups.Filter = $Array For $objGroup In $colGroups $sTmp = $objGroup.Name & "|" Next $ListGroups =StringSplit(StringTrimRight($sTmp, 1), "|") $list = GUICtrlCreateList($ListGroups, 10, 10, 200, 150) ;******************************************************************************** ; Display the Main GUI ;******************************************************************************** GUISetState(@SW_SHOW); will display the dialog box While 1 Sleep(1000); Idle around WEnd
  3. I have tried to find a solution as well. This is what I have found... $strComputer = "." $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\SecurityCenter") $colItems = $oWMI.ExecQuery("Select * from AntiVirusProduct"); "from FirewallProduct" works as well For $objAntiVirusProduct In $colItems MsgBox(0, "AntiVirusProduct", $objAntiVirusProduct.displayName) Next But for example in my Vista SP1 it does not return anything, but if I put "\root\SecurityCenter2" then it finds the product. On XP "\root\SecurityCenter" works. If somebody has a better way to check Antivirus proudut please share your info. Thanks!
  4. I apologize, KabirSoftInc, for opening this thread, but I at least got some new tips from it Not to show my code, only share so perhaps someone newbie like me could have some other options as well. Would it be better to make a new thread? I'm new on this threading stuff That is true and it works perfectly! So my code and comments can be thrown away I like this style. This is totally the best solution! Thank you so much, MrCreatoR, for the good tips. In a way Im glad that I reopened the thread
  5. Hi, I did not like the command prompt window (@comspec & " /c " ....etc.) even it shows up only for half second or so . The kjactive's approach is what I like so here is my version of it: #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1); Change to OnEvent mode GUICreate("My Link GUI", 200, 100) GUISetBkColor(0xFFFFFF); will change background color GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE") $LinkLabel = GUICtrlCreateLabel("www.google.com", 10, 10,100) GUICtrlSetColor(-1, 0x0000ff) GUICtrlSetFont(-1, 10, 400, 4) GUICtrlSetOnEvent($LinkLabel, "Link") GUISetState(@SW_SHOW); will display the dialog box While 1 Sleep(1000); Idle around WEnd Func Link() $IEPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE", "") Run($IEPath & " http://www.google.com") Exit EndFunc ;==>Link Func CLOSE() Exit EndFunc -nhalme-
  6. I may not have understood your goal correctly, but I would use as simple script that makes the mail and send it like $myOlApp = ObjCreate("Outlook.Application") $myItem = $myOlApp.Application.CreateItem(0) $myItem.Display $myItem.To = "test@email.com" $myItem.Subject = "This is the subject" $myItem.Body = "Hello World!" This would speed up your email sending process and it would not open a new process for the outlook.exe.
×
×
  • Create New...