kawliga751

schtasks to run script at set time every weekday

2 posts in this topic

#1 ·  Posted

I am attempting to run an Autoit.exe with schtasks every weekday @ 9:05 am.

I have the below

C:\>SchTasks /Create /TN "P10Run" /TR "O:\AUTOIT\P40 Run.au3" /SC WEEKLY /D MON,
TUE,WED,THU,FRI /ST 09:05:00
SUCCESS: The scheduled task "P10Run" has successfully been created.

I also did a "test" run :

C:\>Schtasks /Run /TN "P10Run
SUCCESS: Attempted to run the scheduled task "P10Run".

But when I run my query to verify success my "Last Result" seems to indicate that the script did not run:

C:\>SCHTASKS /QUERY /FO LIST /V /TN "P10RUN"

Folder: \
HostName:                             xxxxxxxxxxxxxxxx
TaskName:                             \P10RUN
Next Run Time:                        N/A
Status:                               Could not start
Logon Mode:                           Interactive only
Last Run Time:                        6/14/2017 9:08:56 AM
Last Result:                          -2147024894
Author:                               xxxxxxx
Task To Run:                          O:\AUTOIT\P40 Run.au3
Start In:                             N/A
Comment:                              N/A
Scheduled Task State:                 Enabled
Idle Time:                            Disabled
Power Management:                     Stop On Battery Mode, No Start On Batterie
s
Run As User:                          xxxxxxxxx\xxxxxxxx
Delete Task If Not Rescheduled:       Enabled
Stop Task If Runs X Hours and X Mins: 72:00:00
Schedule:                             Scheduling data is not available in this f
ormat.
Schedule Type:                        Weekly
Start Time:                           9:05:00 AM
Start Date:                           6/14/2017
End Date:                             N/A
Days:                                 MON, TUE, WED, THU, FRI
Months:                               Every 1 week(s)
Repeat: Every:                        Disabled
Repeat: Until: Time:                  Disabled
Repeat: Until: Duration:              Disabled
Repeat: Stop If Still Running:        Disabled

C:\>

Is there something missing in my command? Also is there a better way to make sure that the script does in fact sun successfully?

Thanks In Advance! 

Share this post


Link to post
Share on other sites



#2 ·  Posted

As far as confirming your script runs as it should (or doesn't), why not use the Windows standard and write out to the Event Viewer? There are a ton of examples throughout the forum for doing so.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning everyone
      I worked a bit on a little project of mine, and I managed to do what I was trying to do, or, automate a quiz in AutoIt.
      Now, everything works fine but, in order to achieve what I'm trying to achive, I'd like to make this script run faster.
      I'll attach a portion of the code in order to let you understand what my script does.
      $objIE_h1 = _IETagNameGetCollection($objIE, "h1") ; Take the text of the answer If @error Then ConsoleWrite("Errore durante la lettura degli h1 nella pagina. - Errore: " & @error & @CRLF) Else For $objElement In $objIE_h1 $strInnerText = $objElement.innerText Next Select Case StringInStr($strInnerText, "QUESTION") ; Here is the question ; PS4 PRO $objSpans = _IETagNameGetCollection($objIE, "span") ; Answers are stored here For $objElement In $objSpans If $i >= 4 Then $strAnswer = $objElement.innerText ; Take the text of the answer n° 0, 1, 2, 3 If StringInStr($strAnswer, "CORRECT ANSWER") Then ; If I match the correct answer, then, I have to click on the input with answer id = answer_i $j = $i - 4 $objInput = _IEGetObjById($objIE, "answer_" & $j) If @error Then ConsoleWrite("Errore durante la lettura della risposta #" & $i & " - Errore: " & @error & @CRLF) Else _IEAction($objInput, "click") If @error Then ConsoleWrite("Errore durante il click sull'elemento. - Errore: " & @error) Else ConsoleWrite($j & ") Risposta: " & $strAnswer & @CRLF) ExitLoop EndIf EndIf EndIf $i+=1 Else $i+=1 EndIf Next $i = 0 $j = 0 This is what my script does.
      Questions are 20, in which I have 15 multiple choice question, 2 images ( on which I use _IEImgClick() ), and 3 text inputs ( a simple send with the text I have to enter ).
      How can I make all of these, faster?
      If I reach this goal, I've probably done one of my best goals in life, and I'd like to share my happiness with you, giving a huge donation to this fantastic community!
      Thanks for your help
    • au3leecher
      By au3leecher
      Hellow everybody,
      I tryed to manipulate a game called "Assault Cube" which is a easy beginning in coding. I run the code but the wished value doesn't change, i don't understand why.
      The Pointers are fine, I checked that the pointers don't change every time while restart the game.
      My Code:
      <snip>
      _____________________________________________________________________________________________________________________________________________________________________________________________
      Checklist:
      The Offsets are 18C & 4
      In Cheat Engine: ("ac_client.exe"+0010F418) <- Pointer
      4 Bytes = 'dword'
       
    • rootx
      By rootx
      I need help to understand why the run function does not work, but if i use it directly inside cmd shell the command works. $where is the name of the jpg file
      ShellExecute(@ComSpec ," /k C:\Users\root\Desktop\test\exiftool.exe -p $FileName "&'"'&$where&'"'&" > "&'"'&@ScriptDir&"\out.txt"&'"',@ScriptDir);<----- work Run("C:\Users\root\Desktop\test\exiftool.exe -p $FileName "&$where&" > "&@ScriptDir&"\out.txt",@ScriptDir);<--- doesn't work I would use the run command!
      Thx
    • nacerbaaziz
      By nacerbaaziz
      Hello
      How are you
      I have a question, please.
      I've created a window and i need
      when i run the script if it detect an other copy from the same script was runing
       the script close the first copy Automatically and run a new copy
      I want an example to understand it