rainaldijt Posted December 27, 2007 Share Posted December 27, 2007 My script that I am running is extremely simple but I am having some problems with it. First of all, let me give you an idea of what I want to do. I want to create an autoit exe to run as a windows scheduled task. The exe simple opens up the command line and then changes directory to the MySQL folder and runs the mysql.exe along with the username and password. On the next step the script Truncates 2 MySQL databases and Imports a new CSV file into the databases. Everything works completely fine when I am logged onto the computer but when I am not logged on the scheduled task will not run. Does anyone have any suggestions, I can really use some right now. Link to comment Share on other sites More sharing options...
GEOSoft Posted December 27, 2007 Share Posted December 27, 2007 My script that I am running is extremely simple but I am having some problems with it. First of all, let me give you an idea of what I want to do. I want to create an autoit exe to run as a windows scheduled task. The exe simple opens up the command line and then changes directory to the MySQL folder and runs the mysql.exe along with the username and password. On the next step the script Truncates 2 MySQL databases and Imports a new CSV file into the databases.Everything works completely fine when I am logged onto the computer but when I am not logged on the scheduled task will not run. Does anyone have any suggestions, I can really use some right now.http://support.microsoft.com/kb/308558 George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
weaponx Posted December 27, 2007 Share Posted December 27, 2007 If you are running XP Pro / 2003 you can try this: 1. Click Start > Programs > Accessories > System Tools > Scheduled Tasks 2. Double click your task and look for for the checkbox that says "Run only if logged on" and make sure its not checked. Link to comment Share on other sites More sharing options...
rainaldijt Posted December 28, 2007 Author Share Posted December 28, 2007 I played around with that setting and made sure it was unchecked but still nothing. I have also read the Scheduled Tasks information. I was wondering if there is something in Autoit that prevents the macros from running when you are not logged into the system. The scheduled tasks works correctly when I am logged on to the computer. When I am logged off or the window isn't active Autoit successfully opens up the cmd.exe but stops after that step. None of the text is sent to the command line.If you are running XP Pro / 2003 you can try this:1. Click Start > Programs > Accessories > System Tools > Scheduled Tasks2. Double click your task and look for for the checkbox that says "Run only if logged on" and make sure its not checked. Link to comment Share on other sites More sharing options...
weaponx Posted December 28, 2007 Share Posted December 28, 2007 Wait, are you trying to use Send() or MouseClick() while logged off? Neither work while logged off. Link to comment Share on other sites More sharing options...
rainaldijt Posted December 28, 2007 Author Share Posted December 28, 2007 I am currently using Send. Is there any other function that will work when logged off.Wait, are you trying to use Send() or MouseClick() while logged off? Neither work while logged off. Link to comment Share on other sites More sharing options...
weaponx Posted December 28, 2007 Share Posted December 28, 2007 ControlSend() ControlClick() Link to comment Share on other sites More sharing options...
rainaldijt Posted December 28, 2007 Author Share Posted December 28, 2007 I just want to say thank you for helping me. I was looking at the documentation on ControlSend() but I guess I am confused on what exactly needs to be added into the parameters. What I am trying to do (using the regular send function):Run("cmd.exe");Send("CD C:\Program Files\MySQL\MySQL Server 5.0\bin\")Send ("{enter}")Send("mysql.exe --user=user --password=password")Send ("{enter}")How would I change to ControlSend() and what do I need to add to the parameters.Thank you again for you help and patience.ControlSend()ControlClick() Link to comment Share on other sites More sharing options...
herewasplato Posted December 28, 2007 Share Posted December 28, 2007 You might not be able to use ControlSend with a command prompt window, but you should be able to start MySQL from the Run() function... but I've not used it so I'm not sure. You can search in the Examples forum for MySQL scripts.You might want to look here also:http://www.autoitscript.com/forum/index.ph...st&p=283230 [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
weaponx Posted December 28, 2007 Share Posted December 28, 2007 ControlSend("[CLASS:ConsoleWindowClass]", "", "", "Hey look, i'm sending text to the command window") Link to comment Share on other sites More sharing options...
herewasplato Posted December 28, 2007 Share Posted December 28, 2007 ControlSend("[CLASS:ConsoleWindowClass]", "", "", "Hey look, i'm sending text to the command window")True - but I could not get that to work while logged off. Admittedly, I did not mention being logged off when I said "You might not be able to use ControlSend with a command prompt window...", but in the context of the thread... Maybe my test was flawed: Run cmd WinWait ControlSend Compiled and made into a scheduled task. Actually, the CMD window never showed up and I stopped chasing that rabbit. [size="1"][font="Arial"].[u].[/u][/font][/size] 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