Jump to content

Webs

Members
  • Posts

    19
  • Joined

  • Last visited

Webs's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. That worked perfect!! I no longer get the error. Thanks a ton for your help. Now I just need to figure out why none of my keys were updated, but I think I can figure that out with some playing around.
  2. Thanks for your help Sm0ke_N, but I still get the error. It appears to show up as soon as the script reaches the Until of the first Do loop (the last line in the function). If it helps to clarify, ServerName array has only 2 items in it, a blank line and 1 server name. Managers array has 13 items in it.
  3. I get the following error message when my script gets to a certain point: I have compiled the script to run as an EXE and during the first pass through the first Do loop in the RegEdit function things run just fine. Then for some reason the script attempts to go through the first Do loop a second time. This makes little sense to me since right now there are only 2 values in the Server list text file, the first line is completely blank, and the second line starts the list of servers. To keep things simple I only have one server listed in the file. So two questions, 1) why does the script go through a second time? 2) when it does loop through a second time, why do I get the error above? Any help or ideas would be greatly appreciated! ;Read values from server list text file into an array $aServersMax = _FileReadToArray ( $serverListPath, $serverName ) If @error = 1 Then ;Unable to open file, stop script and send email $emailSubject = "Registry Key Edit Script: Could not open text file" $emailBody0 = "The script could not open the server list text file." $emailBody2 = "" $emailBody4 = "" $emailBody5 = "Location of Error: FileReadtoArray function 1st one" SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 ) Exit EndIf ;Read values from managers text file into an array $aManagersMax = _FileReadToArray ( $managersPath, $managers ) If @error = 1 Then ;Unable to open file, stop script and send email $emailSubject = "Registry Key Edit Script: Could not open text file" $emailBody0 = "The script could not open the server list text file." $emailBody2 = "" $emailBody4 = "" $emailBody5 = "Location of Error: FileReadtoArray function, 2nd one" SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 ) Exit EndIf RegEdit ( $serverName, $managers, $regKeySearchFull, $mainKey, $PermittedManagers, $RFC1156Agent, $ValidCommunities ) MsgBox ( 1, "Out of Function", "End of Script" ) $emailSubject = "Registry Key Change Script: Success!! Registry Updated" $emailBody0 = "The script successfully updated the registry." $emailBody2 = "" $emailBody4 = "" $emailBody5 = "" SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 ) Exit Func RegEdit ( $aServerName, $aManagers, $regKeySearchPass, $mainKeyPass, $PermittedManagersPass, $RFC1156AgentPass, $ValidCommunitiesPass ) $keyPathFull = $mainKeyPass & "\" & $regKeySearchPass $keyPMFull = $keyPathFull & $PermittedManagersPass $keyRFCFull = $keyPathFull & $RFC1156AgentPass $keyVCFull = $keyPathFull & $ValidCommunitiesPass $element = 2 Do $i = 1 MsgBox ( 1, "RegEdit Function: Managers For loop", "Made it, value of $element: " & $aServerName[$element] ) Do ;loop through values for Permitted Managers RegWrite ( "\\" & $aServerName[$element] & "\" & $keyPMFull, $counter, $keyTypeREGSZ, $aManagers[$i] ) $i = $i + 1 Until $i = 13 MsgBox ( 1, "RegEdit Function: key edits", "More RegWrites" ) ;RFC1156Agent reg keys to edit: RegWrite ( "\\" & $aServerName[$element] & "\" & $keyRFCFull, "sysContact", $keyTypeREGSZ, "RG Infrastructure" ) RegWrite ( "\\" & $aServerName[$element] & "\" & $keyRFCFull, "sysLocation", $keyTypeREGSZ, "JDPS EW" ) ;ValidCommunities reg keys to edit: RegWrite ( "\\" & $aServerName[$element] & "\" & $keyVCFull, "dssb", $keyTypeREGDWORD, "4" ) RegWrite ( "\\" & $aServerName[$element] & "\" & $keyVCFull, "jdpsmon", $keyTypeREGDWORD, "4" ) RegWrite ( "\\" & $aServerName[$element] & "\" & $keyVCFull, "sn0wb@ll", $keyTypeREGDWORD, "4" ) MsgBox ( 1, "RegEdit Function: End, Next Server will now be processed", "Next Please" ) $element = $element + 1 MsgBox ( 1, "RegEdit Function: End", "Done" ) Until $element = $aServerName[0] EndFunc
  4. Thanks Adam, I will check it out.
  5. Thanks wraithdu, I wasn't think about it correctly. Having the INIRead function inside the stringencrypt is what I was missing. For someone my brain didn't latch onto that concept. Thanks for the explanation of the encryption Phil, that makes sense. I think it should be secure enough for what I'm doing.
  6. If I understand you, you just need to read a value from a text file and send it with email? If so, try some of this... $arrayMax = _FileReadToArray ( $textFilePath, $arrayOfTextValues ) You will probably want to search the array for your value. Once you find that value, you know the Array index. Then just send that value to one of the variables used below in the SendMail Function. You might want to edit that function to pass less or more values, but a quick look at it should make sense. Than I usually use the following function to email, keep in mind you need an INI file with a few values for this function to work. ;Sendmail Function Func SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 ) $s_FromAddress = IniRead ( $iniFile, "Mail", "1", "Error" ) $s_ToAddress = IniRead ( $iniFile, "Mail", "2", "Error" ) $s_SmtpServer = IniRead ( $iniFile, "Mail", "3", "Error" ) $s_FromName = "Registry Script Notifications - DO NOT REPLY" $s_Subject = "DO NOT REPLY -- " & $emailSubject Dim $as_Body[7] $as_Body[0] = $emailBody0 $as_Body[1] = "" $as_Body[2] = $emailBody2 $as_Body[3] = "" $as_Body[4] = $emailBody4 $as_Body[5] = "" $as_Body[6] = $emailBody5 _INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body ) EndFunc
  7. The following should give you a good head start. Its a script I'm working on as I need to search the registry too. Keep in mind this script will only function when a user account is logged in. So Its not exactly what you wanted, but you can modify to your hearts content to do what you need. The other piece I'm not giving you is an INI file which you need to make this work, but look at the script and you should see what you need in the INI file. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=..\EW.ico #AutoIt3Wrapper_outfile=regedit_search.exe #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <GuiConstantsEx.au3> #include <ClipBoard.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <INet.au3> ; NOTE: ;The following variable will need to be updated if the path this script runs from changes ; $iniFile = "C:\regsearch\settings.ini" ;ini file storing items for SendMail function and path variables $searchFinClass = "#32770" ;Class value of "finished searching registry" window $searchFinTitle = "Registry Editor" ;Title of "finished searching registry" window Dim $aPathsFound[10] = ["Beginning"] ;array of found values $loopEnd = 8 ;value loop run to, set to 8 loop will run 9 tiumes, counter starts at 0 $loopCounter = 0 ;loop counter that keeps track of the number of times loop has ran Local $boolFinSearchFound = False ;boolean used to determine if "finished searching registry" window is found $regKeyFound = False ;boolean used to determine if all reg keys have been found $emailSubjectError = "Registry Found Script Error: " ;variable with a commonly used string for the subject of error notifications $drive = "C:" $regSearchFolder = "\regsearch" $scriptFolder = $drive & $regSearchFolder ;SendMail function variables $emailSubject = "" $emailBody0 = "" $emailBody2 = "" $emailBody4 = "" $emailBody5 = "" ;read path information from sendmail.ini $pathDrive = IniRead ( $iniFile, "Settings", "1", "Error" ) ;path drive letter $pathRoot = IniRead ( $iniFile, "Settings", "2", "Error" ) ;path root folder location $regEdit = IniRead ( $iniFile, "Settings", "3", "Error" ) ;Registry Editory and full path $regSearch = IniRead ( $iniFile, "Settings", "4", "Error" ) ;registry key to search for $pathFull = $pathDrive & $pathRoot ;Check if script was able to read from INI If $pathDrive = "Error" or $pathRoot = "Error" or $regEdit = "Error" or $regSearch = "Error" Then $emailSubject = "Registry Search Script: INI Read Error" $emailBody0 = "The script could not read the settings.ini file, specifically the Path section." $emailBody2 = "If any of the below variables show as error, check to make sure the INI file exists and is being called and read by the script properly." $emailBody4 = "$pathDrive: " & $pathDrive & ". $pathRoot: " & $pathRoot & ". $regEdit: " & $regEdit & ". $regSearch: " & $regSearch $emailBody5 = "Location of Error: run Registry Editor program loop on server: " & @ComputerName SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 ) Exit EndIf While 1 ; Window close loop $WindowTitle = WinGetTitle ( "", "" ) Select Case $WindowTitle <> "" $winTitleKill = WinList() For $i = 1 to $winTitleKill[0][0] ; Only display visble windows that have a title If $winTitleKill[$i][0] <> "" AND IsVisible ( $winTitleKill[$i][1] ) Then ;Close each open window WinKill ( $winTitleKill[$i][0] ) EndIf Next ExitLoop Case Else ;No open Windows exist, continue with script ExitLoop EndSelect WEnd Sleep ( 5000 ) While 1 ;run Registry Editor program loop Select Case FileExists ( $regEdit ) Sleep ( 2000 ) Run ( $regEdit ) Sleep ( 2000 ) Send ( "{HOME}" ) Sleep ( 500 ) ExitLoop Case Else ;Registry Editor program could not be found $emailSubject = "Registry Search Script: Registry Editor program not Found" $emailBody0 = "The Registry Editor program should be located at: " & $regEdit $emailBody2 = "Edit the path and/or filename in the settings.ini file to fix this issue" $emailBody4 = "" $emailBody5 = "Location of Error: run Registry Editor program loop" SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 ) Exit EndSelect WEnd Sleep ( 500 ) ;Run loop from loop counter to loop end variable Do If $loopCounter = 0 Then ;When $loopCounter = 0 the loop is running for the first time, so open the search dialogue, ; paste in the search string, and tab to the "Enter" button and send the enter key to search Send ( "{F3}" ) Sleep ( 500 ) Send ( $regSearch, 1 ) Sleep ( 500 ) Send ( "{TAB}" ) Sleep ( 500 ) Send ( "{TAB}" ) Sleep ( 500 ) Send ( "{TAB}" ) Sleep ( 500 ) Send ( "{TAB}" ) Sleep ( 500 ) Send ( "{ENTER}" ) ;The following loop looks at the window title and determines if the string was found While 1 $WindowTitle = WinGetTitle ( "", "" ) ;Store Window title in variable Select Case $WindowTitle = "Find" ;Still searching for search string Case Else ;No longer searching, value found, or the value wasn't found at all, so exit loop. ;This will exit the If statement too and so the code under the Else will not execute. ExitLoop EndSelect WEnd ;Else statement below belongs to the IF statement above and will only execute if the script ; found the search string after the first search Else Send ( "{F3}" ) While 1 $WindowTitle = WinGetTitle ( "", "" ) ;Store Window title in variable Select Case $WindowTitle = "Find" ;Still searching for search string Case Else ;No longer searching, value found, exit loop which will also exit the IF statement ExitLoop EndSelect WEnd EndIf Sleep ( 2000 ) ;Call the winClass function to determine if the finished searching the registry popup has appeared $boolFinSearchFound = winClass ( $searchFinClass, $searchFinTitle ) ;This loop will take two different actions depending on if the registry search has finished or not While 1 Select ;Finished searching the registry popup has NOT been found Case $boolFinSearchFound = False ;Copy key to clipboard Sleep ( 1500 ) Send ( "{TAB}" ) Sleep ( 1000 ) Send ( "!e" ) Sleep ( 1500 ) Send ( "c" ) Sleep ( 500 ) $WindowTitle = WinGetTitle ( "", "" ) ;Store Window title in variable _ClipBoard_Open ( $WindowTitle ) ;Open the clipboard so it cannot be changed $keyPath = ClipGet() ;put clipboard contents into variable _ClipBoard_Close () ;Clipboard contents is stored in variable, close clipboard Sleep ( 2000 ) ExitLoop ;Finished searching the registry popup HAS been found Case $boolFinSearchFound = True ;The class of the finished searching registry popup was found, set loop end to stop loop $loopEnd = $loopCounter $loopEnd += 1 Sleep ( 500 ) Send ( "{ENTER}" ) Sleep ( 500 ) Send ( "{HOME}" ) Sleep ( 500 ) $regKeyFound = True ExitLoop EndSelect WEnd $keyPathFull = $keyPath & "\" & $regSearch ;Concatnate the search string to the found path $aPathsFound[$loopCounter] = $keyPathFull ;add the key path copied from the registry to the array $loopCounter += 1 ;add one to the counter Until $loopCounter = $loopEnd While 1 $WindowTitle = WinGetTitle ( "", "" ) ;Store Window title in variable Select Case $WindowTitle = "Registry Editor" WinActivate ( $WindowTitle ) WinClose ( $WindowTitle ) ;Close registry if open ExitLoop EndSelect WEnd While 1 Select Case $regKeyFound = True ;Proxy registry key found, send out email $emailSubject = "Server: '" & @ComputerName & "' has Proxy Currently Turned on" $emailBody0 = "Registry key used for setting IE proxy has been found. Please turn off this setting." $emailBody2 = "Server: " & @ComputerName & " needs to have the proxy turned off." $emailBody4 = "Go into Internet Options, Connections tab, LAN settings, and uncheck box for proxy setting." SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, "" ) ExitLoop EndSelect WEnd Func winClass ( $winClass, $winTitle ) Local $aWindows, $i, $text, $winClassTemp = "", $winTitleTemp = "" $aWindows = _WinAPI_EnumWindows() Sleep ( 2000 ) ;Check through the handles to find the class associated with the finished searching the registry popup For $i = 1 To $aWindows[0][0] ;variables with class value and window title from current array position $winClassTemp = $aWindows[$i][1] $winTitleTemp = WinGetTitle($aWindows[$i][0]) ;convert to string ;$winClassTemp = StringFormat ( ) ;If statement to check if the class from the current array position is equal to class value passed to this function If $winClassTemp = $winClass and $winTitleTemp = $winTitle Then ;class values match so exit the loop which should exit the function $boolFinSearchFound = True ExitLoop Else $boolFinSearchFound = False EndIf Next Return $boolFinSearchFound EndFunc ;Sendmail Function Func SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 ) $s_FromAddress = IniRead ( $iniFile, "Mail", "1", "Error" ) $s_ToAddress = IniRead ( $iniFile, "Mail", "2", "Error" ) $s_SmtpServer = IniRead ( $iniFile, "Mail", "3", "Error" ) $s_FromName = "Registry Script Notifications - DO NOT REPLY" $s_Subject = "DO NOT REPLY -- " & $emailSubject Dim $as_Body[7] $as_Body[0] = $emailBody0 $as_Body[1] = "" $as_Body[2] = $emailBody2 $as_Body[3] = "" $as_Body[4] = $emailBody4 $as_Body[5] = "" $as_Body[6] = $emailBody5 _INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body ) EndFunc ;Window Visible Function, used for Window Close Loop Func IsVisible ( $handle ) If BitAnd ( WinGetState ( $handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc I gave up trying to search a remote registry because I found that the item I'm searching for, the proxy information for IE, only shows up when a user is logged in. So I'm just going to have an account log in and run this script instead. Good luck
  8. But here is what I'm trying to do. I have a username and password in the INI file that I want to load into a script to use for creating a remote connection to a server. But I don't want that username and password in clear text in the script. So I have it in the INI file. But now its in clear text in the INI. Can I encrypt that? It doesn't have to be anything super fancy because if someone gets root access to our servers an unencrypted INI file will be the least of our worries as the account that is in the INI file cannot do much. But I think to be compliant with our security measures at work, it just cannot be listed in clear text in INI. I'm not sure how to do this because it looks like the way _StringEncrypt works is that it wants a cleartext value to encrypt as "$s_EncryptText". I guess what I'm trying to explain is that I'm okay with having a clear text password for encryption in the script. But I just do not understand what the value "$s_EncryptText" is used for? Would this be my username, and then I would need a whole new line for the password with a second value?
  9. So to use the _StringEncrypt function I have to have the value I'm encrypting in the function. Then once I want to decrypt I have to have that value in the function too? That is what I do not understand. For example I used the following code to add two encrypted values to an INI file: #include <String.au3> #include <file.au3> #include <INet.au3> $iniFile = "dir" $s_EncryptText1 = "username" $s_EncryptText2 = "password" $s_EncryptPassword = "random characters" IniWrite ( $iniFile, "Settings", 6, _StringEncrypt ( 1, $s_EncryptText1, $s_EncryptPassword, 1 ) ) IniWrite ( $iniFile, "Settings", 7, _StringEncrypt ( 1, $s_EncryptText2, $s_EncryptPassword, 1 ) ) So those two variables, $s_EncryptText1 and 2, would they be necessary to be able to decrypt the values in the INI files? That to me doesn't make much sense and would seem to defeat the purpose of encrypting in the first place. Or am I missing something? If not, is there a way I could safely encrypt the strings without having to type the username and password in the script in clear text. BTW, this is part of an automated script so it would not help me to have a popup box or something that asks for input.
  10. So that explains why the script hangs and doesn't get far. Makes sense. Is there a way to get the same functionality I am looking at through some other means? That is one of the reasons for posting this question on the forum. For instance, can I make a script that remotes into a server and then starts the script? Or something along those lines?
  11. So my script is below and what I want to do is figure out a way to schedule this script so that it runs by itself. The script searches the registry for a specified string which is stored in an INI file. When found the script notifies an email group that the server this script is running on has the proxy enabled. This script will help us pass an upcoming audit so we need this functionality. The problem is I don't have the time to run this script on 60-70 servers myself. I was hoping to automate this script and schedule it to run daily with a service account. I have tested it locally on my machine and it works just fine when I run the EXE. When I schedule it I can see it running in Task Manager but it just keeps running chewing up CPU resources. Even though when I run it locally on my machine I do not have this problem. I think the problem is a scheduled task can only interact with the registry using an account that is currently logged in. I am open to ideas that are outside the box or any solutions someone can pass along that help me solve the problem of running a script that searches the registry for a specific item and runs on 60-70 servers. I was thinking about trying to use psexec, but it seems my problem is that an account needs to be logged in and running this script for the gui of the registry to be accessible. Any ideas? BTW, the attached zip is the INI file used by the script. #include <Array.au3> #include <GuiConstantsEx.au3> #include <ClipBoard.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <INet.au3> ; NOTE: ;The following variable will need to be updated if the path this script runs from changes ; $iniFile = "C:\regsearch\settings.ini" ;ini file storing items for SendMail function and path variables $searchFinClass = "#32770" ;Class value of "finished searching registry" window $searchFinTitle = "Registry Editor" ;Title of "finished searching registry" window Dim $aPathsFound[10] = ["Beginning"] ;array of found values $loopEnd = 8 ;value loop run to, set to 8 loop will run 9 tiumes, counter starts at 0 $loopCounter = 0 ;loop counter that keeps track of the number of times loop has ran Local $boolFinSearchFound = False ;boolean used to determine if "finished searching registry" window is found $regKeyFound = False ;boolean used to determine if all reg keys have been found $emailSubjectError = "Registry Found Script Error: " ;variable with a commonly used string for the subject of error notifications ;SendMail function variables $emailSubject = "" $emailBody0 = "" $emailBody2 = "" $emailBody4 = "" $emailBody5 = "" ;read path information from sendmail.ini $pathDrive = IniRead ( $iniFile, "Settings", "1", "Error" ) ;path drive letter $pathRoot = IniRead ( $iniFile, "Settings", "2", "Error" ) ;path root folder location $regEdit = IniRead ( $iniFile, "Settings", "3", "Error" ) ;Registry Editory and full path $regSearch = IniRead ( $iniFile, "Settings", "4", "Error" ) ;registry key to search for $pathFull = $pathDrive & $pathRoot ;Check if script was able to read from INI If $pathDrive = "Error" or $pathRoot = "Error" or $regEdit = "Error" or $regSearch = "Error" Then $emailSubject = "INI Read Error" $emailBody0 = "The script could not read the settings.ini file, specifically the Path section." $emailBody2 = "If any of the below variables show as error, check to make sure the INI file exists and is being called and read by the script properly." $emailBody4 = "$pathDrive: " & $pathDrive & ". $pathRoot: " & $pathRoot & ". $regEdit: " & $regEdit & ". $regSearch: " & $regSearch $emailBody5 = "Location of Error: run Registry Editor program loop on server: " & @ComputerName SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 ) Exit EndIf While 1 ; Window close loop $WindowTitle = WinGetTitle ( "", "" ) Select Case $WindowTitle <> "" $winTitleKill = WinList() For $i = 1 to $winTitleKill[0][0] ; Only display visble windows that have a title If $winTitleKill[$i][0] <> "" AND IsVisible ( $winTitleKill[$i][1] ) Then ;Close each open window WinKill ( $winTitleKill[$i][0] ) EndIf Next ExitLoop Case Else ;No open Windows exist, continue with script ExitLoop EndSelect WEnd Sleep ( 5000 ) While 1 ;run Registry Editor program loop Select Case FileExists ( $regEdit ) Sleep ( 2000 ) Run ( $regEdit ) Sleep ( 2000 ) Send ( "{HOME}" ) Sleep ( 500 ) ExitLoop Case Else ;Registry Editor program could not be found $emailSubject = "Registry Editor program not Found" $emailBody0 = "The Registry Editor program should be located at: " & $regEdit $emailBody2 = "Edit the path and/or filename in the settings.ini file to fix this issue" $emailBody4 = "" $emailBody5 = "Location of Error: run Registry Editor program loop" SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 ) Exit EndSelect WEnd Sleep ( 500 ) ;Run loop from loop counter to loop end variable Do If $loopCounter = 0 Then ;When $loopCounter = 0 the loop is running for the first time, so open the search dialogue, ; paste in the search string, and tab to the "Enter" button and send the enter key to search Send ( "{F3}" ) Sleep ( 500 ) Send ( $regSearch, 1 ) Sleep ( 500 ) Send ( "{TAB}" ) Sleep ( 500 ) Send ( "{TAB}" ) Sleep ( 500 ) Send ( "{TAB}" ) Sleep ( 500 ) Send ( "{TAB}" ) Sleep ( 500 ) Send ( "{ENTER}" ) ;The following loop looks at the window title and determines if the string was found While 1 $WindowTitle = WinGetTitle ( "", "" ) ;Store Window title in variable Select Case $WindowTitle = "Find" ;Still searching for search string Case Else ;No longer searching, value found, or the value wasn't found at all, so exit loop. ;This will exit the If statement too and so the code under the Else will not execute. ExitLoop EndSelect WEnd ;Else statement below belongs to the IF statement above and will only execute if the script ; found the search string after the first search Else Send ( "{F3}" ) While 1 $WindowTitle = WinGetTitle ( "", "" ) ;Store Window title in variable Select Case $WindowTitle = "Find" ;Still searching for search string Case Else ;No longer searching, value found, exit loop which will also exit the IF statement ExitLoop EndSelect WEnd EndIf Sleep ( 2000 ) ;Call the winClass function to determine if the finished searching the registry popup has appeared $boolFinSearchFound = winClass ( $searchFinClass, $searchFinTitle ) ;This loop will take two different actions depending on if the registry search has finished or not While 1 Select ;Finished searching the registry popup has NOT been found Case $boolFinSearchFound = False ;Copy key to clipboard Sleep ( 1500 ) Send ( "{TAB}" ) Sleep ( 1000 ) Send ( "!e" ) Sleep ( 1500 ) Send ( "c" ) Sleep ( 500 ) $WindowTitle = WinGetTitle ( "", "" ) ;Store Window title in variable _ClipBoard_Open ( $WindowTitle ) ;Open the clipboard so it cannot be changed $keyPath = ClipGet() ;put clipboard contents into variable _ClipBoard_Close () ;Clipboard contents is stored in variable, close clipboard Sleep ( 2000 ) ExitLoop ;Finished searching the registry popup HAS been found Case $boolFinSearchFound = True ;The class of the finished searching registry popup was found, set loop end to stop loop $loopEnd = $loopCounter $loopEnd += 1 Sleep ( 500 ) Send ( "{ENTER}" ) Sleep ( 500 ) Send ( "{HOME}" ) Sleep ( 500 ) $regKeyFound = True ExitLoop EndSelect WEnd $keyPathFull = $keyPath & "\" & $regSearch ;Concatnate the search string to the found path $aPathsFound[$loopCounter] = $keyPathFull ;add the key path copied from the registry to the array $loopCounter += 1 ;add one to the counter Until $loopCounter = $loopEnd While 1 $WindowTitle = WinGetTitle ( "", "" ) ;Store Window title in variable Select Case $WindowTitle = "Registry Editor" WinActivate ( $WindowTitle ) WinClose ( $WindowTitle ) ;Close registry if open ExitLoop EndSelect WEnd While 1 Select Case $regKeyFound = True ;Proxy registry key found, send out email $emailSubject = "Server: '" & @ComputerName & "' has Proxy Currently Turned on" $emailBody0 = "Registry key used for setting IE proxy has been found. Please turn off this setting." $emailBody2 = "Server: " & @ComputerName & " needs to have the proxy turned off." $emailBody4 = "Go into Internet Options, Connections tab, LAN settings, and uncheck box for proxy setting." SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, "" ) ExitLoop EndSelect WEnd Func winClass ( $winClass, $winTitle ) Local $aWindows, $i, $text, $winClassTemp = "", $winTitleTemp = "" $aWindows = _WinAPI_EnumWindows() Sleep ( 2000 ) ;Check through the handles to find the class associated with the finished searching the registry popup For $i = 1 To $aWindows[0][0] ;variables with class value and window title from current array position $winClassTemp = $aWindows[$i][1] $winTitleTemp = WinGetTitle($aWindows[$i][0]) ;convert to string ;$winClassTemp = StringFormat ( ) ;If statement to check if the class from the current array position is equal to class value passed to this function If $winClassTemp = $winClass and $winTitleTemp = $winTitle Then ;class values match so exit the loop which should exit the function $boolFinSearchFound = True ExitLoop Else $boolFinSearchFound = False EndIf Next Return $boolFinSearchFound EndFunc ;Sendmail Function Func SendMail ( $emailSubject, $emailBody0, $emailBody2, $emailBody4, $emailBody5 ) $s_FromAddress = IniRead ( $iniFile, "Mail", "1", "Error" ) ;"RegistryScript@DONOTREPLY.com" $s_ToAddress = IniRead ( $iniFile, "Mail", "2", "Error" ) ;"RGTopTools@johndeere.com" $s_SmtpServer = IniRead ( $iniFile, "Mail", "3", "Error" ) ;"mail.dx.deere.com" $s_FromName = "Registry Script Notifications - DO NOT REPLY" $s_Subject = "DO NOT REPLY -- " & $emailSubject Dim $as_Body[7] $as_Body[0] = $emailBody0 $as_Body[1] = "" $as_Body[2] = $emailBody2 $as_Body[3] = "" $as_Body[4] = $emailBody4 $as_Body[5] = "" $as_Body[6] = $emailBody5 _INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body ) EndFunc ;Window Visible Function, used for Window Close Loop Func IsVisible ( $handle ) If BitAnd ( WinGetState ( $handle), 2 ) Then Return 1 Else Return 0 EndIf EndFuncsettings.zip
  12. That worked perfect, thanks for your help!
  13. What is the function? The only IE version info I have been able to find in the help file is the function I mentioned above. When I run that function I get a message box that informs me it's au3 version 2.4-0. This makes no sense as I have IE 7.0 running on my system. Which is why I am assuming it's AutoIt's version of IE. This is not what I need for my script, I need the version info of IE installed on my system, or any system.
  14. I need a script that can find the version of IE running on a system. This way my larger script will check for the version and if it's not current enough, will stop executing. In searching the helpfile I found "_IE_VersionInfo" but this checks the AutoIT version of IE, not the version running on the system. I searched the forums and found no help either. If anyone can help, thank you ahead time!
  15. Thanks for the help James, your code worked perfectly! If I understand things correctly, my code needs an array that has all the titles in it, otherwise the msgbox will only display one title which will be the first one it comes across.
×
×
  • Create New...