#include #include <..\Library.au3> #include <..\CheckExistingData.au3> #include <..\ProcessEx.au3> #RequireAdmin ; Compile as 64bit exe. ;------------------------------------ ;Global Variables and main logic ;------------------------------------ $time_out = 120 $time_out_prq = 900 OnAutoItExitRegister("Exit_Program") ;GLobal variabes related to MartServer Testing $dbtype = "oracle" $dbserver = "localhost" $dbname = "default" $dbuser = "default" $dbpassword = "default" if FileExists(@ScriptDir&"\config.txt") Then $Config = @ScriptDir&"\config.txt" $build = readConfig($Config,"BuildExe") $bit = readConfig($Config,"Bit") $release = readConfig($Config,"Release") $Prod64 = readConfig($Config,"Prod64") $Prod32 = readConfig($Config,"Prod32") $MartUpgrade = readConfig($Config,"MartUpgrade") $FETemplates = readConfig($Config,"FETemplates") $Samples = readConfig($Config,"Samples") $Documentation = readConfig($Config,"Documentation") $MartDatabase = readConfig($Config,"martdatabase") if not StringCompare(readConfig($Config,"Timeout"),"Not Found")=0 then $time_out = readConfig($Config,"Timeout") Logging($time_out & ": timeout for window events changed") EndIf if not StringCompare(readConfig($Config,"Timeout_prq"),"Not Found")=0 then $time_out_prq = readConfig($Config,"Timeout_prq") Logging($time_out_prq & ": timeout for prereq installation changed") EndIf if not StringCompare(readConfig($Config,"LicenseCode"),"Not Found")=0 then $LicenseCode = readConfig($Config,"LicenseCode") Logging($LicenseCode & ": is the license code") Else Logging("License Code Details are not available") EndIf if not StringCompare(readConfig($Config,"LicenseEmail"),"Not Found")=0 then $LicenseEmail = readConfig($Config,"LicenseEmail") Logging($LicenseEmail & ": is the license Email") Else Logging("License Email Details are not available") EndIf Else msgbox(0,"Remote Execution","Config file not found") Exit EndIf If Not IsDeclared("iNotFromDM64") Then;To skip main code executing from DM64.au3 when imported as library ;Logging("Executing from DM64.au3") if not ($bit = Get_Arch()) Then if(Get_Arch() = 32) Then Logging("Not compatible for this OS...") Logging("-----------Completed Functionality Testing----------") ; Kept this message here so that the result file will be saved as result_ instead of error_ Exit Else Logging("Executable is "& $bit &"-bit and OS is "& Get_Arch() &"-bit") EndIf EndIf Run(@ScriptDir & "\" & $build) if StringInStr($build, "erwin Data Modeler")>0 Then DataModeller() Logging("-----------Started Functionality Testing------------") LaunchErwin() Logging("-----------Completed Functionality Testing----------") ElseIf StringInStr($build, "erwin Mart Server")>0 Then MartServer() ElseIf StringInStr($build, "License")>0 Then LicenseServer() EndIf Else ;Logging("Executing from DM64.au3 as a Library") EndIf ;------------------------------------ ;Functions related to GUI Event Handling ;------------------------------------ Func _WinWaitActivate($title,$text,$timeout=$time_out) Logging("Waiting for "&$title&":"&$text) $dHandle = WinWait($title,$text,$timeout) if not ($dHandle = 0) then If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) Else Logging("Timeout occured while waiting for the window...") Exit EndIf EndFunc ;_WinWaitActivate only,but with returning of GUI window ID Func _WinWaitActivate1($title,$text,$timeout=$time_out);Will Return the window Handler Logging("Waiting for "&$title&":"&$text) $dHandle = WinWait($title,$text,$timeout) if not ($dHandle = 0) then If Not WinActive($title,$text) Then WinActivate($title,$text) return WinWaitActive($title,$text,$timeout) Else Logging("Timeout occured while waiting for the window...") Exit EndIf EndFunc ;------------------------------------ ;Functions related to Close Event and logging ;------------------------------------ ;Called when Close signal occured Func Exit_Program() Local $exitmethod = ["Natural closing", "close by Exit function", "close by clicking on exit of the systray","close by user logoff","close by Windows shutdown"] ExitProgram("Exit with exit code: "& @exitCode & " And because of: " & $exitmethod[@exitmethod],@exitmethod) EndFunc ;Helper function to above Exit_Program to log the result Func ExitProgram($sReason="Exit by user",$sCode=0) Logging($sReason) if $sCode <> 0 then CreateResult("stopped before completion") Else CreateResult() EndIf ;Exit EndFunc ;To log the end output to a result file Func CreateResult($sResult="completed..") if FileExists(@ScriptDir&"\Logging.log") Then FileWrite(@ScriptDir&"\Logging.log","Execution of "& $build & " " & $sResult) FileMove(@ScriptDir&"\Logging.log",@ScriptDir&"\Results.txt",$FC_OVERWRITE+$FC_CREATEPATH ) ;FileDelete(@ScriptDir&"\Logging.log") ;FileCopy(@ScriptDir&"\Results.txt",@ScriptDir&"\Results_copy.txt",$FC_OVERWRITE+$FC_CREATEPATH ) else FileWrite(@ScriptDir&"\Results.txt","Execution of "& $build & " " & $sResult) EndIf EndFunc ;------------------------------------ ;Functions related to AutoIT Recordings ;------------------------------------ Func DataModeller() $win1 = "erwin Data Modeler "& $release &" ("& $bit &"-bit) - InstallShield Wizard" $win2 = "erwin Data Modeler "& $release &" ("& $bit &"-bit) Installer Information" Logging("Prerequisites being Installed..") while not winexists($win1) Sleeping("Waiting for Prereq installation window"& $win1) WEnd _WinWaitActivate($win1,"Setup is preparing the InstallShield Wizard");To activate the window $prqReturnCode = WinWaitClose($win1,"Setup is preparing the InstallShield Wizard, which will guide you through the program setup process. Please wait.",$time_out_prq) if $prqReturnCode = 1 then Logging("Completed Installation of Prerequisites") Else Logging("Timeout occured for Installation of Prerequisites") Exit EndIf _WinWaitActivate($win1,"WARNING: This progra") Send("{ALTDOWN}n{ALTUP}");Send("{SPACE}") _WinWaitActivate($win1,"I DISAGREE and &do n") Send("{UP}n") _WinWaitActivate($win1,"Customer Information") Send("{ALTDOWN}n{ALTUP}");Send("{TAB}{TAB}n") _WinWaitActivate($win1,"Click Next to instal") Send("{ALTDOWN}n{ALTUP}");Send("n") $hwnd = _WinWaitActivate1($win1,"This feature require") SelectFeature($hwnd,"MartUpgrade",$MartUpgrade,4,3) SelectFeature($hwnd,"FETemplates",$FETemplates,2) SelectFeature($hwnd,"Samples",$Samples,3,5) SelectFeature($hwnd,"Documentation",$Documentation,1,4) Send("{ALTDOWN}n{ALTUP}");Send("{TAB}n") _WinWaitActivate($win1,"Ready to Install the") Send("{ALTDOWN}i{ALTUP}");Send("i") $prqReturnCode = WinWaitClose($win1,"Please wait while the InstallShield Wizard installs erwin Data Modeler",$time_out_prq) if $prqReturnCode = 1 then Logging("Completed Installation of erwinDM") Else Logging("Timeout occured for Installation of erwinDM") Exit EndIf _WinWaitActivate($win1,"The InstallShield Wi") Send("{ALTDOWN}f{ALTUP}");Send("f") _WinWaitActivate($win2,"You must restart you") Send("{ALTDOWN}n{ALTUP}");Send("n") EndFunc Func MartServer() $win1 = "erwin Mart Server "& $release &" ("& $bit &"-bit) - InstallShield Wizard" $win2 = "erwin Mart Server "& $release &" ("& $bit &"-bit) Installer Information" _WinWaitActivate($win1,"WARNING: This progra") Send("{ALTDOWN}n{ALTUP}");Send("n") _WinWaitActivate($win1,"I DISAGREE and &do n") Send("{UP}n") _WinWaitActivate($win1,"Please enter your in") ;Send("{TAB}{TAB}{TAB}n") Send("{ALTDOWN}n{ALTUP}") _WinWaitActivate($win1,"This feature require") Send("{ALTDOWN}n{ALTUP}") _WinWaitActivate($win1,"The wizard is ready ") Send("{ALTDOWN}i{ALTUP}") _WinWaitActivate($win1,"The InstallShield Wi") Send("{ALTDOWN}f{ALTUP}") _WinWaitActivate($win2,"You must restart you") Send("{ALTDOWN}n{ALTUP}") Logging("MartServer Installation completed.") PostGRESQL() ;Run("explorer.exe",Call(ProcessClose("explorer.exe")));restart explorer EnvUpdate();reload env. variables MartServerTesting() EndFunc Func LicenseServer() ;Run('C:\Users\ERwin\Desktop\erwin License Server r9.7 (32-bit).exe') $win1 = "erwin DM License Administrator - InstallShield Wizard" _WinWaitActivate($win1,"WARNING: This progra") Send("{ALTDOWN}n{ALTUP}") _WinWaitActivate($win1,"I DISAGREE and do no") Send("{UP}{ALTDOWN}n{ALTUP}") _WinWaitActivate($win1,"Please enter your in") Send("{ALTDOWN}n{ALTUP}") _WinWaitActivate($win1,"Click Next to instal") Send("{ALTDOWN}n{ALTUP}") _WinWaitActivate($win1,"The wizard is ready ") Send("{ALTDOWN}i{ALTUP}") _WinWaitActivate($win1,"The InstallShield Wi") Send("{ALTDOWN}f{ALTUP}") EndFunc ;------------------------------------------- ;Functions related to Feature selection ;------------------------------------------- func SelectFeature($hwnd,$sFeature,$sFeatureEnabled,$iID,$iDownCount=1,$iInstance=1) if StringUpper($sFeatureEnabled)="YES" then Logging("Selecting "& $sFeature &" to install it...") if ControlClick("[CLASS:MsiDialogCloseClass]"," ","[CLASS:SysTreeView32; INSTANCE:1]") Then $htreeview=ControlGetHandle($hwnd,"","[CLASS:SysTreeView32; INSTANCE:"&$iInstance&"]") ControlTreeView($hwnd," ",$htreeview,"Select","#"&$iID&"");Working ControlTreeView but not in enhanced mode on hyperv Sleep(5000) ;send("!{END}");Not detecting ControlTreeView MartUpgrade on Windows 10, so sending ALT+END to go to last element send ("{SPACE}") Send("{DOWN}") send("{ENTER}") Sleep(5000) Logging("Selected "& $sFeature &" to install it...") EndIf ControlTreeView($hwnd," ",$htreeview,"Select","#0") Sleep(5000) Logging("Selected RootFeature...") ElseIf StringUpper($sFeatureEnabled)="NO" then Logging("Not selecting "& $sFeature &" for installation...") if ControlClick("[CLASS:MsiDialogCloseClass]"," ","[CLASS:SysTreeView32; INSTANCE:1]") Then $htreeview=ControlGetHandle($hwnd,"","[CLASS:SysTreeView32; INSTANCE:"&$iInstance&"]") ControlTreeView($hwnd," ",$htreeview,"Select","#"&$iID&"");Working ControlTreeView but not in enhanced mode on hyperv Sleep(5000) ;send("!{END}");Not detecting ControlTreeView MartUpgrade on Windows 10, so sending ALT+END to go to last element send ("{SPACE}") Send("{DOWN "& $iDownCount &"}") send("{ENTER}") Sleep(5000) Logging("UnSelected "& $sFeature &" to not install it...") EndIf ControlTreeView($hwnd," ",$htreeview,"Select","#0") Sleep(5000) Logging("Selected RootFeature...") Else Logging("Keeping feature selection of "& $sFeature &" as is...") EndIf EndFunc ;------------------------------------ ;Functions related to Functionality Testing of DM ;------------------------------------ Func LaunchErwin() If ($bit = 64 or Get_Arch()=32) then $erwin = 'C:\Program Files\erwin\Data Modeler '& StringSplit($release,'.')[1] &'\erwin.exe' Else $erwin = 'C:\Program Files (x86)\erwin\Data Modeler '& StringSplit($release,'.')[1] &'\erwin.exe' EndIf ;Run($erwin) Sleep(10000) Logging("Launching erwin.exe from "&_PathFull($erwin & "..\..")) Run($erwin,_PathFull($erwin & "..\..")) ;Run(@ComSpec & " /c """ & @ProgramsCommonDir&"\erwin\erwin Data Modeler "& $release &" ("& $bit &"-bit)\erwin Data Modeler "& $release &" ("& $bit &"-bit).lnk""", @TempDir, @SW_HIDE) #comments-start Flexera License Server logic $hwd = _WinWaitActivate1("erwin Data Modeler Licensing","Acquire concurrent u") ;Send("{ALTDOWN}w{ALTUP}") ControlCommand($hwd,"","[CLASS:Button; INSTANCE:2]","Check") ControlClick($hwd, "", "[ID:1425]") Send("{CTRLDOWN}a{CTRLUP}{DEL}") ControlCommand($hwd,"","[CLASS:Edit; INSTANCE:3]","EditPaste", 'chesr03-1w7') ControlClick($hwd, "", "[ID:1]") Logging("License details entered and submitted...") #comments-end If Not IsDeclared("LicenseCode") Then Logging("License Details are not provided, so stopping the testing here.") Exit Else $hwd = _WinWaitActivate1("erwin Data Modeler Licensing","Licensing") Sleeping("Licensing dialog") #cs ControlClick($hwd, "", "[CLASS:Edit; INSTANCE:1]") Send("{CTRLDOWN}a{CTRLUP}{DEL}") ControlCommand($hwd,"","[CLASS:Edit; INSTANCE:1]","EditPaste", $LicenseCode);'487700000011824693') #ce ControlSetText($hwd, "", "Edit1", $LicenseCode) Sleeping("License number pasting") ControlSetText($hwd, "", "Edit7", $LicenseEmail) #cs ControlClick($hwd, "", "[CLASS:Edit; INSTANCE:7]") Send("{CTRLDOWN}a{CTRLUP}{DEL}") ControlCommand($hwd,"","[CLASS:Edit; INSTANCE:7]","EditPaste", $LicenseEmail) #ce Sleeping("License email pasting") ControlClick($hwd, "", "[CLASS:Button; INSTANCE:1]") Logging("License details entered and submitted...") Sleeping("License ok button click") EndIf $hwd = _WinWaitActivate1("Data Modeler Tips","Show tips on startup") Sleeping("Tips window") ControlCommand($hwd,"","[CLASS:Button; INSTANCE:1]","UnCheck") ControlClick($hwd, "", "[ID:1]") Logging("Data Modeler Tips unchecked closed...") VersionDetails() Logging(FolderProperties(_PathFull($erwin & "..\.."))) Logging("Checking contents of DM related Folders") CheckFileListFromFile(@ScriptDir & "\DM_FileList_"&$bit&".txt") if StringUpper($MartUpgrade)="YES" Then Logging("MartUpgrade is selected.So folder properties mentioned below") Logging(FolderProperties(_PathFull($erwin & "..\..\Upgrade"))) Logging("Checking contents of Upgrade Folder") CheckFileListFromFile(@ScriptDir & "\DM_MU_FileList_"&$bit&".txt") Else Logging("MartUpgrade is not selected.So folder properties not available") EndIf EndFunc ;To check Version details of DM Func VersionDetails() Local $sStringValue = FileGetVersion(@ScriptDir & "\" & $build, "ProductVersion") $sCompleteInfo = True If $bit = 64 then $ProdCode = $Prod64;"{C3A940D1-F8F8-4DEE-AC2B-5CB9AB9B6315}" else $ProdCode = $Prod32;"{F4D7A891-F52D-463E-B354-7A14501A80D7}" EndIf If Not @error Then Logging ("Version details from setup file "& $sStringValue) Else Logging ("Error : Unable to Retrieve Version details from setup file") $sCompleteInfo = False EndIf $sReg = "HKLM"& $bit &"\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"&$ProdCode If ($bit = 32 and Get_Arch()=64) then ;if compiled as 32 it exe then remove wow6432node $sReg = "HKLM\SOFTWARE\wow6432node\Microsoft\Windows\CurrentVersion\Uninstall\"&$ProdCode ElseIf ($bit = 32 and Get_Arch()=32) then;giving error with 32 bit OS as not found so added this logic even though HKLM32 option is there. $sReg = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"&$ProdCode EndIf Local $sVar = RegRead($sReg, "DisplayVersion") If Not @error Then Logging ("Version details from Control Panel "& $sVar) Else Logging ("Error : Unable to Retrieve Version details from Control Panel") $sCompleteInfo = False EndIf ;Can be used only when erwin.exe window is opened $hwd = _WinWaitActivate1("erwin DM", "Model Explorer") Sleeping("DM window") Send("!ha") $hwd = _WinWaitActivate1("About erwin Data Modeler", "View the End-User License Agreement") Sleeping("version number window") $sControl = ControlGetText($hwd, "", "[CLASS:Static; INSTANCE:4]") $r = ConfigValue($sControl,"Release") ControlClick($hwd, "", "[ID:1]") if StringLen($r)>0 then Logging ("Version details from About tab "& $r) Else Logging ("Error : Unable to Retrieve Version details from About tab") $sCompleteInfo = False EndIf if $sCompleteInfo Then ;if(StringCompare($sStringValue,$sVar)=0 AND StringCompare($sVar,$r)=0) Then if(_VersionCompare($sStringValue,$sVar)=0 AND _My_VersionCompare($sVar,$r)=0) Then Logging("Version details are same in all the 3 locations") Else Logging("Error : Version details are not same in all the 3 locations") EndIf Else Logging("Error : Version comparison is not done as one or more of the 3 locations are not readable") EndIf EndFunc ;Due to machine speed issues, sometimes the dialogs takes time to load completely, and to skip the errors of not able to find the GUI elements, keeping this sleep. Func Sleeping($message = "dialog" ,$sleepTime = 5000) Logging("Sleep delay for "& $message &" to load completely") Sleep($sleepTime) EndFunc Func MartServerTesting() If @OSVersion = "WIN_2012R2" or "WIN_2012R2" or "WIN_2008R2" or "WIN_2008" Then Logging("Trying to install Dotnet 3.5 from DISM tool online") $ps = FindFileInPath("Dism.exe", @SystemDir) $temp_cmd = $ps & " /Online /Enable-Feature /FeatureName:NetFX3 /All";https://technet.microsoft.com/en-us/library/hh824822.aspx ;https://technet.microsoft.com/en-in/library/dn482069.aspx Local $iReturn = RunWait($temp_cmd) Logging("Dotnet 3.5 installation return status: "&$iReturn) EndIf If ($bit = 64 or Get_Arch()=32) then $erwin = 'C:\Program Files\erwin\Mart Server '& StringSplit($release,'.')[1] &'\MartConfiguration.exe' Else $erwin = 'C:\Program Files (x86)\erwin\Mart Server '& StringSplit($release,'.')[1] &'\MartConfiguration.exe' EndIf Logging("Launching MartConfiguration.exe from "&_PathFull($erwin & "..\..")) Run($erwin,_PathFull($erwin & "..\..")) $win1 = "erwin Mart Configuration" $MartConfigWindow = _WinWaitActivate1($win1,"Database Details") ControlClick($MartConfigWindow, "", "[NAME:cb_DBType]") $i = 1 $ctext = "" While 1 if ($i = 1) then Send("{UP}") else Send("{DOWN}") EndIf $tctext = ControlGetText($MartConfigWindow,"","[NAME:cb_DBType]") if (StringCompare($tctext, $ctext) = 0) Then if ($i = 0) then $i = 1 Else $i = 0 EndIf Else $ctext=$tctext If $ctext=$dbtype Then ControlClick($MartConfigWindow, "", "[NAME:cb_DBType]") ExitLoop EndIf EndIf WEnd Logging("selected DB: "& $ctext) ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.378734a6", $dbserver) ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.378734a4", $dbname) ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.378734a9", $dbuser) ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.378734a8", $dbpassword) ControlClick($MartConfigWindow, "", "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:2]") ;SOmetimes the ID is changing ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.33c0d9d6", $dbserver) ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.33c0d9d4", $dbname) ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.33c0d9d9", $dbuser) ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.33c0d9d8", $dbpassword) ControlClick($MartConfigWindow, "", "[CLASS:WindowsForms10.BUTTON.app.0.33c0d9d; INSTANCE:2]") Sleeping("Configure button clicked",10000) If WinExists($MartConfigWindow) Then Logging("Error: Problem with configuration") ;Exit Else Logging("Mart configured successfully") EndIf $CatalineLog = @LocalAppDataDir & "\erwin\Mart Server\logs\catalina."&TodaysDate1()&".log" if FileExists($CatalineLog) Then FileDelete($CatalineLog) Logging("Deleted old MartServer Tomcat Catalina Log file: "& $CatalineLog) EndIf If ($bit = 64 or Get_Arch()=32) then $msc = "C:\Program Files\erwin\Mart Server r9\Tomcat64" Else $msc = "C:\Program Files (x86)\erwin\Mart Server r9\Tomcat" EndIf $iPID = Run(@ComSpec & " /c " & """"& $msc &"\bin\startup.bat""",$msc & "\bin\") Sleeping("waiting for tomcat of martserver start"&$iPID,40000) $TomcatConsole = "[CLASS:ConsoleWindowClass]" If (WinExists($TomcatConsole) And WinGetTitle($TomcatConsole)="Tomcat") Then Logging("Tomcat console launched successfully: Title("&WinGetTitle($TomcatConsole)&")") Else Logging("Problem with TOmcat console to run") Exit EndIf Sleeping("waiting for tomcat of martserver to load war files completely"&$iPID,40000) if FileExists($CatalineLog) Then ; Read the contents of the file using the handle returned by FileOpen. Local $sFileRead = FileRead($CatalineLog) ; Close the handle returned by FileOpen. FileClose($CatalineLog) If StringInStr(StringStripWS($sFileRead, $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES ), "INFO: Server startup in") Then Logging("Mart Server Tomcat started") Else Logging("Mart Server Tomcat not started") Exit EndIf EndIf $iPID1 = Run(@ComSpec & " /c " & """"& $msc &"\erwin MartAdmin.bat""",$msc) Sleeping("Launched MartAdmin shortcut",40000) if(ProcessClose("iexplore.exe") = 1 ) Then Logging("Internet explorer closed successfully") else Logging("Internet Explorer failed to termincate with error code "&@error) Exit EndIf Sleeping("Going to start IE Testing now in 10 seconds",10000) if(WinKill("Tomcat") = 1) then;TOmcat console window Logging("Closed the Tomcat Console") Logging("----------Completed IE Testing--------") Else Logging("Unable to close Tomcat console") Exit EndIf EndFunc Func PostGRESQL();\\Sinra09-desk\RAJAN01\ERWINQA-PC\PDB Installer Repository\PostgreSQL Local $iReturn = RunWait(""""& @ScriptDir &"\vcredist_x86.exe"" /install /passive /norestart") ;MsgBox($MB_SYSTEMMODAL, "", "The return code from Notepad was: " & $iReturn) if ($iReturn = 0) Then Logging("Completed vc++ x86 installation") Else Logging("postgresql installation failed") EndIf Local $iReturn = RunWait(""""& @ScriptDir &"\vcredist_x64.exe"" /install /passive /norestart") ;MsgBox($MB_SYSTEMMODAL, "", "The return code from Notepad was: " & $iReturn) if ($iReturn = 0) Then Logging("Completed vc++ x64 installation") Else Logging("vc++ x64 installation failed") EndIf $pgsConfig = @ScriptDir &"\postgresql.txt" if NOT FileExists($pgsConfig) Then Logging("postgresql installation config file not found") EndIf if NOT FileExists("C:\Program Files\PostgreSQL\9.6") Then Local $iReturn = RunWait(""""& @ScriptDir &"\postgresql-9.6.4-1-windows-x64.exe"" --optionfile """& $pgsConfig &"""") ;MsgBox($MB_SYSTEMMODAL, "", "The return code from Notepad was: " & $iReturn) if ($iReturn = 0) Then Logging("Completed postgresql installation") Else Logging("postgresql installation failed") EndIf Else Logging("postgresql already exists,so skipped installation.") EndIf Local $iPID = Run(@ComSpec & " /c " & """C:\Program Files\PostgreSQL\9.6\scripts\runpsql.bat""","C:\Program Files\PostgreSQL\9.6\scripts") Sleeping("Waiting for PostgreSQL console to open: "&$iPID,40000) Local $PostgreDBConsole = "[CLASS:ConsoleWindowClass]" If WinExists($PostgreDBConsole) Then Logging("Postgresql console launched successfully: Title("&WinGetTitle($PostgreDBConsole)&")") Else Logging("Problem with Postgresql console to run") Exit EndIf WinActivate($PostgreDBConsole) ;Send("{ENTER}{ENTER}{ENTER}{ENTER}"& readConfig($pgsConfig,"superpassword","=") &"{ENTER}create{SPACE}database{SPACE}"& $MartDatabase &";{ENTER}") Send("{ENTER}{ENTER}{ENTER}{ENTER}") Send(readConfig($pgsConfig,"superpassword","="),1 );1 will send raw keys so ! won't be treated as alt. Send("{ENTER}create{SPACE}database{SPACE}"& $MartDatabase &";{ENTER}") Sleeping("tried creating database",40000) WinKill($PostgreDBConsole) Logging("postgresql DB password" & readConfig($pgsConfig,"superpassword","=")) $dbtype = "POSTGRESQL" $dbserver = "localhost" $dbname = $MartDatabase $dbuser = readConfig($pgsConfig,"superaccount","=") $dbpassword = readConfig($pgsConfig,"superpassword","=") EndFunc