INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Jobs from Indeed

HTA Backup user data

HTA Backup user data

(OP)
HI

i need to create a script with user interface for they backup their data from their old computer.

I already have the interface. when a user launch the scritp, the user must put the name of his old computer. he click on add foler and the scritp must showing the C driver of the old computer but i need to show only the personal folders than the user has created.

i don't know how to exclude the système folders (Windows, program files...etc)

Can you help me please????


CODE --> HTA

 
<html>
<head> <title>Backup Utility ......</title>
<HTA:APPLICATION ID="HTABackup" APPLICATIONNAME="Backup Utility" icon="1.ico" BORDER="dialog" BORDERSTYLE="raised" CONTEXTMENU="no" ICON="1.ico" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="yes" SELECTION="no" SHOWINTASKBAR="yes" SYSMENU="yes" VERSION="1.0">
<style type="text/css">
#Input_Desktop {
width: 266px;
}
#BackupDirLabel {
margin-left: 0px;
}
</style>
</head>
<script type="text/vbscript">
Call window.resizeTo(800,600)

function BrowseForFolder()
Dim Path, oFolder, oShell, PathDesktop
oFolder = ""
set oShell = CreateObject("Shell.Application")


set oFolder = oShell.BrowseForFolder(0, "Choose a Folder", 0)
on error resume next
Path = oFolder.ParentFolder.ParseName(oFolder.Title).Path
if Err.Number <> 0 then
Path = ""
end if
Set oFolder = Nothing
Set oShell = Nothing

BrowseForFolder = Path

end function



function BrowseForFolderDistant()

Dim Path, oFolder, oShell, PathDesktop
oFolder = ""
set oShell = CreateObject("Shell.Application")

if Input_Desktop.value = "" then
return
end if

PathDesktop = "\\" + Input_Desktop.value + "\c$"


set oFolder = oShell.BrowseForFolder(0, "Choose a Folder", 0, PathDesktop)
on error resume next
Path = oFolder.ParentFolder.ParseName(oFolder.Title).Path
if Err.Number = 0 then
if (Right(Path, 1) <> "\\") then
Path = Path & "\\"
end if
else
Path = ""
end if
Set oFolder = Nothing
Set oShell = Nothing

BrowseForFolderDistant = Path
end function

function BrowseForFile(root)
Dim Path, oFolder, oShell
oFolder = ""
set oShell = CreateObject("Shell.Application")
set oFolder = oShell.BrowseForFolder(&H0, "Choose a file or enter the Filename", &H3023, root)
on error resume next
Path = oFolder.ParentFolder.ParseName(oFolder.Title).Path
if Err.Number = 0 then
if (Right(Path, 1) <> "\\") then
Path = Path & "\\"
end if
else
Path = ""
end if
Set oFolder = Nothing
Set oShell = Nothing

BrowseForFolder = Path
end function


sub BackupNow
Dim fso, folder, newfoldername, BackupToFolder
Dim increment, incrementstring

if BackupDirLabel.value = "" or BackupDirLabel.value = "(No Directory Chosen)" then
MsgBox "You must choose a directory to back up to before backing up."
Exit Sub
end if

if BackupFolders.options.length = 0 then
MsgBox "You must choose the folders you want to back up before backing up."
Exit Sub
end if

Set fso = CreateObject("Scripting.FileSystemObject")
' Set up backup folder
BackupToFolder = BackupDirLabel.value

if Not(fso.FolderExists(BackupToFolder)) then
Call fso.CreateFolder(BackupToFolder)
end if


if Not(fso.FolderExists(BackupToFolder)) then
Call fso.CreateFolder(BackupToFolder)
end if

For i = 0 to BackupFolders.options.length - 1
Set folder = fso.GetFolder(BackupFolders.options(i).value)
newfoldername = BackupFolders.options(i).value
newfoldername = Right(newfoldername, Len(newfoldername) - InStrRev(newfoldername, "c$", Len(newfoldername) - 1) -1)
newfoldername = Left(newfoldername, InStrRev(newfoldername, "\\") - 1)
newfoldername = BackupToFolder & newfoldername
if fso.FolderExists(newfoldername) then
increment = 1
incrementstring = "001"
do while fso.FolderExists(newfoldername & "." & incrementstring)
increment = increment + 1
incrementstring = CStr(increment)
if increment < 100 then
incrementstring = "0" & incrementstring
if increment < 10 then
incrementstring = "0" & incrementstring
end if
end if
loop
newfoldername = newfoldername & "." & incrementstring
end if
MsgBox newfoldername
Call fso.CreateFolder(newfoldername)
folder.Copy(newfoldername)
Set folder = Nothing
Next
Set fso = Nothing
if InStr(HTABackup.commandline, "/silent") <= 0 then
MsgBox "Backup Complete."
end if
end sub


sub AddFolderDistant_OnClick
Dim Path, oOption

Path = BrowseForFolderDistant()

if Path <> "" then
set oOption = document.createElement("option")
oOption.Text = Path
oOption.Value = Path
BackupFolders.add(oOption)
end if
end Sub

sub ChooseDir_OnClick
Dim Path

Path = BrowseForFolder()
if Path <> "" then
BackupDirLabel.value = Path
end if
end sub


sub RemoveFolder_OnClick
Dim i, RemoveTo

RemoveTo = BackupFolders.options.length - 1
For i = 0 to RemoveTo
if i < BackupFolders.options.length then
if BackupFolders.options(i).selected then
BackupFolders.remove i
RemoveTo = RemoveTo - 1
i = i - 1
end if
end if
Next
end Sub



sub BackupNowBTN_OnClick
Call BackupNow()
end sub

Sub TestSub
Msgbox BasicTextbox.Value
End Sub


</script>
<script language="javascript">
var msg = ".............................................<<<DATA BACKUP UTILITY TOOL>>> ---------------> ***** This Utility Is Ideal For Backing Up Your Data For Example : Photos, Music, Documents Etc... *****";
var pos = 0;
var spacer = " ....................................................................................";
var time_length = 150;

function ScrollTitle()
{
document.title = msg.substring(pos, msg.length) + spacer + msg.substring(0, pos);
pos++;
if (pos > msg.length) pos=0;
window.setTimeout("ScrollTitle()",time_length);
}
ScrollTitle();

</script>
</head>

<body STYLE="color:Blue ; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=1, StartColorStr='#9BBAD6', EndColorStr='#6699ff'); width: 469px; height: 385px;">
<!-- Main Content Box -->

<div id="MainContentBox" style="width: 430px; height: 255px; position: absolute; left: 5px; top: 25px;">
<div ><input type="Text" id="Input_Desktop" size="20" value="(Computer Name)"/></div>
<div style="width: 258px; height: 200px; position: absolute; left: 10px; top: 30px; font-weight: bold;"><select id="BackupFolders" name="BackupFolders" style="width: 258px; height: 200px;"></select></div>
<div style="width: 100px; height: 23px; position: absolute; left: 275px; top: 30px; text-align: center; background-color: #0000DD; font-weight: bold;"><input type="Button" id="AddFolderDistant" value="Add Folder" style="font-size: 14px; width: 130px;"></div>
<div style="width: 100px; height: 23px; position: absolute; left: 275px; top: 60px; text-align: center; background-color: #0000DD; font-weight: bold;"><input type="Button" id="RemoveFolder" value="Remove Selected" style="font-size: 14px; width: 130px;"></div>
<div style="width: 115px; height: 23px; position: absolute; left: 10px; top: 230px; font-weight: bold;">Backup To:</div>
<div did="BackupDirLabel" style="width: 323px; height: 23px; position: absolute; left: 95px; top: 230px; font-weight: bold;"><input type="Text" id="BackupDirLabel" size="23" value="(No Directory Chosen)"></div>
<div style="width: 115px; height: 23px; position: absolute; left: 275px; top: 230px; font-weight: bold;"><input type="Button" id="ChooseDir" value="Choose Directory" style="font-size: 14px; width: 130px;"></div>
<div style="display: none;"><input type="File" id="SaveToFile"></div>
<div style="width: 115px; height: 23px; position: absolute; left: 280px; top: 260px; font-weight: bold;"><input type="Button" id="BackupNowBTN" value="Backup Now" style="font-size: 14px; width: 130px;"></div>
</div>
<!-- / Main Content Box -->


</body>
</html>

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close