HankRausch Posted December 5, 2012 Posted December 5, 2012 Hello, I am trying to run this script unattended, it works fine when logged in but not when not logged in. I know it has something to do with the console window and have also tried "ControlSend" commands but nothing works. I have run scripts like this before using batch files and those work, the thing that is different for me this time is console window is taking commands from the script. The script runs a batch file which sends snmpget queries and populates a set of files, and then makes an insert statement into a database.. Thanks in advance for any help. $i=0 While $i<10 $i=1 run("log.bat") Sleep (5000) $m1log1= FileRead ("m1log1.txt") $m1log2= FileRead ("m1log2.txt") $m1log3= FileRead ("m1log3.txt") $m1log4= FileRead ("m1log4.txt") $m1log5= FileRead ("m1log5.txt") $m1log6= FileRead ("m1log6.txt") $m2log1= FileRead ("m2log1.txt") $m2log2= FileRead ("m2log2.txt") $m2log3= FileRead ("m2log3.txt") $m2log4= FileRead ("m2log4.txt") $m2log5= FileRead ("m2log5.txt") $m2log6= FileRead ("m2log6.txt") ;enter database Run("db.bat") Sleep (500) Send ("{ENTER}") sleep (15000) ;insert for m1 Send ("insert into LOG (datetime,modem,log1,log2,log3,log4,log5,log6) values (now(),'Det1&2','"&($m1log1)&"','"&($m1log2)&"','"&($m1log3)&"','"&($m1log4)&"','"&($m1log5)&"','"&($m1log6)&"');") Send ("{ENTER}") sleep (3000) ;insert for m2 Send ("insert into LOG (datetime,modem,log1,log2,log3,log4,log5,log6) values (now(),'Det3','"&($m2log1)&"','"&($m2log2)&"','"&($m2log3)&"','"&($m2log4)&"','"&($m2log5)&"','"&($m2log6)&"');") Send ("{ENTER}") sleep (3000) ;exit database ;Send ("exit") ;Send ("{ENTER}") Winclose ("D:\nrl\cmd.exe") sleep (60000) wend Note: the db.bat batch file logs into the database: ; mysql.exe -h 10.10.10.10 -u user -ppassword -D database
water Posted December 5, 2012 Posted December 5, 2012 Why don't you do everything (db.bat) in AutoIt? Then there would be no need to use Send. AutoIt works fine with MySQL. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
HankRausch Posted December 5, 2012 Author Posted December 5, 2012 Thanks, I have looked through the forum but have not found any relevant examples, can you direct me to any?
DicatoroftheUSA Posted December 6, 2012 Posted December 6, 2012 (edited) When you are not logged on, any gui interaction function will fail including control send. A better way to go is through one of the database UDFs for direction manipulation. I think most of the popular DB's have UDF's. Edited December 6, 2012 by DicatoroftheUSA Statism is violence, Taxation is theft. Autoit Wiki
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