Jump to content
Sign in to follow this  
Earthur X

Run a MsgBox Script on a Repeating Schedule?

Recommended Posts

I just started hunting around tonight for a resource to create a message box and found AutoIT. I know doodly squat about scripting but, following the help file, I created the MsgBox I wanted, with associated Alarm. It took me about six minutes of research and futzing around to get it to work right.

YAY me! :lmao:

Anyway, the script performs the desired action when clicked, but what I want it to do is perform this action once an hour, on the hour, between the hours of 9:00 pm and 6:00 am Wednesday through Saturday. I tried pointing Task Scheduler at it, even though I hate feeding precious CPU cycles into mstask, and usually don't let it run. The log reports the following:

"Call In.job" (Call In.au3) 1/29/05 3:00:02 AM ** ERROR **

Unable to start task.

The specific error is:

0x80070002: The system cannot find the file specified.

Try using the Task page Browse button to locate the application.

It is pointed at the proper file, though I have to select All Files when browsing for it. I didn't think this would be a problem as I've had Scheduler run *.txt files without a hitch.

I'd rather be able to pull this off without Task Scheduler involved at all, as the machine I want to run it on is a 366 pII win98SE notebook with 64 mb of ram and any background apps that don't have to be run, I'd rather not run.

Here's the original script:

SoundSetWaveVolume(100)

SoundPlay ("C:\AutoIT Scripts\alarm.WAV")

; Make Your Call In!

MsgBox(0, "Call In Alert", "Make Your Call In!")

Any help is very much appreciated

Earthur X

Share this post


Link to post
Share on other sites

Is this an AU3 file format or a compiled executable? The latter maybe more easy to do, but the AU3 file format would need Autoit3.exe, in the commandline, to run it.

Share this post


Link to post
Share on other sites

To leave it in uncompiled format, you are going to have to call autoit3.exe.

Like e.g.

"C:\Program Files\Autoit3\Autoit3.exe" "Call In.au3"

Share this post


Link to post
Share on other sites

Now, is there any way to set it up without the need to run Task Scheduler?

<{POST_SNAPBACK}>

i'm also interested in such kind of stuff

i first thought about sleep($t) AutoIt3 function but found that CPU cycles are used (roughly 2% on a P4 2.6) not that much actally - but still there :) !

o:) i'm now thinking about using system's sleep() function within KERNEL32.DLL (may be just set a timer, and don't use cpu cycle)

i think everything is there in autoIt to do that thu DLLCall.

i'm just wondering if this is a good track to follow, somebody may have a better clue!!

If not i'd like to find how to call this function (parameters etc...)

EDIT on>: i've find it on the MS support site still be happy with the following <EDIT off

and have identified drawbacks or cares to take (could be "touchy" isn't it?)

There should be some help site somewhere that somebody could know know!!

then i'll try on my own :lmao:

I know this not really an AutoIt question, anyway it could help others if i find a solution which i could share later on

Lupus

Edited by lupusbalo

Share this post


Link to post
Share on other sites

BOOM!

That works!

Thank you very much!

Now, is there any way to set it up without the need to run Task Scheduler?

<{POST_SNAPBACK}>

you could write it in the registry to make it startup. check the time macro's for the correct time with an IF statement. and when it matches you let it execute the msgbox code. put the whole thing in an infinite loop with like a wait of 1 minute between checks.

hope you understanded me :lmao:


My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites

:lmao: i'm now thinking about using system's  sleep() function within KERNEL32.DLL (may be just set a timer, and don't use cpu cycle)

<{POST_SNAPBACK}>

(replying my onw post):

i actually tested "sleep" function from KERNEL32.DLL

DllCall("KERNEL32.DLL","none","Sleep","int",60000)

works fine no CPU load :) just o:)

seems very promising for scheduling tasks, at regular intervals or specific time

caution:during sleep the script cannot be "exited", only "killed"

no other noticeable drawbacks

lupus

Edited by lupusbalo

Share this post


Link to post
Share on other sites

you could write it in the registry to make it startup. check the time macro's for  the correct time with an IF statement. and when it matches you let it execute the msgbox code. put the whole thing in an infinite loop with like a wait of 1 minute between checks.

hope you understanded me  :lmao:

<{POST_SNAPBACK}>

Erm... My Hovercraft is full of eels. o:) Edited by Earthur X

Share this post


Link to post
Share on other sites

Hey guys,

here is a scheduler in autoit :lmao:

Scheduler.zip

#include <GuiConstants.au3>

#Include <date.au3>

Dim $Arr_Time

Dim $Arr_Date

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Scheduler", 300, 70,(@DesktopWidth-300)/2, (@DesktopHeight-70)/2, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_MINIMIZEBOX + $WS_VISIBLE + $WS_CLIPSIBLINGS, $WS_EX_ACCEPTFILES)

$Date_1 = GuiCtrlCreateDate("", 10, 10, 82, 20, $DTS_SHORTDATEFORMAT)

$Date_2 = GuiCtrlCreateDate("",  102, 10, 70, 20, $DTS_TIMEFORMAT )

$Input_3 = GuiCtrlCreateInput("File", 10, 40, 180, 20)

GUICtrlSetState ( $Input_3, $GUI_ACCEPTFILES )

$Button_4 = GuiCtrlCreateButton("Ready", 230, 10, 60, 20, $BS_DEFPUSHBUTTON )

$Button_5 = GuiCtrlCreateButton("Cancel", 230, 40, 60, 20)

$Button_6 = GuiCtrlCreateButton("...", 200, 40, 20, 20)

$Button_7 = GuiCtrlCreateButton("Help", 182, 10, 38, 20)

GuiSetState()

While 1

  $msg = GuiGetMsg()

  Select

    Case $msg = $GUI_EVENT_CLOSE

      ExitLoop

    Case $msg = $Button_6

      $Prog = FileOpenDialog("Choose Program", "C:\Windows\", "Progz (*.exe)", 1+2)

      If  Not @error Then GUICtrlSetData($Input_3, $Prog)

    Case $msg = $Button_5

      ExitLoop

Case $msg = $Button_7

MsgBox (4096, "Help", "HowTo:" & @CRLF  & @CRLF & "1. Choose date and time!" & @CRLF & "2. Choose file to run!" & @CRLF & "3. Enjoy It" & @CRLF & @CRLF & @CRLF & "© Cyclops 2005")

Case $msg = $Button_4 ;Fertig

  AdlibEnable("timecheck", 1000)

  $Arr_Time = StringSplit(GUICtrlRead($Date_2), ":")

  $Arr_Date = StringSplit(GUICtrlRead($Date_1), ".")

  GUISetState (@SW_HIDE )

   EndSelect

WEnd

Exit

Func timecheck()

    If @YEAR = $Arr_Date[3]AND @MON = $Arr_Date[2] AND @MDAY = $Arr_Date[1] Then

        If  @HOUR = $Arr_Time[1] AND @MIN = $Arr_Time[2] AND @SEC = $Arr_Time[3] Then

            Run (GUICtrlRead($Input_3), "", @SW_SHOWNORMAL)

   Exit

  EndIf

    EndIf

EndFunc

Edited by Cyclops

Sorry for my cruel english :D

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...