dexter Posted December 1, 2009 Posted December 1, 2009 Hi ! I am new to autoIt. I had made a program in DOS for scheduling tasks, using JT.exe . What the program did was take user inputs and schedule a task. The command in DOS was - JT /snj %taskname% /sc %username% %password% /ctj startdate=today starttime=%timeout% type=%freq% /sj applicationname="%windir%\connect.bat" DontStartIfOnBatteries=0 KillIfGoingOnBatteries=0 SystemRequired=1 DeleteWhenDone=1 /stj disabled=0 >>nul If I use _runDOS to run this command in AutoIt, how can i ask for user input for taskname, account password, running time etc and pass it on to command inside _runDOS ? Plz give a sample script and explain it, since Iam new. Also, I can use a good tutorial or book to learn autoIT.
Mobius Posted December 1, 2009 Posted December 1, 2009 Hi and welcome dexter,If you are looking for a nice method to receive input through the command shell (not with rundos) check out this post. (example included)In order to create a true command shell program with AutoIt3 you need to tell the supplied source to executable converter (Aut2Exe) that this is your intention, which can be achieved through its interface or at the commandline or most popular is through AutoItWrapper directives.Of course you don't have to make a console program with AutoIt3 to wrap this other program, you could build a Gui, or have a simple inputbox driven interface or a myriad of other ways to get and set this data before passing it on to this other program.so.... There is a good AutoIt3 tutorial here. And the best way to learn AutoIt3 is the supplied help file, oh and this forum.Just curious but are you using runDOS because you need this command shell specific redirection switch?JT /snj %taskname% /sc %username% %password% /ctj startdate=today starttime=%timeout% type=%freq% /sj applicationname="%windir%\connect.bat" DontStartIfOnBatteries=0 KillIfGoingOnBatteries=0 SystemRequired=1 DeleteWhenDone=1 /stj disabled=0 >>nulOr because 'JT.exe' is a console program? Or because of the environment variable usage?Vlad
jerem488 Posted December 1, 2009 Posted December 1, 2009 Hi ! I am new to autoIt. I had made a program in DOS for scheduling tasks, using JT.exe . What the program did was take user inputs and schedule a task. The command in DOS was - JT /snj %taskname% /sc %username% %password% /ctj startdate=today starttime=%timeout% type=%freq% /sj applicationname="%windir%\connect.bat" DontStartIfOnBatteries=0 KillIfGoingOnBatteries=0 SystemRequired=1 DeleteWhenDone=1 /stj disabled=0 >>nul If I use _runDOS to run this command in AutoIt, how can i ask for user input for taskname, account password, running time etc and pass it on to command inside _runDOS ? Plz give a sample script and explain it, since Iam new. Also, I can use a good tutorial or book to learn autoIT. First, welcome to the AutoIt comunity and for your question, here is a proposition : #include <GUIConstantsEx.au3> #include <Process.au3> GUICreate(" My GUI input acceptfile", 320, 120) GUICtrlCreateLabel("Taskname : ", 10, 10) $Taskname = GUICtrlCreateInput("", 80, 5, 230, 20) GUICtrlCreateLabel("Password : ", 10, 35) $Password = GUICtrlCreateInput("", 80, 35, 230, 20) $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState() $_Taskname = GUICtrlRead($Taskname) $_Password = GUICtrlRead($Password) If $_Taskname <> "" And $_Password <> "" Then _RunDOS('JT /snj %' & $_Taskname & '% /sc %username% %' & $_Password & '% /ctj startdate=today starttime=%timeout% type=%freq% /sj applicationname="%windir%\connect.bat" DontStartIfOnBatteries=0 KillIfGoingOnBatteries=0 SystemRequired=1 DeleteWhenDone=1 /stj disabled=0 >>nul') EndIf $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn ExitLoop EndSelect WEnd MsgBox(0, "Info", GUICtrlRead($Taskname) & @CRLF & GUICtrlRead($Password)) Qui ose gagneWho Dares Win[left]CyberExploit[/left]
dexter Posted December 2, 2009 Author Posted December 2, 2009 First, welcome to the AutoIt comunity and for your question, here is a proposition : #include <GUIConstantsEx.au3> #include <Process.au3> GUICreate(" My GUI input acceptfile", 320, 120) GUICtrlCreateLabel("Taskname : ", 10, 10) $Taskname = GUICtrlCreateInput("", 80, 5, 230, 20) GUICtrlCreateLabel("Password : ", 10, 35) $Password = GUICtrlCreateInput("", 80, 35, 230, 20) $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState() $_Taskname = GUICtrlRead($Taskname) $_Password = GUICtrlRead($Password) If $_Taskname <> "" And $_Password <> "" Then _RunDOS('JT /snj %' & $_Taskname & '% /sc %username% %' & $_Password & '% /ctj startdate=today starttime=%timeout% type=%freq% /sj applicationname="%windir%\connect.bat" DontStartIfOnBatteries=0 KillIfGoingOnBatteries=0 SystemRequired=1 DeleteWhenDone=1 /stj disabled=0 >>nul') EndIf $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn ExitLoop EndSelect WEnd MsgBox(0, "Info", GUICtrlRead($Taskname) & @CRLF & GUICtrlRead($Password)) Hey, thanks a lot for quick and effective replies! I specifically need to run this command, since I can set wake up option only while using this JT.exe, which aint possible with schtasks or AT. Thanks a lot Jerem, your tip clarifies my doubt, I havnt tried it though, give try it and get back. @Vlad - Thanks for the tutorials and tips. Yes, like I said above, I need this JT.exe and yes, it is a console program. What I actually plan to do is make a GUI to take user inputs like date and time of task, application to run, and also I need to know the account user name and password to feed to Jt.exe. Any tips for GUI ?
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