adamsj13 Posted August 17, 2006 Posted August 17, 2006 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
lod3n Posted August 17, 2006 Posted August 17, 2006 $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]
adamsj13 Posted August 17, 2006 Author Posted August 17, 2006 $answer = InputBox ( "Backup Name", "Please type in name of backup Directory. For Example Jared's Backup 08/17/06", "Default" , "")$folder = "\\server\share\backups\" & $answerDirCreate($folder)Great!! ThanksHere 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 ?
lod3n Posted August 18, 2006 Posted August 18, 2006 (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: expandcollapse popup#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 August 18, 2006 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
Valuater Posted August 18, 2006 Posted August 18, 2006 $backupfolder = "ho:\backup\"& @username & "\" & $date ???? 8)
lod3n Posted August 18, 2006 Posted August 18, 2006 $backupfolder = "ho:\backup\"& @username & "\" & $date????8)Ah, see, that's because I suck. Fixed. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
adamsj13 Posted August 22, 2006 Author Posted August 22, 2006 Thanks all for your help. Is there a way to reverse it? Meaning to copy back over to the machine?
lod3n Posted August 22, 2006 Posted August 22, 2006 That might be dangerous, but just comment out the DirCreates and reverse the 2 parameters in the FileCopys [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
adamsj13 Posted August 23, 2006 Author Posted August 23, 2006 That might be dangerous, but just comment out the DirCreates and reverse the 2 parameters in the FileCopysI 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
lod3n Posted August 23, 2006 Posted August 23, 2006 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]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now