Sign in to follow this  
Followers 0
adamsj13

Inputbox hELP

10 posts in this topic

Hi all,

How can I have a inputbox save the data the user puts in to create a folder on a server? For instance

InputBox ( "Backup Name", "Please type in name of backup Directory. For Example Jared's Backup 08/17/06", "Default" , "")

I want to be able to save what the users types in and create a folder with that name.

Thanks

Share this post


Link to post
Share on other sites



$answer = InputBox ( "Backup Name", "Please type in name of backup Directory. For Example Jared's Backup 08/17/06", "Default" , "")

$folder = "\\server\share\backups\" & $answer

DirCreate($folder)


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

$answer = InputBox ( "Backup Name", "Please type in name of backup Directory. For Example Jared's Backup 08/17/06", "Default" , "")

$folder = "\\server\share\backups\" & $answer

DirCreate($folder)

Great!! Thanks

Here is what I was using and worked GREAT, but I want the user to be able to have unique backup names for each person.

msgbox(1, "Backup", "Once Complete another Message will appear")

DirCreate("h:\backup\lotus\notes\data")

DirCreate("h:\backup\desktop")

DirCreate("h:\backup\favorites")

DirCreate("h:\backup\passport")

DirCreate("h:\backup\My Documents")

DirCreate("h:\backup\printers")

DirCreate("h:\backup\network-drives")

sleep(10000)

DirCopy(@MyDocumentsDir, "h:\backup\My Documents", 1)

DirCopy(@DesktopDir, "h:\backup\desktop", 1)

DirCopy(@FavoritesDir, "h:\backup\favorites", 1)

FileCopy("C:\program files\lotus\notes\notes.ini", "h:\backup\lotus\notes")

FileCopy("C:\program files\lotus\notes\data\*.nsf", "h:\backup\lotus\notes\data")

FileCopy("C:\program files\lotus\notes\data\archive\*.nsf", "h:\backup\lotus\notes\data\archive")

FileCopy("C:\program files\lotus\notes\data\mail\*.nsf", "h:\backup\lotus\notes\data\mail")

FileCopy("C:\program files\lotus\notes\data\*.id", "h:\backup\lotus\notes\data")

FileCopy("C:\program files\lotus\notes\data\*.dsk", "h:\backup\lotus\notes\data")

FileCopy("C:\program files\lotus\notes\data\*.ndk", "h:\backup\lotus\notes\data")

FileCopy("C:\program files\passport\*.kpd", "h:\backup\passport")

FileCopy("C:\program files\passport\*.mac", "h:\backup\passport")

FileCopy("C:\program files\passport\*.zcc", "h:\backup\passport")

FileCopy("C:\program files\passport\*.zws", "h:\backup\passport")

FileCopy("C:\program files\passport\*.*", "h:\backup\passport")

runwait(@comspec & " /c " & 'REGEDIT /E ' & 'h:\backup\network-drives\MappedDrives.reg

"HKEY_CURRENT_USER\Network\"', "" ,@SW_HIDE)

runwait(@comspec & " /c " & 'REGEDIT /E ' & 'h:\backup\printers\Printers.reg

"HKEY_CURRENT_USER\Printers\Connections\"', "" ,@SW_HIDE)

SoundSetWaveVolume(99)

SoundPlay("C:\winxp\media\tada.wav", 1)

msgbox(1, "Backup", "Backup Complete")

What would be the best way to change all the h:\backup\ to $answer ?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You might get into trouble letting them set their own folder names. This modification sets a foldername based on their logged on name and the current date.

I haven't tested this, obviously, so be careful:

#Include <Date.au3>
$date = _NowCalcDate()
$date = stringreplace($date,"/","-")

$backupfolder = "h:\backup\"& @username & "\" & $date
DirCreate($backupfolder)

SplashTextOn ( "Backup", "Backing up your data to "&$backupfolder)


DirCreate($backupfolder & "\lotus\notes\data")
DirCreate($backupfolder & "\desktop")
DirCreate($backupfolder & "\favorites")
DirCreate($backupfolder & "\passport")
DirCreate($backupfolder & "\My Documents")
DirCreate($backupfolder & "\printers")
DirCreate($backupfolder & "\network-drives")
sleep(10000)
DirCopy(@MyDocumentsDir, $backupfolder & "\My Documents", 1)
DirCopy(@DesktopDir, $backupfolder & "\desktop", 1)
DirCopy(@FavoritesDir, $backupfolder & "\favorites", 1)
FileCopy("C:\program files\lotus\notes\notes.ini", $backupfolder & "\lotus\notes")
FileCopy("C:\program files\lotus\notes\data\*.nsf", $backupfolder & "\lotus\notes\data")
FileCopy("C:\program files\lotus\notes\data\archive\*.nsf", $backupfolder & "\lotus\notes\data\archive")
FileCopy("C:\program files\lotus\notes\data\mail\*.nsf", $backupfolder & "\lotus\notes\data\mail")
FileCopy("C:\program files\lotus\notes\data\*.id", $backupfolder & "\lotus\notes\data")
FileCopy("C:\program files\lotus\notes\data\*.dsk", $backupfolder & "\lotus\notes\data")
FileCopy("C:\program files\lotus\notes\data\*.ndk", $backupfolder & "\lotus\notes\data")
FileCopy("C:\program files\passport\*.kpd", $backupfolder & "\passport")
FileCopy("C:\program files\passport\*.mac", $backupfolder & "\passport")
FileCopy("C:\program files\passport\*.zcc", $backupfolder & "\passport")
FileCopy("C:\program files\passport\*.zws", $backupfolder & "\passport")
FileCopy("C:\program files\passport\*.*", $backupfolder & "\passport")
SplashOff()

runwait(@comspec & " /c " & 'REGEDIT /E ' & 'h:\backup\network-drives\MappedDrives.reg

"HKEY_CURRENT_USER\Network\"', "" ,@SW_HIDE)
runwait(@comspec & " /c " & 'REGEDIT /E ' & 'h:\backup\printers\Printers.reg

"HKEY_CURRENT_USER\Printers\Connections\"', "" ,@SW_HIDE)

SoundSetWaveVolume(99)
SoundPlay("C:\winxp\media\tada.wav", 1)
msgbox(1, "Backup", "Backup Complete")
Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

$backupfolder = "ho:\backup\"& @username & "\" & $date

????

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Thanks all for your help. Is there a way to reverse it? Meaning to copy back over to the machine?

Share this post


Link to post
Share on other sites

That might be dangerous, but just comment out the DirCreates and reverse the 2 parameters in the FileCopys

I really appreciate your help. Now when this runs,

runwait(@comspec & " /c " & 'REGEDIT /E ' & '$backupfolder & "\network-drives\MappedDrives.reg "HKEY_CURRENT_USER\Network\"', ""

,@SW_HIDE)

runwait(@comspec & " /c " & 'REGEDIT /E ' & '$backupfolder & "\printers\Printers.reg "HKEY_CURRENT_USER\Printers\Connections\"', "" ,@SW_HIDE)

It creates a file on the Desktop. Any Ideas why? Thanks

Share this post


Link to post
Share on other sites

Ah, are you trying to restore the registry keys too? That is also dangerous. But, if you really want to do it, take out the "/E"s


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
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
Sign in to follow this  
Followers 0