BlackSnoww Posted March 19, 2019 Share Posted March 19, 2019 Hello Good day! I would like to ask help and know what is causing the problem. I currently have 3 files named Backup.au3, Setter.au3 and Sample.ini . If i manually click on these files they run just fine without problems. The problem comes when i run Backup.au3.the program seems to run but in a suspended state and consumes alot off CPU and RAM if not forcefully ended. As for the Setter.au3 Task Scheduler has no issues with it Code for Backup.au3. Any suggestions and help is appreciated Opt("TrayAutoPause", 0) Local $time = _NowTime(5) Local $date = _NowDate() Local $return $date = StringReplace($date, "/", "-") $time = StringReplace($time, ":", "-") Local $DateTime = $date &" "& $time Local $test = String ($DateTime) Local $loc = IniRead ("Sample.ini", "Direct", "BackUpLocation", "" ) ;to be backed up also \ to exclude the base folder Local $to = IniRead ("Sample.ini", "Direct", "BackUpDirectory", "" ) ;folder location for the backup to be saved $loc = $loc & "\" $to = $to & "\" $try = $to &""& $test $try = String($try) RunWait(@ComSpec & ' /c ""%ProgramFiles%\WinRAR\Rar.exe" a -ep1 -r -y "'&$try&'" "'&$loc&'" "',"", @SW_HIDE) _Notify_Show(@AutoItExe, "Backup Succesfull", "Retracts after 5 secs", 5, 0) Sleep(5000) Exit The ini file is used to store the location to be backed up. Link to comment Share on other sites More sharing options...
Nine Posted March 19, 2019 Share Posted March 19, 2019 In Task Scheduler, are you running it as a .au3 or as a .exe ? In the runwait there is a " too much at then end. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
BlackSnoww Posted March 20, 2019 Author Share Posted March 20, 2019 both au3 and exe wont run. But if i click the file manually it runs Link to comment Share on other sites More sharing options...
BrewManNH Posted March 20, 2019 Share Posted March 20, 2019 1 hour ago, BlackSnoww said: both au3 and exe wont run. How do you determine they're not running? What credentials is the task running under, in other words are you running it under the System account, or the logged in user's account? If it's not set to interactive, it won't show anything due to it running in Session 0, which is hidden from the interactive session (anything higher than session 0) 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 GudeHow 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 More sharing options...
BlackSnoww Posted March 20, 2019 Author Share Posted March 20, 2019 14 minutes ago, BrewManNH said: How do you determine they're not running? What credentials is the task running under, in other words are you running it under the System account, or the logged in user's account? If it's not set to interactive, it won't show anything due to it running in Session 0, which is hidden from the interactive session (anything higher than session 0) The program is partially running because i can see the program icon on the taskbar beside the clock running but the Backup file is not being created on the specified location. The program also slowly eats the CPU and RAM usage if not forcefully ended through the task manager. My computer has only one account named "localuser" and checked the box on the task scheduler which says run through the Highest privilege. The only thing i cant understand is why does the program work when i manually click it and run it while if i use Task scheduler to run it it doesnt fully execute. Link to comment Share on other sites More sharing options...
BrewManNH Posted March 20, 2019 Share Posted March 20, 2019 Where is the program saving to? If it's a mapped network drive, and you're using its drive letter, try using the UNC path instead. 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 GudeHow 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 More sharing options...
BlackSnoww Posted March 20, 2019 Author Share Posted March 20, 2019 26 minutes ago, BrewManNH said: Where is the program saving to? If it's a mapped network drive, and you're using its drive letter, try using the UNC path instead. Its not a mapped network drive Link to comment Share on other sites More sharing options...
BrewManNH Posted March 20, 2019 Share Posted March 20, 2019 I'll ask it again, where is it saving to? 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 GudeHow 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 More sharing options...
BlackSnoww Posted March 20, 2019 Author Share Posted March 20, 2019 1 minute ago, BrewManNH said: I'll ask it again, where is it saving to? the program reads it from an ini file while contains these data [Direct] BackUpLocation=C:\Users\localuser\Desktop\Pinnger BackUpDirectory=C:\Users\localuser\Desktop\Sample Backup location Link to comment Share on other sites More sharing options...
Nine Posted March 20, 2019 Share Posted March 20, 2019 Here the code I used to test. Working fine. Win7. Compiled x86. Schedule every day. #AutoIt3Wrapper_Change2CUI=y #include <Date.au3> Opt("TrayAutoPause", 0) Local $time = _NowTime(5) Local $date = _NowDate() Local $return $date = StringReplace($date, "/", "-") $time = StringReplace($time, ":", "-") Local $DateTime = $date &" "& $time Local $loc = "C:\Apps\Mirc\*.*" Local $to = "C:\Apps\Temp\" & $DateTime RunWait (@ComSpec & ' /c ""%programfiles(x86)%\WinRAR\Rar.exe" a -ep1 -r -y "' & $to & '" "' & $loc & '"',"") if @error then Exit TrayTip ("WinRAR", "Backup completed", 10, 1) Sleep (5000) Notice I remove the extra " at the end of the runwait... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
BrewManNH Posted March 20, 2019 Share Posted March 20, 2019 Use consolewrite to see if the variables contain the information you think they are supposed to. Don't hide the process that you're running, get rid of the "/c" and the @SW_HIDE until you've troubleshot the issue. 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 GudeHow 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 More sharing options...
BlackSnoww Posted March 20, 2019 Author Share Posted March 20, 2019 (edited) 32 minutes ago, Nine said: Here the code I used to test. Working fine. Win7. Compiled x86. Schedule every day. #AutoIt3Wrapper_Change2CUI=y #include <Date.au3> Opt("TrayAutoPause", 0) Local $time = _NowTime(5) Local $date = _NowDate() Local $return $date = StringReplace($date, "/", "-") $time = StringReplace($time, ":", "-") Local $DateTime = $date &" "& $time Local $loc = "C:\Apps\Mirc\*.*" Local $to = "C:\Apps\Temp\" & $DateTime RunWait (@ComSpec & ' /c ""%programfiles(x86)%\WinRAR\Rar.exe" a -ep1 -r -y "' & $to & '" "' & $loc & '"',"") if @error then Exit TrayTip ("WinRAR", "Backup completed", 10, 1) Sleep (5000) Notice I remove the extra " at the end of the runwait... I tried ur code and modified the locations to run in my computer. It seems rar.exe cant see the files i want it to Compress #AutoIt3Wrapper_Change2CUI=y #include <Date.au3> Opt("TrayAutoPause", 0) Local $time = _NowTime(5) Local $date = _NowDate() Local $return $date = StringReplace($date, "/", "-") $time = StringReplace($time, ":", "-") Local $DateTime = $date &" "& $time ;Local $loc = "C:\Apps\Mirc\*.*" ;Local $to = "C:\Apps\Temp\" & $DateTime Local $loc = "C:\Users\localuser\Desktop\Pinnger\" Local $to = "C:\Users\localuser\Desktop\Sample Backup location\" & $DateTime RunWait (@ComSpec & ' /k ""%ProgramFiles%\WinRAR\Rar.exe" a -ep1 -r -y "' & $to & '" "' & $loc & '"',"") if @error then Exit TrayTip ("WinRAR", "Backup completed", 10, 1) Sleep (5000) Here is the CMD error Edited March 20, 2019 by BlackSnoww wrong terminology it should be Compress not extract Link to comment Share on other sites More sharing options...
Nine Posted March 20, 2019 Share Posted March 20, 2019 why is there a ? in your rar file “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
BlackSnoww Posted March 20, 2019 Author Share Posted March 20, 2019 1 hour ago, Nine said: Here the code I used to test. Working fine. Win7. Compiled x86. Schedule every day. #AutoIt3Wrapper_Change2CUI=y #include <Date.au3> Opt("TrayAutoPause", 0) Local $time = _NowTime(5) Local $date = _NowDate() Local $return $date = StringReplace($date, "/", "-") $time = StringReplace($time, ":", "-") Local $DateTime = $date &" "& $time Local $loc = "C:\Apps\Mirc\*.*" Local $to = "C:\Apps\Temp\" & $DateTime RunWait (@ComSpec & ' /c ""%programfiles(x86)%\WinRAR\Rar.exe" a -ep1 -r -y "' & $to & '" "' & $loc & '"',"") if @error then Exit TrayTip ("WinRAR", "Backup completed", 10, 1) Sleep (5000) Notice I remove the extra " at the end of the runwait... May i ask why that quote is an extra ? Doesnt it balance the double quote found after the /c ? RunWait (@ComSpec & ' /c ""%ProgramFiles%\WinRAR\Rar.exe" a -ep1 -r -y "' & $to & '" "' & $loc & '" ',"") Im still currently figuring out why the "?" is added at the end of the file name Link to comment Share on other sites More sharing options...
BrewManNH Posted March 20, 2019 Share Posted March 20, 2019 Try it this way. RunWait(@ComSpec & ' /c "%programfiles(x86)%\WinRAR\Rar.exe" a -ep1 -r -y "' & $to & '" "' & $loc & '"', "") You have 2 double quotes before the %programfiles(x86)%, you only need one. 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 GudeHow 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 More sharing options...
Nine Posted March 20, 2019 Share Posted March 20, 2019 (edited) 6 hours ago, BlackSnoww said: May i ask why that quote is an extra ? Doesnt it balance the double quote found after the /c ? Because when there is a space somewhere along the path to the exe, it doesn't work if I don't have the starting 2 double quotes. cmd.exe says that it cannot run the program (it stops at the first space it found). It's like the first double quote was eaten by the run* function. Might be a bug, idk. I'm always trying first with a single double quote, and if it doesn't work, I add a second one and it is working fine then. I thought you were facing the same problem as I have... Edited March 20, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
BlackSnoww Posted March 21, 2019 Author Share Posted March 21, 2019 I figured out where is the problem. I tried hard coding the directories in my Backup.au3 and it works perfectly on the task scheduler. But if i read the Directories from a ini file it wont run. Now i think the task scheduler has issues with my program because if i run the backup.au3 using it it cant find the ini file which is on the same directory but if i manually click the backup.au3 it works like a charm. Anyone has idea why it cant read from the ini file if executed using task scheduler ? Link to comment Share on other sites More sharing options...
Nine Posted March 21, 2019 Share Posted March 21, 2019 Specify the full path for you ini file or make sure you have put in the script folder inside the task scheduler... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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