Jass Posted May 9, 2009 Share Posted May 9, 2009 (edited) Hey out there, I'm new to AutoIt and I wrote a small backupscript for a MSSQL-Database and some files. The script should be used by our customers so I want them to edit a textfile with some variables to their need and the compiled script to just include the textfile. That's the way I tried... Backup.au3: ;Includes for functions _RunDOS and _Now() #Include <Process.au3> #include <Date.au3> #include "Variables.txt" #RequireAdmin ;BallonTip backup start TrayTip("Backup aktiv","ADAMS Backup startet, Datenbank und elektronische Akte werden gesichert.",5,2) ;Shutdown SQL-Server, copy database files and restart SQL-Server _RunDOS("net stop " & $sqlinstancename) FileCopy($dirsqlserver & "\" & $dbname, $dirbackupdb & "\" & $dbname, 1) FileCopy($dirsqlserver & "\" & $dblogname, $dirbackupdb & "\" & $dblogname, 1) _RunDOS("net start " & $sqlinstancename) ;Copy files of "Elekotronische Akte" DirCopy($direakte, $dirbackupeakte, 1) ;If not exists, create logfile and insert outcome $file = FileOpen($dirlogfile & "\" & $logfilename, 1) FileWrite($file, _Now() & ": ADAMS Backup erfolgreich erstellt. " & "Datenbank gesichert nach: " & $dirbackupdb & " ; Dateien elektronische Akte gesichert nach: " & $dirbackupeakte & @CRLF) FileClose($file) ;BallonTip backup end TrayTip("Backup beendet","ADAMS Backup erfolgreich beendet, Logfile aktualisiert.",5,1) Sleep(5000)oÝ÷ Ø Ý¶¯j¸nW¬~íë®*mj·©§v)íè§r[y×âꮢÕZ®&ë-ÆÚ®¢ÛajÙh¢K%G+ºÚ"µÍÐ]HÜÙ[ÚYHYÙH]ZH[ZHY?ÜÙH[ÕÒPÒQÎ[HZXÚÜÙH¿YHXÚÝÈÜÙ[X[Y[Ý[Ù[[Z]ÈXÚÝ[Ý[ÛY ÌÌÎÉÌÌÎÉÌÌÎÂÓ[YHÔSTÙ[Ý[ÌÍÜÜ[[Ý[Ù[[YHH ][ÝÓTÔÔS ÌÍÐQST×ÔÔSÑTT][ÝÂÓ[YH][[ËQ]ZH [HÜX[[XÚ9BÌÍÙ[YHH ][ÝÐQSTËY][ÝÂÓ[YH][[ËSÙÙ]ZH [HÜX[[XÚ9BÌÍÙÙÛ[YHH ][ÝÐQST×ÛÙË][ÝÂÑ]KUZXÚÈÈÔSTÙÂÌÍÙÜ[ÙH ][ÝÐÎÌLÔÙÜ[[YIÌLÓZXÜÜÛÙÔSÙÌLÓTÔÔSIÌLÓTÔÔS ÌLÑ]I][ÝÂÐXÚÝUZXÚÈ¿YH][[ËQ]ZY[ÌÍÙXÚÝH ][ÝÑÌLÐXÚÝ ÌLÑ][[É][ÝÂÕZXÚÈ[ZÝÛØÚ[ZÝBÌÍÙXZÝHH ][ÝÐÎÌLÔÙÜ[[YIÌLÒRÒÔ]X[]ÈÛX ÌLÑ[ZÝÛØÚHZÝI][ÝÂÕZXÚÈ¿XÚÝ[ZÝÛØÚ[ZÝBÌÍÙXÚÝXZÝHH ][ÝÑÌLÐXÚÝ ÌLÑ]ZY[][ÝÂÕZXÚÈ¿YHÙÙ]ZBÌÍÙÙÙ[HH ][ÝÑÌLÐXÚÝ ][ÝÂÓ[YHÙÙ]ZBÌÍÛÙÙ[[[YHH ][ÝÓÙÙ[K ][Ý My problem is that the script runs great under Windows XP but not under Windows Vista or Windows Server 2003. The SQL-Service is beeing ended and restartet but the commands for filecopy and dircopy doesn't work. I also tried to put the declaration of the variables into the script itself and this works but I need them in a separate file. Any ideas where to find the problem? Cheers Dennis Edited May 9, 2009 by Jass Link to comment Share on other sites More sharing options...
Jass Posted May 9, 2009 Author Share Posted May 9, 2009 I don't know why but my code i unreadable, so here one more time the full code: backup.au3: ;Includes for functions _RunDOS and _Now() #include <process.au3> #include <Date.au3> #include "Variables.txt" #RequireAdmin ;BallonTip backup start TrayTip("Backup aktiv","ADAMS Backup startet, Datenbank und elektronische Akte werden gesichert.",5,2) ;Shutdown SQL-Server, copy database files and restart SQL-Server _RunDOS("net stop " & $sqlinstancename) FileCopy($dirsqlserver & "\" & $dbname, $dirbackupdb & "\" & $dbname, 1) FileCopy($dirsqlserver & "\" & $dblogname, $dirbackupdb & "\" & $dblogname, 1) _RunDOS("net start " & $sqlinstancename) ;Copy files of "Elekotronische Akte" DirCopy($direakte, $dirbackupeakte, 1) ;If not exists, create logfile and insert outcome $file = FileOpen($dirlogfile & "\" & $logfilename, 1) FileWrite($file, _Now() & ": ADAMS Backup erfolgreich erstellt. " & "Datenbank gesichert nach: " & $dirbackupdb & " ; Dateien elektronische Akte gesichert nach: " & $dirbackupeakte & @CRLF) FileClose($file) ;BallonTip backup end TrayTip("Backup beendet","ADAMS Backup erfolgreich beendet, Logfile aktualisiert.",5,1) Sleep(5000)oÝ÷ Ø Ý¶{_Wj¸nW¬·ZºÚ"µÍÐ]HÜÙ[ÚYHYÙH]ZH[ZHY?ÜÙH[ÕÒPÒQÎ[HZXÚÜÙH¿YHXÚÝÈÜÙ[X[Y[Ý[Ù[[Z]ÈXÚÝ[Ý[ÛY ÌÌÎÉÌÌÎÉÌÌÎÂÓ[YHÔSTÙ[Ý[ÌÍÜÜ[[Ý[Ù[[YHH ][ÝÓTÔÔS ÌÍÐQST×ÔÔSÑTT][ÝÂÓ[YH][[ËQ]ZH [HÜX[[XÚ9BÌÍÙ[YHH ][ÝÐQSTËY][ÝÂÓ[YH][[ËSÙÙ]ZH [HÜX[[XÚ9BÌÍÙÙÛ[YHH ][ÝÐQST×ÛÙË][ÝÂÑ]KUZXÚÈÈÔSTÙÂÌÍÙÜ[ÙH ][ÝÐÎÌLÔÙÜ[[YIÌLÓZXÜÜÛÙÔSÙÌLÓTÔÔSIÌLÓTÔÔS ÌLÑ]I][ÝÂÐXÚÝUZXÚÈ¿YH][[ËQ]ZY[ÌÍÙXÚÝH ][ÝÑÌLÐXÚÝ ÌLÑ][[É][ÝÂÕZXÚÈ[ZÝÛØÚ[ZÝBÌÍÙXZÝHH ][ÝÐÎÌLÔÙÜ[[YIÌLÒRÒÔ]X[]ÈÛX ÌLÑ[ZÝÛØÚHZÝI][ÝÂÕZXÚÈ¿XÚÝ[ZÝÛØÚ[ZÝBÌÍÙXÚÝXZÝHH ][ÝÑÌLÐXÚÝ ÌLÑ]ZY[][ÝÂÕZXÚÈ¿YHÙÙ]ZBÌÍÙÙÙ[HH ][ÝÑÌLÐXÚÝ ][ÝÂÓ[YHÙÙ]ZBÌÍÛÙÙ[[[YHH ][ÝÓÙÙ[K ][Ý Link to comment Share on other sites More sharing options...
JRowe Posted May 9, 2009 Share Posted May 9, 2009 The autoit code tags screw things up sometimes. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
gkrapp Posted May 9, 2009 Share Posted May 9, 2009 Hi, maybe you should check your pathnames on the command line (especially for Vista). As an example: On the command line there are your profiles in the "C:\users" folder. On the german GUI (in the explorer window) you see "C:\Benutzer" instead. Please check first via CMD-Window if the path is really "C:\Programme" or if it's "C:\program files". Link to comment Share on other sites More sharing options...
Jass Posted May 10, 2009 Author Share Posted May 10, 2009 Hi,maybe you should check your pathnames on the command line (especially for Vista).As an example: On the command line there are your profiles in the "C:\users" folder. On the german GUI (in the explorer window) you see "C:\Benutzer" instead.Please check first via CMD-Window if the path is really "C:\Programme" or if it's "C:\program files".Oh sorry it's my fault I copied the code from my XP script.On Vista I changed the textfile as you said to "C:\program files" and tested it by inserting the path into the windows explorer, with success. Link to comment Share on other sites More sharing options...
Reaper HGN Posted June 4, 2009 Share Posted June 4, 2009 Its hard to test your code specifically without setting it up in my environment, but in general, how are you handling UAC in Vista? I could see permissions potentially being a problem. You might also try logging in your script to see exactly where the issue is (or at least consolewrite when coding). Link to comment Share on other sites More sharing options...
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