Obviator Posted May 21, 2010 Posted May 21, 2010 i'm another noob trying out AutoIt and have my first stumbling block. i have many machines to build and have a batch file to configure power settings. It works. i'd like to do it in AutoIt without calling the batch file since i'm already importing a .pow file; the fewer individual files to mess with the better. How would i go about setting up a DOS session that i could feed my lines into? i can do one line, but the way i'm seeing things i'd have to perform multiple DOS sessions to get where i want to go. Thanks! Dave
omikron48 Posted May 21, 2010 Posted May 21, 2010 You can just run the powercfg.exe straight and feed it parameters via the Run function.
Obviator Posted May 22, 2010 Author Posted May 22, 2010 You can just run the powercfg.exe straight and feed it parameters via the Run function. Ok?? This is what i've got so far... #requireadmin ;Vista requirement run(@COMSPEC & " /k" & " powercfg /l") ;Just to see if it's working run("powercfg -?") ;Just to see if it's working run("powercfg /query") ;Another working check i guess what i was expecting to see is one DOS window with the required lines fed in one at a time. What i get is one window that stays open (that's the "/k" one) and two that flash up and go away. Is there a way to do what i expect, one window that the lines feed into? Dave
omikron48 Posted May 22, 2010 Posted May 22, 2010 (edited) Why do you need to feed lines into a DOS window? Isn't your script supposed to be non-interactive and automatically configures power settings? Isn't that supposed to get the job done? The end product would be a compiled AutoIt script that uses powercfg to configure the power settings of the machine it was run on. Edited May 22, 2010 by omikron48
Obviator Posted May 22, 2010 Author Posted May 22, 2010 Yep, non-interactive, push a button or call it and it does it's thing and exits. i'm more used to watching to detect errors, setting break points and such to make sure that everything works correctly. i was expecting AutoIt to provide that facility, much like Kix or batch files. Maybe Kix would be better for this portion and AutoIt for installing other Windows applications before introducing computers to the network. Thanks, Dave
storme Posted May 23, 2010 Posted May 23, 2010 Yep, non-interactive, push a button or call it and it does it's thing and exits. i'm more used to watching to detect errors, setting break points and such to make sure that everything works correctly. i was expecting AutoIt to provide that facility, much like Kix or batch files. Maybe Kix would be better for this portion and AutoIt for installing other Windows applications before introducing computers to the network. Thanks, Dave If it's important that you see what is going on then create a batch file with a similar name to the program you want to run. e.g. powercfg_test.bat powercfg %1 %2 %3 %4 %5 Pause This will run the command then PAUSE for you to see what is going on. When you are sure it's working then use the main programs name instead of the batch file. Also I'd suggest to use ShellExecute/ShellExecuteWait as it's a closer to how batch files execute commands (as I understand it). If you just want simple dumb scripts then BATCH is the way to go but if you want to add "intelligence" to the script then AutoIT is defiantly the best choice. Good Luck Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E
Obviator Posted May 24, 2010 Author Posted May 24, 2010 Thanks Storme. i've got LOTS of experience (20+ years really) with .BAT files, a little with Kix, and none with AutoIt. That's part of the reason i wanted to watch what the files actually did. For debugging i want to watch to ensure everything's done that i want done, after it's all worked out i really don't mind if it doesn't show much as long as i know it's doing it's thing. i found AutoIt by accident and thought a "simple dumb script" would be the best first step. i'll keep plugging along, thanks for the assist! Dave
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