clivebuckwheat Posted February 6, 2011 Posted February 6, 2011 (edited) I am one day deep into the world of Autoit and I have to tell you I am loving the power this program has. I need your help if possible. I need help with an autoit script, I wrote. Basically what it does is run a few cscript commands to start a service and activate office 2010, also resets the Administrator password via control userpasswords2 I'd like to wait until each command is done, before going on to the next, I opted to use Runwait. lastly it opens word 2010 to check the activation status. My Auto it script #include <Process.au3> Run('control userpasswords2') WinWait("User Accounts","") Send("{SPACE}{SPACE}{TAB}{TAB}{TAB}{ENTER}") Send("password{SHIFTDOWN}?{SHIFTUP}{TAB}password{SHIFTDOWN}?{SHIFTUP}{TAB}{ENTER}") Send("{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}") RunWait (@COMSPEC & " /k start w32tm /resync /nowait") RunWait (@COMSPEC & " /k start cscript "%Program Files\Microsoft Office\Office14\ospp.vbs" /osppsvcrestart) RunWait (@COMSPEC & " /k start cscript "%ProgramFiles%\Microsoft Office\Office14\ospp.vbs" /act) Run('C:\Program Files\Microsoft Office\Office14\Winword.exe') WinWait("Document1 [Compatibility Mode] - Microsoft Word","") Send("{ALTDOWN}f{ALTUP}h") The errors on compile. C:\Documents and Settings\Administrator\Desktop\AutoIt Scripts\FixLocalAutoAdminLoginStudent.au3(8,41) : ERROR: syntax error (illegal character) RunWait (@COMSPEC & " /k start cscript "% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\Administrator\Desktop\AutoIt Scripts\FixLocalAutoAdminLoginStudent.au3(9,41) : ERROR: syntax error (illegal character) RunWait (@COMSPEC & " /k start cscript "% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ Edited February 6, 2011 by clivebuckwheat
rudi Posted February 9, 2011 Posted February 9, 2011 Hi.Welcome to the forum!I assume, that you do NOT use the Autit Customized SciTE Editor -- because it is offering syntax highlighting, showing you very clearly where your typos are (exactly where you posted it yourself).Go to the autoit download section and get SciTE from there. using "autoit" in squared brackets (see below) will already give you some coloured syntaxing, helping you to see the mistake, doesn't it?#include <Process.au3> Run('control userpasswords2') WinWait("User Accounts","") Send("{SPACE}{SPACE}{TAB}{TAB}{TAB}{ENTER}") Send("password{SHIFTDOWN}?{SHIFTUP}{TAB}password{SHIFTDOWN}?{SHIFTUP}{TAB}{ENTER}") Send("{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}") RunWait (@COMSPEC & " /k start w32tm /resync /nowait") RunWait (@COMSPEC & " /k start cscript "%Program Files\Microsoft Office\Office14\ospp.vbs" /osppsvcrestart) RunWait (@COMSPEC & " /k start cscript "%ProgramFiles%\Microsoft Office\Office14\ospp.vbs" /act) Run('C:\Program Files\Microsoft Office\Office14\Winword.exe') WinWait("Document1 [Compatibility Mode] - Microsoft Word","") Send("{ALTDOWN}f{ALTUP}h")In the autoit help file, you might want to have a look at "ControlCommand()" and the MACROS, (autoit help file, folder "Macro Reference"...)Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
readmedottxt Posted February 9, 2011 Posted February 9, 2011 (edited) What Rudi said, get the proper editor #include <Process.au3> Run('control userpasswords2') WinWait("User Accounts","") Send("{SPACE}{SPACE}{TAB}{TAB}{TAB}{ENTER}") Send("password{SHIFTDOWN}?{SHIFTUP}{TAB}password{SHIFTDOWN}?{SHIFTUP}{TAB}{ENTER}") Send("{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}") RunWait (@COMSPEC & ' /k start w32tm /resync /nowait') RunWait (@COMSPEC & ' /k start cscript "%Program Files\Microsoft Office\Office14\ospp.vbs" /osppsvcrestart') RunWait (@COMSPEC & ' /k start cscript "%ProgramFiles%\Microsoft Office\Office14\ospp.vbs" /act') Run('C:\Program Files\Microsoft Office\Office14\Winword.exe') WinWait("Document1 [Compatibility Mode] - Microsoft Word","") Send("{ALTDOWN}f{ALTUP}h") Edited February 9, 2011 by readmedottxt
rudi Posted February 10, 2011 Posted February 10, 2011 Hi. What Rudi said, get the proper editor When you correct lines in sample code, it might be helpful to remove ALL typos. ; either "%programfiles%" (instead of "%program files") RunWait (@COMSPEC & ' /k start cscript "%ProgramFiles%\Microsoft Office\Office14\ospp.vbs" /osppsvcrestart') ; or use the Autoit Macro RunWait (@COMSPEC & ' /k start cscript "' & @ProgramFilesDir & '\Microsoft Office\Office14\ospp.vbs" /osppsvcrestart') Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
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