Jump to content

_GUICtrlRichEdit_Destroy Doubt


Syed23
 Share

Recommended Posts

Hi All,

Just curious to know, i have created a _GUICtrlRichEdit_Create() control and due to some technical reason i want to refresh the data written on the control already and rewrite new stuffs. so i am using _GUICtrlRichEdit_Destroy() control to delete the created Richedit control and recreating it but nothing is getting writte. I know there is some mistake on my side but can some one point out me where i am doing wrong?

Here is my complete project code:

#RequireAdmin
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=database-next.ico
#AutoIt3Wrapper_Outfile=DCU.exe
#AutoIt3Wrapper_Res_Comment=Data Restoration Utility
#AutoIt3Wrapper_Res_Description=Data Restoration Utility
#AutoIt3Wrapper_Res_Fileversion=1.0.0.15
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_Res_LegalCopyright=Site Support Team
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
://////=__=
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <TreeViewConstants.au3>
#include "_XMLDomWrapper.au3"
#include "GIFAnimation.au3" ;
#include "GDIpProgress.au3"
#include <GuiRichEdit.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>
#include "Bit.au3"
#include "Bitlocker.au3"
#include <ComboConstants.au3>
#include"Array.au3"
#include"Pst.au3"
#include<File.au3>
#include <ProgressConstants.au3>
#include"ReduceMemory.au3"
#include <_LargeFileCopy.au3>
#include "RecFileListToArray.au3"
#include "ExtMsgBox.au3"
#include "Marquee.au3"
#include "AD.au3"
Opt('TrayAutoPause', 0)
Opt('MustDeclareVars', 1)
Global $DocER = 0
Global $Docsel = 0
Global $ConSel = False
Global $RMD = 0, $RD = 0, $RF = 0 , $RA = 0, $RO = 0, $RP = 0, $RU = 0, $RC = 0, $RAll = 0, $RUAll = 0
Global $MDP, $MDL,$DP,$DL,$FP,$FL,$AP,$AL,$CP,$CL,$OP,$OL,$PP,$PL,$UP,$UL,$ODP,$ODL,$ODCL,$ODCP,$TP,$TL,$OFP,$OFL,$OAP,$OAL,$OCP,$OCL,$OOP,$OOL,$OPP,$OPL,$OUP,$OUL
Global $tri = 0, $Retry
Global $compname = @ComputerName
Global $SR, $sFQDN, $ReplaceListof, $Subcheck, $MDL, $MDP
Global $Err_msg = _WinAPI_GetLastErrorMessage()
FileInstall("C:\Users\Q03200\Desktop\tick.jpg", @DesktopDir & "\tick.jpg", 1)
FileInstall("C:\Users\Q03200\Desktop\error.jpg", @DesktopDir & "\error.jpg", 1)
FileInstall("C:\Users\Q03200\Desktop\info.jpg", @DesktopDir & "\info.jpg", 1)
HotKeySet("{F1}", "about")
FileInstall("C:\Users\Q03200\Desktop\Location.xml", @DesktopDir & "\Location.xml", 1)
Global $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
Global $hItem, $hTreeView
Global $Copy = False
Global $TickFile = @DesktopDir & "\tick.jpg"
Global $ErrorFile = @DesktopDir & "\error.jpg"
Global $info = @DesktopDir & "\info.jpg"
Global $GetpathArray[1], $AddingValue
Global $About, $Aboutitem, $check, $ret
Global $BaseGUI, $Sourcedrive, $ErrorLabel, $DrivePath, $DestDrive, $DestPath, $aArray, $OS, $OSver, $i, $s, $processviewer, $DESK, $FAV, $OFF, $AVA, $CRYPTO, $PSTS, $Others
Global $StartButton, $CancelButton, $msg, $users, $prog, $m, $numberOfChannels, $file, $pst, $hGIF, $Comment, $State, $data, $Destfav, $Sourcefav, $Desktop, $Favorites
Global $DocsAr, $mds, $Sourcedocs, $Destdocs, $SourceTrans, $Trans, $DestTrans, $Mydocs, $Transfer, $iMemo, $Label, $Appdata, $AVAya, $Docs, $md, $SourceDesk, $DestDesk, $mf, $mo
Global $ma, $mc, $mt, $t, $te, $split, $subtime = 0
Global $Title = "Data Copying Utility"
Global $aTSR = _GetTotalScreenResolution()
Global $Log = @ProgramFilesDir & "\Enterprise Desktop\Logs\DRU.log"
Global $iProgress_1
;Global $filedest = "C:\Temp\waitAnimated.gif"
Global $Net = 0
Global $DRI = 0, $DER = 0
Global $Unckec, $usersel, $hMarquee, $hMarquee1, $sRoot, $GetHandle, $FindPath, $Top, $Dummy, $DelDummy, $DelDummyText, $Listof, $Adding, $hTvParent, $hSibling, $hWndFrom, $fDblClk
Global $Desktop, $TransDest, $Transource, $TransPercent, $join
;FileInstall("C:\Users\Q03200\Desktop\waitAnimated.gif", $filedest, 1)



Local $Excryp = BitLock(@ComputerName)

If $Excryp[2] = "ENCRYPTION IN PROGRESS" Then
MsgBox(48, "Warning", "Destination Drive is in Encryption. Please wait until the excryption to complete")
Exit
ElseIf $Excryp[2] = "DECRYPTION IN PROGRESS" Then
MsgBox(48, "Warning", "Destination Drive is in Decryption. Please wait until the decryption to complete")
Exit
EndIf


$BaseGUI = GUICreate($Title, 750, 570, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_GROUP, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
GUISetBkColor(0xFAFAFA)
$Sourcedrive = GUICtrlCreateLabel("Select the Source Drive", 10, 10, 120, 40)
$ErrorLabel = GUICtrlCreateLabel("", 10, 490, 600, 40)
GUICtrlSetState(-1, $GUI_HIDE)
$DrivePath = GUICtrlCreateCombo("C:", 135, 5, 60, 50, $CBS_DROPDOWNLIST)
$DestDrive = GUICtrlCreateLabel("Data Destination Location", 230, 10, 200, 40)
$DestPath = GUICtrlCreateInput("C:", 370, 5, 60, 20)
GUICtrlSetState(-1, $GUI_DISABLE)
$aArray = DriveGetDrive("ALL")
$OS = GUICtrlCreateLabel("Select Source OS", 475, 10, 100, 40)
$OSver = GUICtrlCreateCombo("Win 7-64 Bit", 570, 5, 110, 50, $CBS_DROPDOWNLIST)
GUICtrlSetData($OSver, "Win 7-32 Bit")
GUICtrlSetData($OSver, StringUpper("XP"))
If @error Then
; An error occurred when retrieving the drives.
MsgBox(16, $Title & "DriveGetDrive", "Error occured while trying to fetch the drive details.")
Exit
Else
For $i = 1 To $aArray[0] ; Show all the drives found and convert the drive letter to uppercase.
If $aArray[$i] <> "C:" Then
GUICtrlSetData($DrivePath, StringUpper($aArray[$i]))
EndIf
Next
EndIf



$processviewer = GUICtrlCreateGroup("Restore Options", 10, 40, 330, 340)
$Mydocs = GUICtrlCreateCheckbox("My Documents", 160, 70, 100, 40)
$Transfer = GUICtrlCreateCheckbox("All", 30, 70, 100, 40)
$Unckec = GUICtrlCreateCheckbox("UnCheck All", 30, 60, 100, 40)
GUICtrlSetState(-1, $GUI_HIDE)
$DESK = GUICtrlCreateCheckbox("Desktop", 30, 120, 100, 40)
$FAV = GUICtrlCreateCheckbox("Favorites", 30, 170, 100, 40)
$OFF = GUICtrlCreateCheckbox("Office Settings", 30, 220, 100, 40)
$AVA = GUICtrlCreateCheckbox("Avaya", 160, 120, 100, 40)
$CRYPTO = GUICtrlCreateCheckbox("Crypto Soft Token", 160, 170, 120, 40)
$PSTS = GUICtrlCreateCheckbox("PST Files", 160, 220, 100, 40)
$usersel = GUICtrlCreateCheckbox("User Selection", 30, 270, 100, 40)
$StartButton = GUICtrlCreateButton("Restore", 15, 390, 60, 40)
$CancelButton = GUICtrlCreateButton("Exit", 200, 390, 60, 40)
$processviewer = GUICtrlCreateGroup("", 360, 40, 370, 340)
GUICtrlSetData($processviewer, "User Selection")
$Retry = GUICtrlCreateButton("Retry",590, 490, 150, 60)
GUICtrlSetState(-1,$GUI_HIDE)



;option()
;GUIDelete($hGui)

$iProgress_1 = GUICtrlCreateProgress(370, 500, 240, 20, $PBS_MARQUEE)
GUICtrlSetState($iProgress_1, $GUI_HIDE)
$Label = GUICtrlCreateLabel("", 370, 430, 200, 40)
$hMarquee = _GUICtrlMarquee_Create("Contact " & '"' & "sikaleel87@gmail.com" & '" for any suggestion/issues...', 10, 510, 300, 20)
GUICtrlSetState(-1, $GUI_HIDE)
$hMarquee1 = _GUICtrlMarquee_Create("Contact " & '"' & "sikaleel87@gmail.com" & '" for any suggestion/issues...', 10, 510, 300, 20)
GUICtrlSetState(-1, $GUI_HIDE)
;_ProgressSetText($iProgress_1, "Checking...")
;_ProgressMarquee($iProgress_1, 2, 0)

_AD_Open()
Global $sFQDN = _AD_SamAccountNameToFQDN($compname & "$")
If Not @error Then
If StringInStr($sFQDN, "OU=NorthAmerica") Then
$SR = "NA"
EndIf
ElseIf @error = 1 Then
_FileWriteLog($Log, "Extended Error" & @error & ">>" & "No record returned from Active Directory")
Else
_FileWriteLog($Log, "Extended Error" & @error)
EndIf
_AD_Close()


GUISetState()
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
_FileWriteLog($Log, "DRU>INFO>Launch>Tool Launched!")


While 1

$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Or $msg = $CancelButton Then

FileDelete(@DesktopDir & "\Location.xml")
FileDelete(@DesktopDir & "\tick.jpg")
FileDelete(@DesktopDir & "\error.jpg")
FileDelete(@DesktopDir & "\info.jpg")
_GUICtrlTreeView_Destroy($hTreeView)
_GUICtrlRichEdit_Destroy($iMemo)
_FileWriteLog($Log, "DRU>INFO>Exit>User Selected Exit option. Tool closed successfully!")
Exit
EndIf
If $msg = $GUI_EVENT_PRIMARYDOWN Then
Local $tMPos = _WinAPI_GetMousePos(True, $hTreeView)
Local $tHitTest = _GUICtrlTreeView_HitTestEx($hTreeView, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
Local $iFlags = DllStructGetData($tHitTest, "Flags")
Select
Case BitAND($iFlags, $TVHT_ONITEMSTATEICON)
Local $hItem = _GUICtrlTreeView_HitTestItem($hTreeView, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
Local $fChecked = False
If _GUICtrlTreeView_GetChecked($hTreeView, $hItem) Then $fChecked = True
$ConSel = True
_TvCheckbox($hItem, $fChecked)

; EndSelect
Case BitAND($iFlags, $TVHT_ONITEMBUTTON)
Local $hItem = _GUICtrlTreeView_HitTestItem($hTreeView, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
$sRoot = GUICtrlRead($DrivePath)
$GetHandle = _GUICtrlTreeView_GetItemHandle($hTreeView, $hItem)
$FindPath = StringReplace(_GUICtrlTreeView_GetTree($hTreeView, $hItem), "|", "\")
If BitAND(_GUICtrlTreeView_GetState($hTreeView, $hItem), $TVIS_EXPANDED) <> 0 Then
Addchild($hItem, $FindPath)
Else
_GUICtrlTreeView_DeleteChildren($hTreeView, $hItem)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, "")
EndIf

Local $hItem = _GUICtrlTreeView_HitTestItem($hTreeView, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
Local $fChecked = False
If _GUICtrlTreeView_GetChecked($hTreeView, $hItem) Then $fChecked = True
_TvCheckbox($hItem, $fChecked)


EndSelect
EndIf

If $msg = $DrivePath Then
If DriveGetType(GUICtrlRead($DrivePath)) = "Fixed" Then
_GUICtrlTreeView_Destroy($hTreeView)
profilebox()
Else
GUICtrlSetData($ErrorLabel, "Source drive can not be a Network/Optical drive!")
GUICtrlSetColor($ErrorLabel, 0xff0000)
GUICtrlSetState($ErrorLabel, $GUI_SHOW)
_FileWriteLog($Log, "DRU>Warning>Source Drive Status>User Selected Network/Optical drive - !" & GUICtrlRead($DrivePath))
EndIf
EndIf



If $msg = $Transfer Then
$RAll = 1
GUICtrlSetState($Transfer, $GUI_UNCHECKED)
GUICtrlSetState($Transfer, $GUI_HIDE)
GUICtrlSetState($Unckec, $GUI_SHOW)
GUICtrlSetState($Mydocs, $GUI_CHECKED)
GUICtrlSetState($DESK, $GUI_CHECKED)
GUICtrlSetState($FAV, $GUI_CHECKED)
GUICtrlSetState($AVA, $GUI_CHECKED)
GUICtrlSetState($CRYPTO, $GUI_CHECKED)
GUICtrlSetState($PSTS, $GUI_CHECKED)
GUICtrlSetState($OFF, $GUI_CHECKED)
Else
$RAll = 0
EndIf

If $msg = $Unckec Then
$RUAll = 1
GUICtrlSetState($Unckec, $GUI_UNCHECKED)
GUICtrlSetState($Unckec, $GUI_HIDE)
GUICtrlSetState($Transfer, $GUI_SHOW)
GUICtrlSetState($Mydocs, $GUI_UNCHECKED)
GUICtrlSetState($DESK, $GUI_UNCHECKED)
GUICtrlSetState($FAV, $GUI_UNCHECKED)
GUICtrlSetState($AVA, $GUI_UNCHECKED)
GUICtrlSetState($CRYPTO, $GUI_UNCHECKED)
GUICtrlSetState($PSTS, $GUI_UNCHECKED)
GUICtrlSetState($OFF, $GUI_UNCHECKED)
Else
$RUAll = 0
EndIf

If $msg = $Retry Then
retry()

_GUICtrlRichEdit_Destroy($iMemo)
$iMemo = _GUICtrlRichEdit_Create($BaseGUI, "******************************************************************************" & @CRLF, 370, 70, 340, 300, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_READONLY)
_GUICtrlRichEdit_WriteLine($iMemo, "Restoring Data" & @CRLF, "", "", 0x000000)
_GUICtrlRichEdit_WriteLine($iMemo, "******************************************************************************" & @CRLF, "", "", 0x000000)
GUICtrlSetState($Transfer, $GUI_ENABLE)
GUICtrlSetState($Unckec, $GUI_ENABLE)
GUICtrlSetState($Mydocs, $GUI_ENABLE)
GUICtrlSetState($DESK, $GUI_ENABLE)
GUICtrlSetState($FAV, $GUI_ENABLE)
GUICtrlSetState($AVA, $GUI_ENABLE)
GUICtrlSetState($CRYPTO, $GUI_ENABLE)
GUICtrlSetState($PSTS, $GUI_ENABLE)
GUICtrlSetState($OFF, $GUI_ENABLE)
EndIf

If $msg = $StartButton Then
process()
;GUICtrlSetState($iProgress_1, $GUI_SHOW)
If $check = 1 Then
_GUICtrlRichEdit_WriteLine($iMemo, "Task has been completed! " & @CRLF, "", "", 0x008000)
GUICtrlSetState($iProgress_1, $GUI_HIDE)
out()
GUISetState(@SW_SHOWNORMAL, $BaseGUI)
GUICtrlSetState($StartButton, $GUI_HIDE)
; WinFlash($Title)
If $SR = "NA" Then
GUICtrlSetState($hMarquee1, $GUI_SHOW)
Else
GUICtrlSetState($hMarquee, $GUI_SHOW)
EndIf
GUICtrlSetState($CancelButton, $GUI_HIDE)
GUICtrlSetState($Retry, $GUI_SHOW)
ElseIf $check = -1 Then
GUICtrlSetState($iProgress_1, $GUI_HIDE)
GUICtrlSetState($hMarquee, $GUI_HIDE)
EndIf
EndIf

WEnd

Func retry()
GUICtrlSetState($Retry,$GUI_HIDE)
GUICtrlSetState($hMarquee1,$GUI_HIDE)
GUICtrlSetState($hMarquee, $GUI_HIDE)
GUICtrlSetState($ODP, $GUI_HIDE)
GUICtrlSetState($ODL, $GUI_HIDE)
GUICtrlSetState($ODCP, $GUI_HIDE)
GUICtrlSetState($ODCL, $GUI_HIDE)
GUICtrlSetState($OFP, $GUI_HIDE)
GUICtrlSetState($OFL, $GUI_HIDE)
GUICtrlSetState($OAP, $GUI_HIDE)
GUICtrlSetState($OAL, $GUI_HIDE)
GUICtrlSetState($OCP, $GUI_HIDE)
GUICtrlSetState($OCL, $GUI_HIDE)
GUICtrlSetState($OOP, $GUI_HIDE)
GUICtrlSetState($OOL, $GUI_HIDE)
GUICtrlSetState($OPP, $GUI_HIDE)
GUICtrlSetState($OPL, $GUI_HIDE)
GUICtrlSetState($OUP, $GUI_HIDE)
GUICtrlSetState($OUL, $GUI_HIDE)
GUICtrlSetState($TP, $GUI_HIDE)
GUICtrlSetState($TL, $GUI_HIDE)
$Mydocs = GUICtrlCreateCheckbox("My Documents", 160, 70, 100, 40)
If $RMD = 1 Then
GUICtrlSetState($Mydocs,$GUI_CHECKED)
EndIf
$Transfer = GUICtrlCreateCheckbox("All", 30, 70, 100, 40)
If $RAll = 1 Then
GUICtrlSetState($MDP,$GUI_HIDE)
GUICtrlSetState($MDL,$GUI_HIDE)
GUICtrlSetState($DP,$GUI_HIDE)
GUICtrlSetState($DL,$GUI_HIDE)
GUICtrlSetState($FP,$GUI_HIDE)
GUICtrlSetState($FL,$GUI_HIDE)
GUICtrlSetState($AP,$GUI_HIDE)
GUICtrlSetState($AL,$GUI_HIDE)
GUICtrlSetState($CP,$GUI_HIDE)
GUICtrlSetState($CL,$GUI_HIDE)
GUICtrlSetState($OP,$GUI_HIDE)
GUICtrlSetState($OL,$GUI_HIDE)
GUICtrlSetState($PP,$GUI_HIDE)
GUICtrlSetState($PL,$GUI_HIDE)
GUICtrlSetState($UP,$GUI_HIDE)
GUICtrlSetState($UL,$GUI_HIDE)
GUICtrlSetState($Transfer, $GUI_UNCHECKED)
GUICtrlSetState($Transfer, $GUI_HIDE)
GUICtrlSetState($Unckec, $GUI_SHOW)
GUICtrlSetState($Mydocs, $GUI_CHECKED)
GUICtrlSetState($DESK, $GUI_CHECKED)
GUICtrlSetState($FAV, $GUI_CHECKED)
GUICtrlSetState($AVA, $GUI_CHECKED)
GUICtrlSetState($CRYPTO, $GUI_CHECKED)
GUICtrlSetState($PSTS, $GUI_CHECKED)
GUICtrlSetState($OFF, $GUI_CHECKED)
EndIf
$Unckec = GUICtrlCreateCheckbox("UnCheck All", 30, 60, 100, 40)
GUICtrlSetState(-1, $GUI_HIDE)
$DESK = GUICtrlCreateCheckbox("Desktop", 30, 120, 100, 40)
If $RD = 1 Then
GUICtrlSetState($DESK,$GUI_CHECKED)
EndIf
$FAV = GUICtrlCreateCheckbox("Favorites", 30, 170, 100, 40)
If $RF = 1 Then
GUICtrlSetState($FAV,$GUI_CHECKED)
EndIf
$OFF = GUICtrlCreateCheckbox("Office Settings", 30, 220, 100, 40)
If $RO = 1 Then
GUICtrlSetState($OFF,$GUI_CHECKED)
EndIf
$AVA = GUICtrlCreateCheckbox("Avaya", 160, 120, 100, 40)
If $RA = 1 Then
GUICtrlSetState($AVA,$GUI_CHECKED)
EndIf
$CRYPTO = GUICtrlCreateCheckbox("Crypto Soft Token", 160, 170, 120, 40)
If $RC = 1 Then
GUICtrlSetState($CRYPTO,$GUI_CHECKED)
EndIf
$PSTS = GUICtrlCreateCheckbox("PST Files", 160, 220, 100, 40)
If $RP = 1 Then
GUICtrlSetState($PSTS,$GUI_CHECKED)
EndIf
$usersel = GUICtrlCreateCheckbox("User Selection", 30, 270, 100, 40)
$StartButton = GUICtrlCreateButton("Restore", 15, 390, 60, 40)
$CancelButton = GUICtrlCreateButton("Exit", 200, 390, 60, 40)
$processviewer = GUICtrlCreateGroup("", 360, 40, 370, 340)
GUICtrlSetData($processviewer, "User Selection")
$Retry = GUICtrlCreateButton("Retry",590, 490, 150, 60)
GUICtrlSetState(-1,$GUI_HIDE)
EndFunc



Func out()
GUICtrlSetState($DrivePath, $GUI_DISABLE)
GUICtrlSetState($DestPath, $GUI_DISABLE)
GUICtrlSetState($Unckec, $GUI_DISABLE)
GUICtrlSetState($OSver, $GUI_DISABLE)
If GUICtrlRead($Mydocs) <> 1 Then
GUICtrlSetState($Mydocs,$GUI_HIDE)
$ODP = GUICtrlCreatePic($info, 160, 70, 16, 16)
$ODL = GUICtrlCreateLabel("My Documents", 180, 70, 100, 30)
EndIf

If GUICtrlRead($Transfer) <> 1 Then
GUICtrlSetState($Transfer,$GUI_HIDE)
$TP = GUICtrlCreatePic($info, 30, 70, 16, 16)
$TL = GUICtrlCreateLabel("All", 50, 70, 100, 40)
EndIf

If GUICtrlRead($DESK) <> 1  Then
GUICtrlSetState($DESK,$GUI_HIDE)
$ODCP = GUICtrlCreatePic($info, 30, 120, 16, 16)
$ODCL = GUICtrlCreateLabel("Desktop", 50, 120, 100, 40)
EndIf

If GUICtrlRead($FAV) <> 1 Then
GUICtrlSetState($FAV,$GUI_HIDE)
$OFP = GUICtrlCreatePic($info, 30, 170, 16, 16)
$OFL = GUICtrlCreateLabel("Favorites", 50, 170, 100, 30)
EndIf

If GUICtrlRead($OFF) <> 1 Then
GUICtrlSetState($OFF,$GUI_HIDE)
$OOP =  GUICtrlCreatePic($info, 30, 220, 16, 16)
$OOL= GUICtrlCreateLabel("Office Settings", 50, 220, 100, 30)
EndIf

If GUICtrlRead($AVA) <> 1 Then
GUICtrlSetState($AVA, $GUI_HIDE)
$OAP = GUICtrlCreatePic($info, 160, 120, 16, 16)
$OAL = GUICtrlCreateLabel("Avaya", 180, 120, 100, 30)
EndIf

If GUICtrlRead($CRYPTO) <> 1 Then
GUICtrlSetState($CRYPTO, $GUI_HIDE)
$OCP = GUICtrlCreatePic($info, 160, 170, 16, 16)
$OCL = GUICtrlCreateLabel("Crypto Soft Token", 180, 170, 100, 30)
EndIf

If GUICtrlRead($PSTS) <> 1 Then
GUICtrlSetState($PSTS, $GUI_HIDE)
$OPP = GUICtrlCreatePic($info, 160, 220, 16, 16)
$OPL = GUICtrlCreateLabel("PST Files", 180, 220, 100, 30)
EndIf

If GUICtrlRead($usersel) <> 1  Then
GUICtrlSetState($usersel, $GUI_HIDE)
$OUP = GUICtrlCreatePic($info, 30, 270, 16, 16)
$OUL = GUICtrlCreateLabel("User Selection", 50, 270, 100, 30)
EndIf
EndFunc   ;==>out

Func profilebox()
GUICtrlSetData($ErrorLabel, "")
$hTreeView = _GUICtrlTreeView_Create($BaseGUI, 370, 70, 340, 300, $iStyle, $WS_EX_CLIENTEDGE)
$Top = _GUICtrlTreeView_Add($hTreeView, 0, GUICtrlRead($DrivePath))
$Dummy = _GUICtrlTreeView_AddChild($hTreeView, $Top, "")
EndFunc   ;==>profilebox

Func Addchild($hItem, $FindPath)
If StringRight($FindPath, 1) <> "\" Then
$FindPath &= "\"
EndIf
$DelDummy = _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem)
$DelDummyText = _GUICtrlTreeView_GetText($hTreeView, $DelDummy)
If $DelDummyText = "" Then
_GUICtrlTreeView_Delete($hTreeView, $DelDummy)
EndIf

$Listof = _RecFileListToArray($FindPath, "*")

If IsArray($Listof) Then
For $i = 1 To $Listof[0]
$ReplaceListof = StringReplace($Listof[$i], "\", "")
$Adding = _GUICtrlTreeView_AddChild($hTreeView, $hItem, $ReplaceListof)
$Subcheck = _RecFileListToArray($FindPath & $Listof[$i], "*")
If StringInStr(FileGetAttrib($FindPath & $Listof[$i]), "D", "") <> 0 And $Subcheck <> "" Then
_GUICtrlTreeView_AddChild($hTreeView, $Adding, "")
EndIf
Next
Else
$Adding = _GUICtrlTreeView_AddChild($hTreeView, $FindPath, $Listof)
EndIf

EndFunc   ;==>Addchild

Func process()

_FileWriteLog($Log, "DRU>INFO>Process>User Selected Process option")
_check()
If $ret >= 1 Then
If GUICtrlRead($OSver) = "XP" Then
;Foldexist function defined on PST.au3
If Foldexist(GUICtrlRead($DrivePath) & "\Drivers") = True Then
$users = "\Documents and Settings\"
$prog = "\Program Files\"
$Appdata = "\Documents and Settings\" & @UserName & "\Application Data\Microsoft\"
$AVAya = "\Documents and Settings\" & @UserName & "\Application Data\Avaya\"
$Docs = "\Documents and Settings\" & @UserName & "\My Documents"
$check = 1
Else
MsgBox(48, "OS MisMatch!", "Operating System has been selected wrongly. Please select the appropriate one!")
EndIf
ElseIf GUICtrlRead($OSver) = "Win 7-64 Bit" Then

If Foldexist(GUICtrlRead($DrivePath) & "\Program Files (x86)") = True Then
$users = "\Users\"
$prog = "\Program Files (x86)\"
$Appdata = "\Users\" & @UserName & "\AppData\Roaming\Microsoft\"
$AVAya = "\Users\" & @UserName & "\AppData\Roaming\Avaya\"
$Docs = "\Users\" & @UserName & "\Documents"
$check = 1
Else
MsgBox(48, "OS MisMatch!", "Operating System has been selected wrongly. Please select the appropriate one!")

EndIf

ElseIf GUICtrlRead($OSver) = "Win 7-32 Bit" Then
If Foldexist(GUICtrlRead($DrivePath) & "\Program Files (x86)") = False And Foldexist(GUICtrlRead($DrivePath) & "\users") = True Then
$users = "\Users\"
$prog = "\Program Files\"
$Appdata = "\Users\" & @UserName & "\AppData\Roaming\Microsoft\"
$AVAya = "\Users\" & @UserName & "\AppData\Roaming\Avaya\"
$Docs = "\Users\" & @UserName & "\Documents"
$check = 1
Else
MsgBox(48, "OS MisMatch!", "Operating System has been selected wrongly. Please select the appropriate one!")
EndIf
EndIf

EndIf
If $check = 1 Then
If ProcessExists("outlook.exe") Then
Do
_ExtMsgBoxSet(2, 0, -1, -1, 9, "Arial")
_ExtMsgBox($MB_ICONEXCLAM, "OK", $Title, "Microsoft Outlook is in Use. Please close Outlook and then click OK to Continue the copying process.")
_ExtMsgBoxSet(Default)
; MsgBox(48, "Open Application", "Outlook is running on this machine. In order restore data now the tool will close the outlook.")
; ;ProcessClose("outlook.exe")
; ;_FileWriteLog($Log, "DRU>Outlook process>PST>Outlook was running on this machine and killed the outlook")
Until ProcessExists("outlook.exe") = 0
EndIf
GUICtrlSetData($ErrorLabel, "")
_GUICtrlTreeView_Destroy($hTreeView)
GUICtrlSetData($processviewer, "Result Viewer")
$iMemo = _GUICtrlRichEdit_Create($BaseGUI, "******************************************************************************" & @CRLF, 370, 70, 340, 300, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_READONLY)
_GUICtrlRichEdit_WriteLine($iMemo, "Restoring Data" & @CRLF, "", "", 0x000000)
_GUICtrlRichEdit_WriteLine($iMemo, "******************************************************************************" & @CRLF, "", "", 0x000000)
GUICtrlSetState($iProgress_1, $GUI_SHOW)
GUICtrlSendMsg($iProgress_1, $PBM_SETMARQUEE, True, 50)
GUICtrlSetState($Unckec,$GUI_DISABLE)

If GUICtrlRead($Mydocs) = "1" Then
$RMD = 1
_GUICtrlRichEdit_WriteLine($iMemo, "Started copying MY Documents folder " & @CRLF, "", "", 0xFE2EF7)
$DocsAr = _RecFileListToArray(GUICtrlRead($DrivePath) & $Docs & "\", "*", 0, 1, 1)

If IsArray($DocsAr) Then

_GUICtrlRichEdit_WriteLine($iMemo, UBound($DocsAr) & " Files to be copied. Please wait... " & @CRLF, "", "", 0xFE2EF7)


For $i = 0 To UBound($DocsAr) - 1
$t = 0
$te = 0
_FileWriteLog($Log, "DRU>INFO>DOCS>Source location>" & GUICtrlRead($DrivePath) & $Docs & "\" & $DocsAr[$i])
_FileWriteLog($Log, "DRU>INFO>DOCS>Destination location>" & "C:\Users\" & @UserName & "\Documents" & "\" & $DocsAr[$i])
; If StringInStr($DocsAr[$i], ".") <> 0 Then
$t = TimerInit()
$mds = _LargeFileCopy(GUICtrlRead($DrivePath) & $Docs & "\" & $DocsAr[$i], "C:\Users\" & @UserName & "\Documents" & "\" & $DocsAr[$i], BitOR(1, 2, 8))
$te = TimerDiff($t)
If $mds = 1 Then
_FileWriteLog($Log, "DRU>INFO>DESKTOP - File Copy> copied the file - " & $DocsAr[$i])
$subtime = $subtime + ($te / 1000)
$DRI = $DRI + 1
ElseIf $mds <> 1 Then
_FileWriteLog($Log, "DRU>ERROR>DESKTOP - File Copy>Failed to copy the file - >" & $DocsAr[$i] & " Error value = " & @error)
If @error = 1 Then
_FileWriteLog($Log, "DRU>WARNING>DESKTOP - File Copy>Failed to copy the file - >Failed to open source file, or source was a directory")
ElseIf @error = 2 Then
_FileWriteLog($Log, "DRU>WARNING>DESKTOP - File Copy>Failed to copy the file - >Destination file exists and overwrite flag not set")
ElseIf @error = 3 Then
_FileWriteLog($Log, "DRU>WARNING>DESKTOP - File Copy>Failed to copy the file - >Failed to create destination file")
$DER = $DER + 1
ElseIf @error = 4 Then
_FileWriteLog($Log, "DRU>WARNING>DESKTOP - File Copy>Failed to copy the file - >Read error during copy")
$DER = $DER + 1
ElseIf @error = 5 Then
_FileWriteLog($Log, "DRU>WARNING>DESKTOP - File Copy>Failed to copy the file - >Write error during copy")
$DER = $DER + 1
ElseIf @error = 6 Then
_FileWriteLog($Log, "DRU>WARNING>DESKTOP - File Copy>Failed to copy the file - >Verify failed")
$DER = $DER + 1
EndIf
EndIf

; Else
; _FileWriteLog($Log, "DRU>INFO>MY Docs>" & "Not in to the copy loop" & $DocsAr[$i])
; EndIf
Next
GUICtrlSetState($Mydocs, $GUI_HIDE)
If GUICtrlRead($OSver) <> "XP" Then
$Sourcedocs = DirGetSize(GUICtrlRead($DrivePath) & $Docs)
$Destdocs = DirGetSize("C:\Users\" & @UserName & "\Documents")
Else
$Sourcedocs = DirGetSize(GUICtrlRead($DrivePath) & $Docs)
$Destdocs = DirGetSize("C:\Users\" & @UserName & "\Documents") + DirGetSize("C:\Users\" & @UserName & "\Music") + DirGetSize("C:\Users\" & @UserName & "\Videos") + DirGetSize("C:\Users\" & @UserName & "\Pictures")
EndIf

If Round($Destdocs / 1024 / 1024) = Round($Sourcedocs / 1024 / 1024) Then
_GUICtrlRichEdit_WriteLine($iMemo, "Documents Folder copied successfully - " & $subtime& " minutes." &@CRLF, "", "", 0x008000)
_FileWriteLog($Log, "DRU>INFO>DOCS>Documents folder copied successfully!")
$MDP = GUICtrlCreatePic($TickFile, 160, 70, 16, 16)
$MDL = GUICtrlCreateLabel("My Documents", 180, 70, 100, 30)
;MsgBox(0,"SIZE","Destination Size = " & Round($Destdocs / 1024 / 1024) &@CRLF&@CRLF&@CRLF&@CRLF& "Source Size = "& Round($Sourcedocs / 1024 / 1024))
; ElseIf $DER >= 1 Then
; _GUICtrlRichEdit_WriteLine($iMemo, "Some Files are not copied properly. Please copy it manually " & @CRLF, "", "", 0xCDA30C)
; _FileWriteLog($Log, "DRU>INFO>DOCS>Some files are not copied properly!")
ElseIf Round($Destdocs / 1024 / 1024) <> Round($Sourcedocs / 1024 / 1024) Then
$MDP = GUICtrlCreatePic($ErrorFile, 160, 70, 16, 16)
$MDL = GUICtrlCreateLabel("My Documents", 180, 70, 100, 30)
_GUICtrlRichEdit_WriteLine($iMemo, "Some Files are not copied properly. Please copy it manually! Also please send the log file to the tool Admin" & @CRLF, "", "", 0xFF0000)
_FileWriteLog($Log, "DRU>Error>DOCS>unable to copy MY Documents folder. Source Size = " & Round($Sourcedocs / 1024 / 1024) & ". Destination size = " & Round($Destdocs / 1024 / 1024) & ". Value of DER = " & $DER)
;MsgBox(0, "SIZE", "Destination Size = " & Round($Destdocs / 1024 / 1024) & @CRLF & @CRLF & @CRLF & @CRLF & "Source Size = " & Round($Sourcedocs / 1024 / 1024))

EndIf


Else
GUICtrlSetState($Mydocs, $GUI_HIDE)
GUICtrlCreatePic($TickFile, 160, 70, 16, 16)
GUICtrlCreateLabel("My Documents", 180, 70, 100, 30)
_GUICtrlRichEdit_WriteLine($iMemo, UBound($DocsAr) & " Files to be copied!" & @CRLF, "", "", 0x2E2EFE)
_FileWriteLog($Log, "DRU>Error>DOCS>Variable Documents does not return array value")

EndIf
$DER = 0
$DRI = 0
$subtime = 0
Else
$RMD = 0
_FileWriteLog($Log, "DRU>INFO>DOCS> My Documents is not selected  -->" & GUICtrlRead($Mydocs))
EndIf

If GUICtrlRead($DESK) = "1" Then
$RD = 1
_GUICtrlRichEdit_WriteLine($iMemo, "Started copying Desktop folder " & @CRLF, "", "", 0xFE2EF7)
; $Dessel = 1
$Desktop = _RecFileListToArray(GUICtrlRead($DrivePath) & $users & @UserName & "\Desktop" & "\", "*", 0, 1, 1)
If IsArray($Desktop) Then
_GUICtrlRichEdit_WriteLine($iMemo, UBound($Desktop) & " Files to be copied. Please wait... " & @CRLF, "", "", 0xFE2EF7)
;$md = DirCopy(GUICtrlRead($DrivePath) & $users & @UserName & $Comment[1], "C:\users\" & @UserName & $Comment[1], 1)
For $i = 0 To UBound($Desktop) - 1
_FileWriteLog($Log, "DRU>INFO>DESKTOP>Source location>" & GUICtrlRead($DrivePath) & $users & @UserName & "\Desktop\" & $Desktop[$i])
_FileWriteLog($Log, "DRU>INFO>DESKTOP>Destination location>" & @DesktopDir & "\" & $Desktop[$i])
; If StringInStr($Desktop[$i], ".") <> 0 Then
$md = _LargeFileCopy(GUICtrlRead($DrivePath) & $users & @UserName & "\Desktop\" & $Desktop[$i], @DesktopDir & "\" & $Desktop[$i], BitOR(1, 2, 8))

If $md = 1 Then
_FileWriteLog($Log, "DRU>INFO>DESKTOP - File Copy> copied the file - " & $Desktop[$i])
$DRI = $DRI + 1
ElseIf $md <> 1 Then
_FileWriteLog($Log, "DRU>ERROR>DESKTOP - File Copy>Failed to copy the file - >" & $Desktop[$i] & " Error value = " & @error)
$DER = $DER + 1
EndIf
; Else
; _FileWriteLog($Log, "DRU>INFO>Desktop>" & "Not in to the copy loop" & $Desktop[$i])
; EndIf
Next
GUICtrlSetState($DESK, $GUI_HIDE)
$SourceDesk = DirGetSize(GUICtrlRead($DrivePath) & $users & @UserName & "\Desktop")
$DestDesk = DirGetSize(@DesktopDir)
If Round($DestDesk / 1024 / 1024) = Round($SourceDesk / 1024 / 1024) Then
_GUICtrlRichEdit_WriteLine($iMemo, "Desktop Folder copied successfully " & @CRLF, "", "", 0x008000)
_FileWriteLog($Log, "DRU>INFO>Desktop>Desktop folder copied successfully!")
$DP = GUICtrlCreatePic($TickFile, 30, 120, 16, 16)
$DL = GUICtrlCreateLabel("Desktop", 50, 120, 100, 40)
;ElseIf $DER >= 1 Then
; _GUICtrlRichEdit_WriteLine($iMemo, "Some Files are not copied properly. Please copy it manually " & @CRLF, "", "", 0xCDA30C)
; _FileWriteLog($Log, "DRU>INFO>Desktop>Some files are not copied properly!")
ElseIf Round($DestDesk / 1024 / 1024) <> Round($SourceDesk / 1024 / 1024) Then
$DP = GUICtrlCreatePic($ErrorFile, 30, 120, 16, 16)
$DL = GUICtrlCreateLabel("Desktop", 50, 120, 100, 40)
_FileWriteLog($Log, "DRU>WARNING>Desktop>unable to copy Desktop folder. Source Desk Size = " & Round($SourceDesk / 1024 / 1024) & ". Destination size = " & Round($DestDesk / 1024 / 1024) & ". Value of DER = " & $DER)
_GUICtrlRichEdit_WriteLine($iMemo, "Some Files are not copied properly. Please copy it manually! Also please send the log file to the tool Admin" & @CRLF, "", "", 0xFF0000)
_FileWriteLog($Log, "DRU>Error>Desktop>unable to copy Desktop folder. Source Desk Size = " & Round($SourceDesk / 1024 / 1024) & ". Destination size = " & Round($DestDesk / 1024 / 1024) & ". Value of DER = " & $DER)
EndIf
Else
GUICtrlSetState($DESK, $GUI_HIDE)
$DP = GUICtrlCreatePic($TickFile, 30, 120, 16, 16)
$DL = GUICtrlCreateLabel("Desktop", 50, 120, 100, 30)
_FileWriteLog($Log, "DRU>WARNING>Desktop>Source Desk Size = " & Round($SourceDesk / 1024 / 1024) & ". Destination size = " & Round($DestDesk / 1024 / 1024) & ". Value of DER = " & $DER)
_GUICtrlRichEdit_WriteLine($iMemo, UBound($Desktop) & " Files to be copied!" & @CRLF, "", "", 0x2E2EFE)
_FileWriteLog($Log, "DRU>Error>Desktop>Variable Desktop does not return array value")
EndIf


$DER = 0
$DRI = 0
Else
$RD = 0
_FileWriteLog($Log, "DRU>INFO>DESKTOP> Desktop is not selected  -->" & GUICtrlRead($DESK))
EndIf

If GUICtrlRead($FAV) = "1" Then
$RF = 1
$Favorites = _RecFileListToArray(GUICtrlRead($DrivePath) & $users & @UserName & "\Favorites" & "\", "*", 0, 1, 1)

If IsArray($Favorites) Then
_GUICtrlRichEdit_WriteLine($iMemo, UBound($Favorites) & " links to be copied. Please wait... " & @CRLF, "", "", 0xFE2EF7)

For $i = 0 To UBound($Favorites) - 1
$t = 0
$te = 0
_FileWriteLog($Log, "DRU>INFO>FAV>Source location -  " & GUICtrlRead($DrivePath) & $users & @UserName & "\Favorites\" & $Favorites[$i])
_FileWriteLog($Log, "DRU>INFO>FAV>Destination location -  " & "C:\users\" & @UserName & "\Favorites\" & $Favorites[$i])
;$mf = DirCopy(GUICtrlRead($DrivePath) & $users & @UserName & $Comment[1], "C:\users\" & @UserName & $Comment[1], 1)
; If StringInStr($Favorites[$i], ".") <> 0 Then
$t = TimerInit()
$mf = _LargeFileCopy(GUICtrlRead($DrivePath) & $users & @UserName & "\Favorites\" & $Favorites[$i], @FavoritesDir & "\" & $Favorites[$i], BitOR(1, 2, 8))
$te = TimerDiff($t)

If $mf = 1 Then
_FileWriteLog($Log, "DRU>INFO>FAV - File Copy> copied the file - " & $Favorites[$i])
$subtime = $subtime + ($te / 1000)
$DRI = $DRI + 1

ElseIf $mf <> 1 And StringInStr($Favorites[$i], ".") <> 0 Then
_FileWriteLog($Log, "DRU>ERROR>FAV - File Copy>Failed to copy the file - >" & $Favorites[$i] & " Error value = " & $mf)
$DER = $DER + 1
EndIf
; Else
; _FileWriteLog($Log, "DRU>WARNING>Favorites>" & "Not in to the copy loop" & $Favorites[$i])
; EndIf

Next
GUICtrlSetState($FAV, $GUI_HIDE)
$Sourcefav = DirGetSize(GUICtrlRead($DrivePath) & $users & @UserName & "\Favorites")
$Destfav = DirGetSize(@FavoritesDir)
If Round($Destfav / 1024 / 1024) = Round($Sourcefav / 1024 / 1024) Then
$FP = GUICtrlCreatePic($TickFile, 30, 170, 16, 16)
$FL = GUICtrlCreateLabel("Favorites", 50, 170, 100, 30)
_GUICtrlRichEdit_WriteLine($iMemo, "Favorites Folder copied successfully in "&$subtime&" Minutes" & @CRLF, "", "", 0x008000)
_FileWriteLog($Log, "DRU>INFO>FAV>FAV folder copied successfully!")
; ElseIf $DER >= 1 Then
; _GUICtrlRichEdit_WriteLine($iMemo, "Some Files are not copied properly. Please copy it manually " & @CRLF, "", "", 0xCDA30C)
; _FileWriteLog($Log, "DRU>INFO>FAV>Some files are not copied properly!")
ElseIf Round($Destfav / 1024 / 1024) <> Round($Sourcefav / 1024 / 1024) And $DER = 0 Then
$FP = GUICtrlCreatePic($ErrorFile, 30, 180, 16, 16)
$FL = GUICtrlCreateLabel("Favorites", 50, 180, 100, 30)
_GUICtrlRichEdit_WriteLine($iMemo, "Some Files are not copied properly. Please copy it manually! Also please send the log file to the tool Admin." & @CRLF, "", "", 0xFF0000)
_FileWriteLog($Log, "DRU>Error>FAV>unable to copy FAV folder. Source Size = " & Round($Sourcefav / 1024 / 1024) & ". Destination size = " & Round($Destfav / 1024 / 1024) & ". Value of DER = " & $DER)
EndIf
Else
GUICtrlSetState($FAV, $GUI_HIDE)
$FP = GUICtrlCreatePic($TickFile, 30, 180, 16, 16)
$FL = GUICtrlCreateLabel("Favorites", 50, 180, 100, 30)
_GUICtrlRichEdit_WriteLine($iMemo, UBound($Favorites) & " Files to be copied!" & @CRLF, "", "", 0x2E2EFE)
_FileWriteLog($Log, "DRU>Error>FAV>Variable FAV does not return array value")
EndIf

$DER = 0
$DRI = 0
_FileWriteLog($Log, "DRU>INFO>Time for Copying> copied the Favorites folder in " & $subtime & " Seconds")
Else
$RF = 0
_FileWriteLog($Log, "DRU>INFO>FAV> Favorite is not selected  -->" & GUICtrlRead($FAV))
EndIf
If GUICtrlRead($OFF) = "1" Then
$RO = 1
_GUICtrlRichEdit_WriteLine($iMemo, "Started copying Office folder " & @CRLF, "", "", 0xFE2EF7)
$file = _XMLFileOpen(@DesktopDir & "\Location.xml")
$numberOfChannels = _XMLGetNodeCount("/root/off")
For $s = 1 To $numberOfChannels Step +1
$Comment = _XMLGetChildText("/root/off[" & $s & "]")
_ReduceMemory()
$mo = DirCopy(GUICtrlRead($DrivePath) & $Appdata & $Comment[1], "C:\users\" & @UserName & "\AppData\Roaming\Microsoft\" & $Comment[1], 1)
_FileWriteLog($Log, "DRU>INFO>OFF>Source location -  " & GUICtrlRead($DrivePath) & $Appdata & $Comment[1])
_FileWriteLog($Log, "DRU>INFO>OFF>Destination location -  " & "C:\users\" & @UserName & "\AppData\Roaming\Microsoft\" & $Comment[1])
GUICtrlSetState($OFF, $GUI_HIDE)
If $mo = 1 Then
_GUICtrlRichEdit_WriteLine($iMemo, "Office Folder copied successfully " & $Comment & @CRLF, "", "", 0x008000)
_FileWriteLog($Log, "DRU>INFO>OFF>Office files Folder copied successfully - " & $Comment[1])
$OP= GUICtrlCreatePic($TickFile, 30, 220, 16, 16)
$OL= GUICtrlCreateLabel("Office Settings", 50, 220, 100, 30)
Else
_GUICtrlRichEdit_WriteLine($iMemo, "Unable to copy Office folder. Error -  " & @error & $Comment & @CRLF, "", "", 0xFF0000)
_FileWriteLog($Log, "DRU>Error>OFF>unable to copy Office files folder - " & $Comment[1])
$OP = GUICtrlCreatePic($ErrorFile, 30, 220, 16, 16)
$OL = GUICtrlCreateLabel("Office Settings", 50, 220, 100, 30)
EndIf
Next
Else
$RO = 0
_FileWriteLog($Log, "DRU>INFO>OFF> Office setting is not selected  -->" & GUICtrlRead($OFF))
EndIf

If GUICtrlRead($AVA) = "1" Then
$RA = 1
_GUICtrlRichEdit_WriteLine($iMemo, "Started copying Avaya folder " & @CRLF, "", "", 0xFE2EF7)
_FileWriteLog($Log, "DRU>INFO>Avaya>Started copying the Avaya folder")
$file = _XMLFileOpen(@DesktopDir & "\Location.xml")
$numberOfChannels = _XMLGetNodeCount("/root/avaya")
For $s = 1 To $numberOfChannels Step +1
$Comment = _XMLGetChildText("/root/avaya[" & $s & "]")
_ReduceMemory()
$ma = DirCopy(GUICtrlRead($DrivePath) & $AVAya & $Comment[1], "C:\users\" & @UserName & "\AppData\Roaming\Avaya\" & $Comment[1], 1)
_FileWriteLog($Log, "DRU>INFO>Avaya>Source location -  " & GUICtrlRead($DrivePath) & $AVAya & $Comment[1])
_FileWriteLog($Log, "DRU>INFO>Avaya>Destination location -  " & "C:\users\" & @UserName & "\AppData\Roaming\Avaya\" & $Comment[1])
Next
GUICtrlSetState($AVA, $GUI_HIDE)
If $ma = 1 Then
$AP = GUICtrlCreatePic($TickFile, 160, 120, 16, 16)
$AL = GUICtrlCreateLabel("Avaya", 180, 120, 100, 30)
_GUICtrlRichEdit_WriteLine($iMemo, "Avaya Folder copied successfully " & $Comment & @CRLF, "", "", 0x008000)
_FileWriteLog($Log, "DRU>INFO>Avaya>Avaya Folder copied successfully ")
Else
$AP = GUICtrlCreatePic($ErrorFile, 160, 120, 16, 16)
$AL = GUICtrlCreateLabel("Avaya", 180, 120, 100, 30)
_GUICtrlRichEdit_WriteLine($iMemo, "Unable to copy Avaya folder. Error -  " & @error & $Comment & @CRLF, "", "", 0xFF0000)
_FileWriteLog($Log, "DRU>Error>Avaya>unable to copy Avaya folder. Error Value= " & @error)
EndIf
Else
$RA = 0
_FileWriteLog($Log, "DRU>INFO>Avaya> Avaya is not selected  -->" & GUICtrlRead($AVA))
EndIf

If GUICtrlRead($CRYPTO) = "1" Then
$RC = 1
_GUICtrlRichEdit_WriteLine($iMemo, "Started copying Crypto folder " & @CRLF, "", "", 0xFE2EF7)
_FileWriteLog($Log, "DRU>INFO>CRYPTO>Started copying the Crypto folder")
$file = _XMLFileOpen(@DesktopDir & "\Location.xml")
$numberOfChannels = _XMLGetNodeCount("/root/cryp")
For $s = 1 To $numberOfChannels Step +1
$Comment = _XMLGetChildText("/root/cryp[" & $s & "]")
_ReduceMemory()
_FileWriteLog($Log, "DRU>INFO>Crypto>Source location -  " & GUICtrlRead($DrivePath) & $prog & $Comment[1])
_FileWriteLog($Log, "DRU>INFO>Crypto>Destination location -  " & @ProgramFilesDir & "\" & $Comment[1])

$mc = DirCopy(GUICtrlRead($DrivePath) & $prog & $Comment[1], @ProgramFilesDir & "\" & $Comment[1], 1)
GUICtrlSetState($CRYPTO, $GUI_HIDE)
If $mc = 1 Then
$CP =GUICtrlCreatePic($TickFile, 160, 170, 16, 16)
$CL = GUICtrlCreateLabel("Crypto Soft Token", 180, 170, 100, 30)
_GUICtrlRichEdit_WriteLine($iMemo, "Crypto Folder copied successfully " & @CRLF, "", "", 0x008000)
_FileWriteLog($Log, "DRU>INFO>Crypto>Crypto folder copied successfully")
Else
$CP = GUICtrlCreatePic($ErrorFile, 160, 170, 16, 16)
$CL = GUICtrlCreateLabel("Crypto Soft Token", 180, 170, 100, 30)
_GUICtrlRichEdit_WriteLine($iMemo, "Unable to copy Crypto folder. Error -  " & @error & $Comment & @CRLF, "", "", 0xFF0000)
_FileWriteLog($Log, "DRU>Error>Crypto>unable to copy Crypto folder")
EndIf
Next

Else
$RC = 0
_FileWriteLog($Log, "DRU>INFO>CRYPTO> CRYPTO is not selected  -->" & GUICtrlRead($CRYPTO))
EndIf

If GUICtrlRead($PSTS) = "1" Then
$RP = 1

_GUICtrlRichEdit_WriteLine($iMemo, "Searching for PST file. Please wait.... " & @CRLF, "", "", 0x0000FF)
$pst = _RecFileListToArray(GUICtrlRead($DrivePath), "*.pst", 1, 1)
_FileWriteLog($Log, "DRU>INFO>PST>Started copying PST Files")
_GUICtrlRichEdit_WriteLine($iMemo, UBound($pst) & " PST files need to be copied! " & @CRLF, "", "", 0xFE2EF7)

If IsArray($pst) Then
For $i = 0 To UBound($pst) - 1
$t = 0
$te = 0
If StringInStr($pst[$i], ".") <> 0 Then
_FileWriteLog($Log, "DRU>INFO>PST>Source location -  " & GUICtrlRead($DrivePath) & "\" & $pst[$i])
$t = TimerInit()
; If StringInStr($pst[$i], "\Local Settings\Application Data\Microsoft\Outlook") <> 0 Or StringInStr($pst[$i], "\AppData\Local\Microsoft\Outlook") <> 0 Then
; $split = StringSplit($pst[$i], "\")
; $m = _LargeFileCopy(GUICtrlRead($DrivePath) & "\" & $pst[$i], "C:\users\" & @UserName & "\AppData\Local\Microsoft\Outlook\" & $split[UBound($split) - 1], BitOR(1, 2, 8))
; $te = TimerDiff($t)
; Else
; $t = TimerInit()
$m = _LargeFileCopy(GUICtrlRead($DrivePath) & "\" & $pst[$i], "C:\" & $pst[$i], BitOR(1, 2, 8))
$te = TimerDiff($t)
; EndIf

If $m = 1 Then
_FileWriteLog($Log, "DRU>INFO>PST - File Copy> copied the file - " & $pst[$i])
_FileWriteLog($Log, "DRU>INFO>Time for Copying> copied the file - " & $pst[$i] & " in " & $te / 1000 & " Seconds")
$DRI = $DRI + 1
ElseIf $m <> 1 And StringInStr($pst[$i], ".") <> 0 Then
_FileWriteLog($Log, "DRU>ERROR>PST - File Copy>Failed to copy the file - >" & $pst[$i] & " Error value = " & $m)
$DER = $DER + 1
EndIf
Else
_FileWriteLog($Log, "DRU>INFO>Favorites>" & "Not in to the copy loop" & $pst[$i])
EndIf
Next
Else
_FileWriteLog($Log, "DRU>Error>PST>Variable PST does not return array value")
EndIf
GUICtrlSetState($PSTS, $GUI_HIDE)
$PP = GUICtrlCreatePic($TickFile, 160, 220, 16, 16)
$PL = GUICtrlCreateLabel("PST Files", 180, 220, 100, 30)
Else
$RP = 0
_FileWriteLog($Log, "DRU>INFO>PST> PST is not selected  -->" & GUICtrlRead($PSTS))
EndIf

If GUICtrlRead($usersel) = 1 Then
$RU = 1
_GUICtrlRichEdit_WriteLine($iMemo, "Collecting User Selection details. Please wait.... " & @CRLF, "", "", 0x0000FF)
If IsArray($GetpathArray) Then
$GetpathArray = _ArrayUnique($GetpathArray)
For $ta = 0 To UBound($GetpathArray) - 1
If $GetpathArray[$ta] <> "" And GUICtrlRead($DrivePath) <> $GetpathArray[$ta] Then

$Trans = _RecFileListToArray($GetpathArray[$ta] & "\", "*", 0, 1, 1)
If IsArray($Trans) Then
_GUICtrlRichEdit_WriteLine($iMemo, UBound($Trans) & " Files to be copied. Please wait... " & @CRLF, "", "", 0xFE2EF7)
For $i = 1 To $Trans[0]
_FileWriteLog($Log, "DRU>INFO>Transfer>Source location>" & $GetpathArray[$ta] & "\" & $Trans[$i])
_FileWriteLog($Log, "DRU>INFO>Transfer>Destination location>" & "C:\" & $Trans[$i])
; If StringInStr($Desktop[$i], ".") <> 0 Then

;MsgBox(0,"",$GetpathArray[$ta] &"\"& $Trans[$i], "C" & StringTrimLeft($GetpathArray[$ta], 1) & "\" & $Trans[$i])

$md = _LargeFileCopy($GetpathArray[$ta] & "\" & $Trans[$i], "C" & StringTrimLeft($GetpathArray[$ta], 1) & "\" & $Trans[$i], BitOR(1, 2, 8))
If $md = 1 Then
_FileWriteLog($Log, "DRU>INFO>Transfer - File Copy> copied the file - " & $Trans[$i])
$DRI = $DRI + 1
ElseIf $md <> 1 Then
_FileWriteLog($Log, "DRU>ERROR>Transfer - File Copy>Failed to copy the file - >" & $Trans[$i] & " Error value = " & @error)
$DER = $DER + 1
EndIf
; Else
; _FileWriteLog($Log, "DRU>INFO>Desktop>" & "Not in to the copy loop" & $Desktop[$i])
; EndIf
Next

Else
_GUICtrlRichEdit_WriteLine($iMemo, UBound($Desktop) & " Files to be copied!" & @CRLF, "", "", 0x2E2EFE)
_FileWriteLog($Log, "DRU>Error>Transfer>Variable Desktop does not return array value")
EndIf
EndIf
Next
Else
_FileWriteLog($Log, "DRU>Error>Transfer>Variable Desktop does not return array value")
EndIf
GUICtrlSetState($usersel, $GUI_HIDE)
$UP = GUICtrlCreatePic($TickFile, 30, 270, 16, 16)
$UL = GUICtrlCreateLabel("User Selection", 50, 270, 100, 30)
Else
$RU = 0
_FileWriteLog($Log, "DRU>INFO>Profile> User Selection is not selected")
EndIf
Else
GUICtrlSetState($iProgress_1, $GUI_HIDE)
EndIf
EndFunc   ;==>process

Func _check()

If DriveGetType(GUICtrlRead($DrivePath)) <> "Fixed" And $msg = $StartButton Then
;MsgBox(48,"Source Drive Warning!","Source directory can not be a Network drive. Please select the correct drive.")
GUICtrlSetData($ErrorLabel, "Source drive can not be a Network/Optical drive!")
GUICtrlSetColor($ErrorLabel, 0xff0000)
GUICtrlSetState($ErrorLabel, $GUI_SHOW)
_FileWriteLog($Log, "DRU>Warning>Source Drive Status>User Selected Network/Optical drive - !" & GUICtrlRead($DrivePath))
ElseIf (GUICtrlRead($DrivePath)) = "" And $msg = $StartButton Then
GUICtrlSetData($ErrorLabel, "Source drive can not be Blank!")
GUICtrlSetColor($ErrorLabel, 0xff0000)
GUICtrlSetState($ErrorLabel, $GUI_SHOW)
_FileWriteLog($Log, "DRU>Warning>Source Drive Status>User Selected Blank drive - !" & GUICtrlRead($DrivePath))
Else
GUICtrlSetData($ErrorLabel, "")

If GUICtrlRead($usersel) <> 1 And GUICtrlRead($DESK) <> 1 And GUICtrlRead($FAV) <> 1 And GUICtrlRead($OFF) <> 1 And GUICtrlRead($AVA) <> 1 And GUICtrlRead($CRYPTO) <> 1 And GUICtrlRead($PSTS) <> 1 And GUICtrlRead($Others) <> 1 And GUICtrlRead($Transfer) <> 1 And GUICtrlRead($Mydocs) <> 1 Then
MsgBox(48, "Restor Option Warning!", "Atleast one option should be selected in Restore option")
GUICtrlSetState($iProgress_1, $GUI_HIDE)
_FileWriteLog($Log, "DRU>Warning>Options>Atleast one option should be selected  - !")
Else
$ret = 1
EndIf
EndIf
EndFunc   ;==>_check



Func _GUICtrlRichEdit_WriteLine($hWnd, $sText, $iIncrement = 0, $sAttrib = "", $iColor = -1)

; Count the @CRLFs
StringReplace(_GUICtrlRichEdit_GetText($hWnd, True), @CRLF, "")
Local $iLines = @extended
; Adjust the text char count to account for the @CRLFs
Local $iEndPoint = _GUICtrlRichEdit_GetTextLength($hWnd, True, True) - $iLines
; Add new text
_GUICtrlRichEdit_AppendText($hWnd, $sText & @CRLF)
; Select text between old and new end points
_GUICtrlRichEdit_SetSel($hWnd, $iEndPoint, -1)
; Convert colour from RGB to BGR
$iColor = Hex($iColor, 6)
$iColor = '0x' & StringMid($iColor, 5, 2) & StringMid($iColor, 3, 2) & StringMid($iColor, 1, 2)
; Set colour
If $iColor <> -1 Then _GUICtrlRichEdit_SetCharColor($hWnd, $iColor)
; Set size
If $iIncrement <> 0 Then _GUICtrlRichEdit_ChangeFontSize($hWnd, $iIncrement)
; Set weight
If $sAttrib <> "" Then _GUICtrlRichEdit_SetCharAttributes($hWnd, $sAttrib)
; Clear selection
_GUICtrlRichEdit_Deselect($hWnd)

EndFunc   ;==>_GUICtrlRichEdit_WriteLine

Func _TvCheckbox($hTvItem, $fTvCheck)



;-------------- Going up the tree -----------------------------------
_TvCheckboxParent($hTvItem, $fTvCheck)

;-------------- Going down the tree -----------------------------------
_TvCheckboxChild($hTvItem, $fTvCheck)

;-------------- Loopping to the function to get the detail of selected tree -----------------------------------

If $ConSel = True Then
_TvGetpath($hTvItem, $fTvCheck)
$ConSel = False
EndIf
EndFunc   ;==>_TvCheckbox

Func _TvCheckboxChild($hTvItem, $fTvCheck)
Local $hFirst, $hNext
$hFirst = _GUICtrlTreeView_GetFirstChild($hTreeView, $hTvItem)
If $hFirst Then
$hNext = $hFirst
While $hNext
_GUICtrlTreeView_SetChecked($hTreeView, $hNext, $fTvCheck)
If _GUICtrlTreeView_GetFirstChild($hTreeView, $hNext) Then
_TvCheckboxChild($hNext, $fTvCheck)
EndIf
$hNext = _GUICtrlTreeView_GetNextSibling($hTreeView, $hNext)
WEnd
EndIf
EndFunc   ;==>_TvCheckboxChild

Func _TvCheckboxParent($hTvItem, $fTvCheck)
Local $hFirst, $hNext, $bCheckedFlag

If $fTvCheck Then
$hTvParent = _GUICtrlTreeView_GetParentHandle($hTreeView, $hTvItem)
If $hTvParent = 0 Then
_GUICtrlTreeView_SetChecked($hTreeView, $hTvItem, $fTvCheck)
Else
$hFirst = _GUICtrlTreeView_GetParentHandle($hTreeView, $hTvItem)
If $hFirst Then
$hNext = $hFirst
_GUICtrlTreeView_SetChecked($hTreeView, $hNext, $fTvCheck)
If _GUICtrlTreeView_GetParentHandle($hTreeView, $hNext) Then
_TvCheckboxParent($hNext, $fTvCheck)
EndIf
EndIf
EndIf
Else
$hTvParent = _GUICtrlTreeView_GetParentHandle($hTreeView, $hTvItem)
If $hTvParent = 0 Then ; reached the top of the list
_GUICtrlTreeView_SetChecked($hTreeView, $hTvItem, $fTvCheck)
Else
$hNext = $hTvParent
; check to see if any siblings are checked
$hSibling = _GUICtrlTreeView_GetFirstChild($hTreeView, $hNext)
$bCheckedFlag = True
While $hSibling > 0
If _GUICtrlTreeView_GetChecked($hTreeView, $hSibling) Then
$bCheckedFlag = False
ExitLoop
EndIf
$hSibling = _GUICtrlTreeView_GetNextSibling($hTreeView, $hSibling)
WEnd
If $bCheckedFlag Then
_GUICtrlTreeView_SetChecked($hTreeView, $hNext, $fTvCheck)
EndIf
If _GUICtrlTreeView_GetParentHandle($hTreeView, $hNext) Then
_TvCheckboxParent($hNext, $fTvCheck)
EndIf
EndIf
EndIf
EndFunc   ;==>_TvCheckboxParent
Func WM_NOTIFY($hWnd, $msg, $wParam, $lParam)
Local $tNMHDR, $IdFrom, $iCode

$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$IdFrom = DllStructGetData($tNMHDR, "IdFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hTreeView
Switch $iCode
Case $NM_CLICK
$fDblClk = True
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func about()
MsgBox(64, "About", "Tool Name: Data Restoration Utlity" & @CRLF & @CRLF & @CRLF & "Software Used: Auto IT" & @CRLF & @CRLF & @CRLF & "For issue/Suggestions: Send an email to below EMAIL ID" & @CRLF & @CRLF & "sikaleel87@gmail.com")
EndFunc   ;==>about

Func _TvGetpath($hTvItem, $fTvCheck)
$AddingValue = _GUICtrlTreeView_GetTree($hTreeView, $hTvItem)
_ArrayAdd($GetpathArray, $AddingValue)
EndFunc   ;==>_TvGetpath

Bit.au3

Pst.au3

Bitlocker.au3

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

Why not just clear the text instead? Use >>

_GUICtrlRichEdit_SetText($hRichEdit, '')

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Why not just clear the text instead? Use >>

_GUICtrlRichEdit_SetText($hRichEdit, '')

Thank you so much for the quick answer guiness! but when i click the process again the memowrite function fails to write the lines again :(

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

Can you provide a small script, because the code you posted above requires me download quite a bit and then go through your code trying to work out what you're doing. Thanks.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Hi guinness,

Here is my small example script. on the example below if you click on "Restore" and "Retry" button for the first time it will write on Richedit window but from the next time it will not written we have to restart the tool again to make it work.

#RequireAdmin
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=database-next.ico
#AutoIt3Wrapper_Outfile=DCU.exe
#AutoIt3Wrapper_Res_Comment=Data Restoration Utility
#AutoIt3Wrapper_Res_Description=Data Restoration Utility
#AutoIt3Wrapper_Res_Fileversion=1.0.0.15
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_Res_LegalCopyright=Site Support Team
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
://////=__=
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include <GuiRichEdit.au3>

#include <ComboConstants.au3>
#include"Array.au3"


Global $iMemo,$BaseGUI
Global $Title = "TEST"

$BaseGUI = GUICreate($Title, 950, 570, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_GROUP, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
GUISetBkColor(0xFAFAFA)
$Sourcedrive = GUICtrlCreateLabel("Select the Source Drive", 10, 10, 120, 40)
$ErrorLabel = GUICtrlCreateLabel("", 10, 490, 600, 40)
GUICtrlSetState(-1, $GUI_HIDE)
$DrivePath = GUICtrlCreateCombo("C:", 135, 5, 60, 50, $CBS_DROPDOWNLIST)
$DestDrive = GUICtrlCreateLabel("Data Destination Location", 230, 10, 200, 40)
$DestPath = GUICtrlCreateInput("C:", 370, 5, 60, 20)
GUICtrlSetState(-1, $GUI_DISABLE)
$aArray = DriveGetDrive("ALL")
$OS = GUICtrlCreateLabel("Select Source OS", 475, 10, 100, 40)
$OSver = GUICtrlCreateCombo("Win 7-64 Bit", 570, 5, 110, 50, $CBS_DROPDOWNLIST)
GUICtrlSetData($OSver, "Win 7-32 Bit")
GUICtrlSetData($OSver, StringUpper("XP"))
If @error Then
; An error occurred when retrieving the drives.
MsgBox(16, $Title & "DriveGetDrive", "Error occured while trying to fetch the drive details.")
Exit
Else
For $i = 1 To $aArray[0] ; Show all the drives found and convert the drive letter to uppercase.
If $aArray[$i] <> "C:" Then
GUICtrlSetData($DrivePath, StringUpper($aArray[$i]))
EndIf
Next
EndIf


$processviewer = GUICtrlCreateGroup("Restore Options", 10, 40, 330, 340)
$Mydocs = GUICtrlCreateCheckbox("My Documents", 160, 70, 100, 40)
$Transfer = GUICtrlCreateCheckbox("All", 30, 70, 100, 40)
$Unckec = GUICtrlCreateCheckbox("UnCheck All", 30, 60, 100, 40)
GUICtrlSetState(-1, $GUI_HIDE)
$DESK = GUICtrlCreateCheckbox("Desktop", 30, 120, 100, 40)
$FAV = GUICtrlCreateCheckbox("Favorites", 30, 170, 100, 40)
$OFF = GUICtrlCreateCheckbox("Office Settings", 30, 220, 100, 40)
$AVA = GUICtrlCreateCheckbox("Avaya", 160, 120, 100, 40)
$CRYPTO = GUICtrlCreateCheckbox("Crypto Soft Token", 160, 170, 120, 40)
$PSTS = GUICtrlCreateCheckbox("PST Files", 160, 220, 100, 40)
$usersel = GUICtrlCreateCheckbox("User Selection", 30, 270, 100, 40)
$StartButton = GUICtrlCreateButton("Restore", 15, 390, 60, 40)
$CancelButton = GUICtrlCreateButton("Exit", 200, 390, 60, 40)
$processviewer = GUICtrlCreateGroup("", 360, 40, 370, 340)
GUICtrlSetData($processviewer, "User Selection")
$Retry = GUICtrlCreateButton("Retry",590, 490, 150, 60)
GUICtrlSetState(-1,$GUI_HIDE)







GUISetState()




While 1

$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Or $msg = $CancelButton Then

_GUICtrlRichEdit_Destroy($iMemo)

Exit
EndIf

If $msg = $Retry Then
GUICtrlSetState($Retry, $GUI_HIDE)
GUICtrlSetState($StartButton, $GUI_SHOW)
GUICtrlSetState($CancelButton, $GUI_SHOW)
_GUICtrlRichEdit_WriteLine($iMemo, "I AM IN - Retry" & @CRLF, "", "", 0xFE2EF7)
EndIf


If $msg = $StartButton Then
button()
GUICtrlSetState($Retry, $GUI_SHOW)
GUICtrlSetState($StartButton, $GUI_HIDE)
GUICtrlSetState($CancelButton, $GUI_HIDE)
EndIf


WEnd

Func button()
$iMemo = _GUICtrlRichEdit_Create($BaseGUI, "******************************************************************************" & @CRLF, 370, 70, 340, 300, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_READONLY)
_GUICtrlRichEdit_WriteLine($iMemo, "Restoring Data" & @CRLF, "", "", 0x000000)
_GUICtrlRichEdit_WriteLine($iMemo, "******************************************************************************" & @CRLF, "", "", 0x000000)
_GUICtrlRichEdit_WriteLine($iMemo, "I AM IN" & @CRLF, "", "", 0xFE2EF7)
EndFunc


Func _GUICtrlRichEdit_WriteLine($hWnd, $sText, $iIncrement = 0, $sAttrib = "", $iColor = -1)

; Count the @CRLFs
StringReplace(_GUICtrlRichEdit_GetText($hWnd, True), @CRLF, "")
Local $iLines = @extended
; Adjust the text char count to account for the @CRLFs
Local $iEndPoint = _GUICtrlRichEdit_GetTextLength($hWnd, True, True) - $iLines
; Add new text
_GUICtrlRichEdit_AppendText($hWnd, $sText & @CRLF)
; Select text between old and new end points
_GUICtrlRichEdit_SetSel($hWnd, $iEndPoint, -1)
; Convert colour from RGB to BGR
$iColor = Hex($iColor, 6)
$iColor = '0x' & StringMid($iColor, 5, 2) & StringMid($iColor, 3, 2) & StringMid($iColor, 1, 2)
; Set colour
If $iColor <> -1 Then _GUICtrlRichEdit_SetCharColor($hWnd, $iColor)
; Set size
If $iIncrement <> 0 Then _GUICtrlRichEdit_ChangeFontSize($hWnd, $iIncrement)
; Set weight
If $sAttrib <> "" Then _GUICtrlRichEdit_SetCharAttributes($hWnd, $sAttrib)
; Clear selection
_GUICtrlRichEdit_Deselect($hWnd)

EndFunc   ;==>_GUICtrlRichEdit_WriteLine
Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

If you run this script, please post the results.

Never mind the script. :)

Try this, open the GUIRichEdit.au3 file, navigate to the _GUICtrlRichEdit_Create function in it, and comment out the second line in the function.

; comment out or delete this line from the UDF
If Not _WinAPI_IsClassName($hWnd, $_GRE_sRTFClassName) Then Return SetError(1, 0, 0) ; Invalid Window handle for _GUICtrlRichEdit_Create 1st parameter
; replace it with this line instead
If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0) ; Invalid Window handle for _GUICtrlRichEdit_Create 1st parameter

Then try your script again and see if it fixes the problem.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

There was a bug, that has been corrected in the latest beta (I think), that prevented you from creating more than one RichEdit control at a time. The first line I posted was the bug, the second is the fix.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I didn't test the code but if I did it would have worked. Should really re-download the V3.3.8.1 UDFs as I'm using the beta version.

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I didn't test the code but if I did it would have worked. Should really re-download the V3.3.8.1 UDFs as I'm using the beta version.

Ditto, I modified the 3.3.8.1 UDF. It ran for me when I ran it, then remembered about the bug fix.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...