; *** Start added by AutoIt3Wrapper *** #include #include ; *** End added by AutoIt3Wrapper *** #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Removable Drive.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include #include #include #include #include #include #cs $sSourceFolder = "C:\Binaries\14-07-2016\9642\32 bit\0714-15.Binary.r9642_Release_win32_Fresh" $sDestinationFolder = "C:\ERwin ISM\x64\_AppFiles-Telos - Copy" FolderContentsReplace($sSourceFolder,$sDestinationFolder) #ce AutoItSetOption ("ExpandVarStrings", 1) Func TodaysDate1();same as TodaysDate() but in yyyy-mm-dd $NewDate = _DateTimeFormat(_NowCalcDate(),1) $Array = StringSplit( $NewDate , ',' ) _ArrayDelete($Array, 0) _ArrayDelete($Array, 0) $Array1 = StringSplit($Array[0],' ') RemoveEmptyArrayLines($Array1) $Date = StringStripWS($Array[1]&"-"&changeDateformat(StringLeft($Array1[1], 3))&"-"&$Array1[2], $STR_STRIPALL) return $Date EndFunc Func FindFileInPath($sFileName, $sPath) ;finds the file specified in the path specified or any of it's subfolders Local $aFileList $aFileList = _FileListToArrayRec($sPath, $sFileName, 1, 1, 1, 2) If UBound($aFileList) > 1 Then Return $aFileList[1] Else Return "" EndIf EndFunc Func getBuildNumber($sFilePath);Path of the erwin.exe is passed to get build number. ;$sFilePath = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)") ; Retrieve the file version of the AutoIt executable. Local $sFileVersion = FileGetVersion($sFilePath) Local $aSplit=StringSplit($sFileVersion,'.') If IsArray($aSplit) Then return $aSplit[3] Else return "Invalid Build Number" EndIf EndFunc ;==>Example ;To convert mmm to mm format Func changeDateformat($sText) Local $sMsg = StringStripWS($sText, $STR_STRIPALL) Switch $sMsg Case "Jan" $sMsg = "01" Case "Feb" $sMsg = "02" Case "Mar" $sMsg = "03" Case "Apr" $sMsg = "04" Case "May" $sMsg = "05" Case "Jun" $sMsg = "06" Case "Jul" $sMsg = "07" Case "Aug" $sMsg = "08" Case "Sep" $sMsg = "09" Case "Oct" $sMsg = "10" Case "Nov" $sMsg = "11" Case "Dec" $sMsg = "12" EndSwitch return $sMsg EndFunc Func CurrentDateAndTime() $td = _NowTime() $td = StringReplace($td, " ", "_") $td = StringReplace($td, ":", "-") return TodaysDate() & "_" & $td EndFunc Func TodayDateTime() $td = _DateTimeFormat(_NowCalc(), 0) $td = StringReplace($td, " ", "_") $td = StringReplace($td, ":", "-") if StringInStr($td, "/")>0 then $td = StringReplace($td, "/", "-") return $td EndFunc Func TodaysDate() $NewDate = _DateTimeFormat(_NowCalcDate(),1) $Array = StringSplit( $NewDate , ',' ) _ArrayDelete($Array, 0) _ArrayDelete($Array, 0) $Array1 = StringSplit($Array[0],' ') RemoveEmptyArrayLines($Array1) ;Will return the present day's date with format dd-mmm-yyyy ;$Date = StringStripWS($Array1[2]&"-"&StringLeft($Array1[1], 3)&"-"&$Array[1], $STR_STRIPALL) $Date = StringStripWS($Array1[2]&"-"&changeDateformat(StringLeft($Array1[1], 3))&"-"&$Array[1], $STR_STRIPALL) return $Date EndFunc Func RemoveEmptyArrayLines(ByRef $arrLines) $intCount = 1 While $intCount < UBound($arrLines) $arrLines[$intCount] = StringStripWS($arrLines[$intCount],$STR_STRIPLEADING + $STR_STRIPTRAILING) If StringLen($arrLines[$intCount])=0 Then _ArrayDelete($arrLines, $intCount) $intCount = $intCount - 1 EndIf $intCount = $intCount + 1 WEnd EndFunc Func PreviousDate() $NewDate = _DateTimeFormat(_DateAdd('D', -1, _NowCalcDate()),1) $Array = StringSplit( $NewDate , ',' ) _ArrayDelete($Array, 0) _ArrayDelete($Array, 0) $Array1 = StringSplit($Array[0],' ') RemoveEmptyArrayLines($Array1) $Date = StringStripWS($Array1[2]&"-"&StringLeft($Array1[1], 3)&"-"&$Array[1], $STR_STRIPALL) return $Date EndFunc Func FolderContentsReplace($sSourceFolder,$sDestinationFolder) $aFileList = _FileListToArray($sSourceFolder,"*",$FLTA_FILES) ;_ArrayDisplay($aFileList) _ArrayDelete($aFileList, 0) For $sFile In $aFileList FileReplace($sSourceFolder,$sFile,$sDestinationFolder) Next EndFunc Func SplitSpaceNotInQuotes($sString) $aString = StringSplit($sString, "", 2) $iStart = 0 For $i=0 to UBound($aString)-1 if ($aString[$i]="""" or $aString[$i]="'") and $iStart=1 then $iStart = 0 if ($aString[$i]="""" and (Mod(UBound(StringSplit(_ArrayToString($aString,"",$i), """")),2) = 0)) or ($aString[$i]="'" and (Mod(UBound(StringSplit(_ArrayToString($aString,"",$i), "'")),2) = 0)) then $iStart=1 EndIf if $iStart = 1 then if $aString[$i]=" " then $aString[$i]="æ" EndIf Next $sStringModified = _ArrayToString($aString,"") $aString1 =stringsplit($sStringModified," ") For $b=1 to UBound($aString1)-1 $aString1[$b]=trimQuotes($aString1[$b]) $aString1[$b]= StringReplace ( $aString1[$b], "æ", " ") Next return $aString1 EndFunc Func trimQuotes($sName) if StringRight($sName, 1)="""" then $sName = StringTrimRight( $sName, 1 ) if StringLeft($sName, 1)="""" then $sName = StringTrimLeft( $sName, 1 ) if StringRight($sName, 1)="'" then $sName = StringTrimRight( $sName, 1 ) if StringLeft($sName, 1)="'" then $sName = StringTrimLeft( $sName, 1 ) return $sName EndFunc Func applyQuotes($strName) $strName = trimQuotes($strName) $strName = """" & $strName & """" return $strName EndFunc Func CheckForSpaces($string);Check if spaces exist in a string if StringLen($string) - StringLen(StringStripWS ( $string, $STR_STRIPALL )) > 0 Then return True Else return False EndIf EndFunc Func CheckForSpaceApplyQuotes($strName) if CheckForSpaces($strName) Then $strName=applyQuotes($strName) return $strName EndFunc Func trimLastSlash($sName) if StringRight($sName, 1)="\" then return StringTrimRight( $sName, 1 ) else return $sName EndIf EndFunc Func trimFirstSlash($sName) if StringLeft($sName, 1)="\" then return StringTrimLeft( $sName, 1 ) else return $sName EndIf EndFunc Func CheckReadOnlyAttribute($sFilePath) Local Const $sAttribute = FileGetAttrib($sFilePath) If StringInStr($sAttribute,"a") then FileSetAttrib($sFilePath, "-R") Logging( "Read only removed: " & $sFilePath,3 ) return true Else return false EndIf EndFunc Func FileReplace1($sFilePath,$sDestinationFolder) Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $aPathSplit = _PathSplit($sFilePath, $sDrive, $sDir, $sFileName, $sExtension) ;_ArrayDisplay($aPathSplit, "_PathSplit of " & @ScriptFullPath) FileReplace($sDrive & $sDir , $sFileName & $sExtension,$sDestinationFolder) EndFunc Func FileNameOnly($sFilePath) Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $aPathSplit = _PathSplit($sFilePath, $sDrive, $sDir, $sFileName, $sExtension) ;_ArrayDisplay($aPathSplit, "_PathSplit of " & @ScriptFullPath) return $sFileName EndFunc Func FileReplace($sSourceFolder,$sOnlyFile,$sDestinationFolder) $sDestinationFile = trimLastSlash($sDestinationFolder) & "\" & $sOnlyFile $sSourceFile = trimLastSlash($sSourceFolder) & "\" & $sOnlyFile $bExistence = false $bReadonly = false if FileExists($sDestinationFile) Then $bExistence = true $bReadonly = CheckReadOnlyAttribute($sDestinationFile) Local $iDelete = FileDelete($sDestinationFile) LogStatus($iDelete,$sDestinationFile,0) EndIf ;Logging("Trying to copy from folder" & $sSourceFolder & "\" & $sOnlyFile & " to " & $sDestinationFile) Local $iCopy = FileCopy($sSourceFile , $sDestinationFolder & "\", $FC_OVERWRITE + $FC_CREATEPATH) #cs if $bReadonly then FileSetAttrib($sDestinationFile, "+R") Logging( "Read only set back: " & $sDestinationFile,3 ) EndIf #ce If $iCopy Then If $bExistence Then Logging("Success on Overwrite: " & $sSourceFolder & "\" & $sOnlyFile & " to " & $sDestinationFile,1) Else Logging("Success on Copy: " & $sSourceFolder & "\" & $sOnlyFile & " to " & $sDestinationFile ,2) EndIf Else If $bExistence Then Logging("Error on Overwrite: " & $sSourceFolder & "\" & $sOnlyFile & " to " & $sDestinationFile,1) Else Logging("Error on Copy: " & $sSourceFolder & "\" & $sOnlyFile & " to " & $sDestinationFile ,2) EndIf EndIf EndFunc Func LogStatus($bReturnCode,$sDestinationFile,$iType=0) Local $arr[6] = ["Deletion: ", "Overwrite: ", "Copy: ","Read-only attribute:","","Move: "] $sMsg = $arr[$iType] If $bReturnCode Then Call("Logging","Success on " & $sMsg & $sDestinationFile,$iType) Else Call("Logging","Error on " & $sMsg & $sDestinationFile,$iType) EndIf EndFunc Func SelectFolder(ByRef $sFolderSelected,$sMsg) ; Create a constant variable in Local scope of the message to display in FileSelectFolder. Local Const $sMessage = "Select a folder for $sMsg$" ; Display an open dialog to select a file. Local $sFileSelectFolder = FileSelectFolder($sMessage, "") If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.") Exit(1) Else ; Display the selected folder. ;MsgBox($MB_SYSTEMMODAL, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder) $sFolderSelected = trimLastSlash($sFileSelectFolder) EndIf EndFunc Func readConfig($sFilePath,$intStartCode,$sSeperator = ":") ;Usage: MsgBox(0,"Silent",readConfig(@ScriptDir&"\Config.txt","Silbent")) ;$sReplaceText = "Mani Prakash" ;$sFilePath = "C:\Users\KIRUD01\Desktop\Config.txt" ;$intStartCode = "BuildExe" $arrRetArray = "" $s = _FileReadToArray($sFilePath, $arrRetArray);Reading text file and saving it to array $s will show status of reading file.. For $i = 1 To UBound($arrRetArray)-1 $line = $arrRetArray[$i];retrieves taskengine text line by line ;If StringInStr($line, $intStartCode) Then If StringInStr(StringStripWS($line, $STR_STRIPALL), $intStartCode & $sSeperator) Then ConsoleWrite ("Starting point "& $line & @CRLF) return StringStripWS(StringSplit($line,$sSeperator)[2],$STR_STRIPLEADING + $STR_STRIPTRAILING ) EndIf if $i = UBound($arrRetArray)-1 then return "Not Found" Next EndFunc Func writeConfig($sFilePath,$intStartCode,$sReplaceText,$sSeperator = ":") ;$sReplaceText = "Mani Prakash" ;$sFilePath = "C:\Users\KIRUD01\Desktop\Config.txt" ;$intStartCode = "BuildExe" $arrRetArray = "" $s = _FileReadToArray($sFilePath, $arrRetArray);Reading text file and saving it to array $s will show status of reading file.. $intStartingPointFound = 0 For $i = 1 To UBound($arrRetArray)-1 $line = $arrRetArray[$i];retrieves taskengine text line by line ;If StringInStr($line, $intStartCode) Then If StringInStr(StringStripWS($line, $STR_STRIPALL), $intStartCode & $sSeperator) Then $intStartingPointFound = 1;if found the starting point of the module to copy then set this variable to 1 ConsoleWrite ("Starting point " & @CRLF) $arrRetArray[$i] = $intStartCode & $sSeperator & " " & $sReplaceText ExitLoop EndIf if $i = UBound($arrRetArray)-1 then ConsoleWrite("Not Found" & @CRLF) Next _FileWriteFromArray ($sFilePath, $arrRetArray,1) EndFunc Func Logging($sMessage,$iLogType=4) Local $arr[7] = ["LoggingDelete", "LoggingOverwrite", "LoggingCopy","LoggingAttribute","LoggingDefault","LoggingMove"] Call($arr[$iLogType],$sMessage) EndFunc Func LoggingDefault($sMessage,$sLogFile=@ScriptDir&"\Logging.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Func LoggingCopy($sMessage,$sLogFile=@ScriptDir&"\LoggingCopy.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Func LoggingDelete($sMessage,$sLogFile=@ScriptDir&"\LoggingDelete.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Func LoggingOverwrite($sMessage,$sLogFile=@ScriptDir&"\LoggingOverwrite.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Func LoggingAttribute($sMessage,$sLogFile=@ScriptDir&"\LoggingAttribute.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Func LoggingMove($sMessage,$sLogFile=@ScriptDir&"\LoggingMove.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Func LoggingISM($sMessage,$sLogFile) $sLogFile=@ScriptDir&"\LoggingISM_.$sLogFile$.log" If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Func LoggingNetwork($sMessage,$sLogFile=@ScriptDir&"\LoggingNetwork.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Func MoveLogs($DestinationFolder,$mailRequired=0) $DestinationFolder= trimLastSlash(@ScriptDir) & "\$DestinationFolder$\" & TodaysDate() DirCreate ($DestinationFolder);No need to check whether directory exists, as it skips creation if already exists If FileExists(trimLastSlash(@ScriptDir)&"\Logging.log") then FileMove(trimLastSlash(@ScriptDir)&"\Logging.log", "$DestinationFolder$\", $FC_OVERWRITE) If FileExists(trimLastSlash(@ScriptDir)&"\LoggingAttribute.log") then FileMove(trimLastSlash(@ScriptDir)&"\LoggingAttribute.log", "$DestinationFolder$\", $FC_OVERWRITE) If FileExists(trimLastSlash(@ScriptDir)&"\LoggingDelete.log") then FileMove(trimLastSlash(@ScriptDir)&"\LoggingDelete.log", "$DestinationFolder$\", $FC_OVERWRITE) If FileExists(trimLastSlash(@ScriptDir)&"\LoggingOverwrite.log") then FileMove(trimLastSlash(@ScriptDir)&"\LoggingOverwrite.log", "$DestinationFolder$\", $FC_OVERWRITE) If FileExists(trimLastSlash(@ScriptDir)&"\LoggingCopy.log") then FileMove(trimLastSlash(@ScriptDir)&"\LoggingCopy.log", "$DestinationFolder$\", $FC_OVERWRITE) if $mailRequired<>0 then ;MsgBox(0,"New files added","Please check the LoggingCopy.log in folder $DestinationFolder$",60);Timeout for 60 seconds SendMail("New files are added to folder",$DestinationFolder) EndIf EndIf FileMove(trimLastSlash(@ScriptDir)&"\Logging*.log", "$DestinationFolder$\", $FC_OVERWRITE + $FC_CREATEPATH) EndFunc Func SendMail($subject,$body,$attachment = "None") FileInstall(".\SendMail.ps1", @ScriptDir & "\SendMail.ps1") FileInstall(".\Library.ps1", @ScriptDir & "\Library.ps1") $ps = FindFileInPath("powershell.exe", @SystemDir&"\WindowsPowerShell");As Git.exe will be available in program files only both in x64 and x86 so hardcoding this. if StringCompare($attachment, "None")=0 then $temp_cmd = """"& $ps & """ -ExecutionPolicy Bypass -File """ & @ScriptDir & "\SendMail.ps1"" /s """ & $subject &""" /b """& $body &""" " else $temp_cmd = """"& $ps & """ -ExecutionPolicy Bypass -File """ & @ScriptDir & "\SendMail.ps1"" /s """ & $subject &""" /b """& $body &""" /a """& $attachment &""" " EndIf ;MsgBox(0,"",$temp_cmd) Local $iReturn = RunWait($temp_cmd) return $iReturn EndFunc Func SendMailTeam($BuildNumber) FileInstall(".\SendInstallCreationMail.ps1", @ScriptDir & "\SendInstallCreationMail.ps1") FileInstall(".\Library.ps1", @ScriptDir & "\Library.ps1") $ps = FindFileInPath("powershell.exe", @SystemDir&"\WindowsPowerShell");As Git.exe will be available in program files only both in x64 and x86 so hardcoding this. $temp_cmd = """"& $ps & """ -ExecutionPolicy Bypass -File """ & @ScriptDir & "\SendInstallCreationMail.ps1"" """ & $BuildNumber &""" " ;MsgBox(0,"",$temp_cmd) Local $iReturn = RunWait($temp_cmd) return $iReturn EndFunc Func ConfigValue($line,$intStartCode);To split key value pairs inside the script If StringInStr(StringStripWS($line, $STR_STRIPALL), $intStartCode & ":") Then ConsoleWrite ("Starting point "& $line & @CRLF) return StringStripWS(StringSplit($line,":")[2],$STR_STRIPLEADING + $STR_STRIPTRAILING ) Else return "" EndIf EndFunc Func FolderProperties($Folder) $output = @CRLF & "-------------Folder properties of "& $Folder &" started-------------"&@CRLF if Not FileExists($Folder) Then $output = $output & "Path Not found: "&$Folder&@CRLF Else $array = DirGetSize($Folder,1) if UBound($array)=3 then $output = $output & ("No.of sub directories: "&$array[2]&@CRLF) $output = $output & ("No.of files: "&$array[1]&@CRLF) if $array[0]<1024 then $output = $output & ("Total size in Bytes: "&$array[0]&@CRLF) ElseIf ($array[0]>=1024 and $array[0]<(1024*1024)) then $output = $output & ("Total size in KiloBytes: "&($array[0]/1024)&@CRLF) ElseIf ($array[0]>=(1024*1024) and $array[0]<(1024*1024*1024)) then $output = $output & ("Total size in MegaBytes: "&($array[0]/(1024*1024))&@CRLF) Else $output = $output & ("Total size in GigaBytes: "&($array[0]/(1024*1024*1024))&@CRLF) EndIf EndIf EndIf $output = $output & "-------------Folder properties of "& $Folder &" completed-------------"&@CRLF return $output EndFunc Func UpdateGitRepo($sRepo,$repo="gitstatus.txt") $git = FindFileInPath("git.exe", "C:\Program Files\Git");As Git.exe will be available in program files only both in x64 and x86 so hardcoding this. $temp_cmd = "cmd.exe /c """&$git&""" -C "&$sRepo&" pull >> "&@TempDir&"\"&$repo;using cmd.exe as redirection operator only works through cmd ;MsgBox(0,"",$temp_cmd) Local $iReturn = RunWait($temp_cmd) return $iReturn EndFunc Func getCertPassword() Local $aInput $file = @TempDir & "\certp.txt" CheckFile($file) _FileReadToArray($file, $aInput) #cs For $i = 1 to UBound($aInput) -1 ;MsgBox (0,'',$aInput[$i]) Next #ce return $aInput[1] EndFunc Func SignEXE($signtarget,$signdesc) CheckFile(@ScriptDir & "\signtool.exe") CheckFile(@ScriptDir & "\e2f56170396591c7-SHA2.pfx") $signtool = """" & @ScriptDir & "\signtool.exe""" $signpfx = """" & @ScriptDir & "\e2f56170396591c7-SHA2.pfx""" $signdesc = applyQuotes($signdesc);$signdesc = """erwin program""" $signurl = """http://erwin.com""" $signtarget = applyQuotes($signtarget);$signtarget = """C:\Users\ukreddy\Desktop\erwin\godaddycert\erwin Mart Server r9.8 (64-bit).exe""" $sBuildCommand = $signtool & " sign /v /f " & $signpfx & " /p "& getCertPassword() &" /tr http://tsa.starfieldtech.com /td SHA256 /d "& $signdesc & " /du "& $signurl & " " & $signtarget $AppName = "asd" ;MsgBox(0,"",$sBuildCommand) $sOutput = _Process_RunCommand($PROCESS_RUNWAIT, $PROCESS_COMMAND & """" &$sBuildCommand &"""") ; Record the output $Ret = @extended ; Note the exit code Logging("This is the result: " & @CRLF & @CRLF & $sOutput & @CRLF & @CRLF & "The exit code was: " & $Ret) If $Ret <> 0 Then Logging("Error "&$Ret&" while running command") Exit(1) Else Logging("Completed runnig command successfully",4) EndIf if not StringInStr(StringStripWS($sOutput, $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES ), "Number of files successfully Signed: 1") then Logging("error in signing exe: "&$signdesc) Exit(1) Else Logging("succesfully signed exe: "&$signdesc) EndIf EndFunc Func CheckFile($cfile) if not FileExists($cfile) then Logging("File not exists: "& $cfile) Exit(1) Else Logging("File exists: "& $cfile) EndIf EndFunc Func _My_VersionCompare($sVersion1, $sVersion2) Logging("Converting 4 section format to 3 section using function _My_VersionCompare") Logging("Pre calculated version v1:" & $sVersion1) Logging("Pre calculated version v2:" & $sVersion2) $V1 = StringSplit($sVersion1, ".") $V2 = StringSplit($sVersion2, ".") If $V1[0] = 4 Then if StringLen($V1[1])=1 Then $sVersion1 = $V1[1] & $V1[2] & "." & appendZero($V1[3]) & "." & $V1[4] Else $sVersion1 = $V1[1] & "." & appendZero($V1[2] & $V1[3]) & "." & $V1[4] EndIf Logging("Calculated version v1 : " & $sVersion1) EndIf If $V2[0] = 4 Then ;$sVersion2 = $V2[1] & "." & $V2[2] & $V2[3] & "." & $V2[4] if StringLen($V2[1])=1 Then $sVersion2 = $V2[1] & $V2[2] & "." & appendZero($V2[3]) & "." & $V2[4] Else $sVersion2 = $V2[1] & "." & appendZero($V2[2] & $V2[3]) & "." & $V2[4] EndIf Logging("Calculated version v2 : " & $sVersion2) EndIf Return _VersionCompare($sVersion1, $sVersion2) EndFunc Func appendZero($sValue) While StringLen($sValue) < 3 $sValue = $sValue & 0 WEnd return $sValue EndFunc Func Get_Arch() if StringStripWS(StringUpper(@OSArch), $STR_STRIPALL)="X86" Then return 32 Else return 64 EndIf EndFunc Func waitForSystem($systemname,$waitTime=20000) for $iCount = 1 to 10 if Ping($systemname)>0 Then ;Logging($iCount & $systemname) return True Else $iCount = $iCount + 1 Sleep($waitTime) EndIf Next ;MsgBox(0,"",$iCount) return False EndFunc