Autoit: button at end of array

wrichards0

I am writing a program in AutoIT to let users enter a name and then it searches MSSQL, which I have linked to Active Directory, for information about the user or users where the cn is similar. The problem is I am trying to add a button to the end of a row which. when clicked, will add the email address to the clipboard. I am having trouble finding code online to help do this. I have the following code:

 #include <mssql.au3>
 #include <Array.au3>
 dim $title = "E-Mail address lookup"
 dim $sqlCon = _MSSQL_Con("servername", "password", "Directory3", "directory")
 dim $name = InputBox($title,"Please type the name of the person you wish to find")
 if StringLen(StringStripWS($name,3)) < 1 then
      MsgBox(0, $title, "Name cannot be empty")
 Else
      local $result = _ArrayDisplay(_MSSQL_GetRecord($sqlCon, "rbc_staff","*", "WHERE cn LIKE '%" & StringStripWS($name,3) & "%'"))
 EndIf
user5992808
; I don't know, how "_MSSQL_GetRecord" returns its result. I think it should be an 1D array.
; If it is so, try the following. No extra button, but a messagebox with yes/no.
; But it should be better, if you could post a sample of the result array
If StringLen(StringStripWS($name,3)) < 1 then
    MsgBox(0, $title, "Name cannot be empty")
Else
    ; if I've right understand, the sql query gets the mail address
    Local $result = _MSSQL_GetRecord($sqlCon, "rbc_staff","*", "WHERE cn LIKE '%" & StringStripWS($name,3) & "%'")
    ; instead of showing the array
    ;_ArrayDisplay($result)
    ; ask the user, if the address should be copied to clipboard
    If MsgBox(36, 'Mail', 'You want to copy the mail address' & @CRLF & _
       $result[0] & @CRLF & 'to clipboard?') = 6 Then
        ClipPut($result[0])
    EndIf
EndIf

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related