Jump to content

amir

Members
  • Posts

    8
  • Joined

  • Last visited

amir's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Well, I decided to try a different approach, instead of accessing the global address list via an outlook object, i get what i need from the "Active Directory". See my post at: http://www.autoitscript.com/forum/index.php?showtopic=71778
  2. OK, this finally worked for me: The key line for me was: Local $strBase = "<LDAP://dc=YourDOMAINname,dc=DOMAINsuffix>" Local $objCommand = ObjCreate("ADODB.Command") Local $objConnection = ObjCreate("ADODB.Connection") $objConnection.Provider = "ADsDSOObject" $objConnection.Open ("Active Directory Provider") $objCommand.ActiveConnection = $objConnection Local $strBase = "<LDAP://dc=YourDOMAINname,dc=DOMAINsuffix>" Local $strFilter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=*))" Local $strAttributes = "cn,sAMAccountName,displayName,sn,distinguishedName" Local $strQuery = $strBase & ";" & $strFilter & ";" & $strAttributes & ";subtree" $objCommand.CommandText = $strQuery $objCommand.Properties ("Page Size") = 100 $objCommand.Properties ("Timeout") = 30 $objCommand.Properties ("Cache Results") = False $ADS_SCOPE_SUBTREE = 2 $objCommand.Properties ("searchscope") = $ADS_SCOPE_SUBTREE $objRecordSet = $objCommand.Execute ConsoleWrite("Users"&@CR&"---------"&@CR) While Not $objRecordSet.EOF $strName = $objRecordSet.Fields ("sAMAccountName").Value $strCN = $objRecordSet.Fields ("cn").value $strdisplayName = $objRecordSet.Fields ("displayName").value $strSN = $objRecordSet.Fields ("SN").value $strdistinguishedName = $objRecordSet.Fields ("distinguishedName").value ;FileWriteLine("Users.txt",$strName) ConsoleWrite($strdisplayName&@cr) ConsoleWrite($strName&@cr) ConsoleWrite(@cr) $objRecordSet.MoveNext WEnd $objConnection.Close $objConnection = "" $objCommand = "" $objRecordSet = ""
  3. When i try to execute the code down below, i get : Does anyone have any idea why? (i got this code from an old post on the forum) Local $objCommand = ObjCreate("ADODB.Command") Local $objConnection = ObjCreate("ADODB.Connection") $objConnection.Provider = "ADsDSOObject" $objConnection.Open ("Active Directory Provider") $objCommand.ActiveConnection = $objConnection ;Local $strBase = "<GC://dc=YOURDOMAINNAME,dc=COM>" Local $strBase = ObjGet("LDAP//RootDSE") Local $strFilter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=*))" Local $strAttributes = "cn,sAMAccountName,displayName,sn,distinguishedName" Local $strQuery = $strBase & ";" & $strFilter & ";" & $strAttributes & ";subtree" $objCommand.CommandText = $strQuery $objCommand.Properties ("Page Size") = 100 $objCommand.Properties ("Timeout") = 30 $objCommand.Properties ("Cache Results") = False $ADS_SCOPE_SUBTREE = 2 $objCommand.Properties ("searchscope") = $ADS_SCOPE_SUBTREE Local $objRecordSet = $objCommand.Execute ConsoleWrite("Users"&@CR&"---------"&@CR) While Not $objRecordSet.EOF $strName = $objRecordSet.Fields ("sAMAccountName").Value $strCN = $objRecordSet.Fields ("cn").value $strdisplayName = $objRecordSet.Fields ("displayName").value $strSN = $objRecordSet.Fields ("SN").value $strdistinguishedName = $objRecordSet.Fields ("distinguishedName").value ;FileWriteLine("Users.txt",$objRecordSet.Fields ("sAMAccountName").Value) ConsoleWrite($objRecordSet.Fields ("sAMAccountName").Value&@cr) $objRecordSet.MoveNext WEnd $objConnection.Close $objConnection = "" $objCommand = "" $objRecordSet = ""
  4. I know how to search the contacts folder, but how can i search the "Global Address List"? I tried to shoot in the dark with this code, but it doesn't work.... any ideas? $OutlookApplication = ObjCreate ( "Outlook.Application" ) $OutlookNamespace = $OutlookApplication.GetNamespace("MAPI") $OutlookContacts = $OutlookNamespace.AddressLists("Global Address List") ;This line is where the script fail.... $OutlookContact = $OutlookContacts.Items.Find('[FirstName] = "John"' ) If IsObj( $OutlookContact) Then MsgBox ( 0 , "Debug" , "Found" ) Else MsgBox ( 0 , "Debug" , "Not Found" ) EndIf
  5. Thanks. Well, it didn't work, i guess it's not a standard control... Thanks for trying to help.
  6. I'm trying to work with a list, but i can't seem to be able to access it. The App i'm trying to automate is a .NET app, called "emoze Enterprise Edition" from www.emoze.com. The list is in the 'Add user' dialog. Here's a sample of the code i'm using to try to get some onfo from the list: ControlCommand("Add a New User","Select user from list","[CLASS:WindowsForms10.window.8.app3; INSTANCE:6]","GetLineCount", "") I believe the list info is correct, i used the info tool to get it. Thanks Amir
  7. Hi, I'm trying to write my very first script. I want the script to edit a text file that is located at the installation path of an application i'm using. Anyway, as you can see below, after i've opened the text file in notepad, i'm trying to find the string i want to edit, using ^f. If the text file i'm editing contains the string i'm looking for, then the script works well, but how can i handle a situation in which the FIND function in notepad, is unable to locate the string? How can i identify this situation in the script? I need to know what happen after i press the FIND button, was the string found or did an error message appear. Here's what i have so far: $MyappInstallationPath = RegRead("HKCU\Software\myapp\app","MyAppPath") ;Fetching the path from registry Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("^o") ;opening the OPEN FILE dialog send($MyappInstallationPath ) ;Entering the path for the file send("\settings.txt") ;Entering the file name send("!o") ;Pressing the OPEN button to open the file send("^f") ;Opening the FIND dialog send("viewmode") ;Entering the string to find send("!f") ;Pressing the FIND button Send("!{F4}") ;Closing the FIND dialog Send("{RIGHT}") send("+{END}") Send("{BS}") Send("1") send("^s") send("!f") send("x")
×
×
  • Create New...