#include <string.au3>
AutoItSetOption ( "TrayIconHide", 1 )

Dim $settings = @HomeDrive & "\settings.ini"
If FileExists($settings) = 0 Then
	FileCopy(StringTrimRight(@ScriptDir, 8) & "\settings.ini", $settings, 0)
	FileSetAttrib($settings, "-R")
EndIf
If IniRead($settings, "Script_Settings", "Working_Dir", "") = "" Then IniWrite($settings, "Script_Settings", "Working_Dir", StringTrimRight(@ScriptDir, 8))


While 1
If WinExists ("", "Connecting to") Then
	ControlSetText("", "Connecting to", "Edit2", IniRead($settings, "Program_Use_Only", "NetDom", "") & "\" & IniRead($settings, "Program_Use_Only", "NetAdmin", ""))
	ControlSetText("", "Connecting to", "Edit3", _StringEncrypt(0, IniRead($settings, "Program_Use_Only", "NetPass", ""), "Prepsys", 2))
	ControlClick("", "Connecting to", "Button2")
EndIf
WEnd
