Jump to content
Sign in to follow this  
yogesh87

Sleep with other operations

Recommended Posts

yogesh87

Hi All

I am very new to autoit programming

started my script just today, i have successfully created a program of my own with the help n forums, it works perfectly fine

But i want to repeat the operation after 3 hrs for which i will use sleep

but while it is sleeping i want it to switch to other operations, i am not finding a script for this please help me with this

Sorry for my bad english

Regards,

Yogesh

PS: srry if i posted in wrong section feel free to move the thread n leave a reply so that i can post my question there

Edited by yogesh87

Share this post


Link to post
Share on other sites
Melba23

yogesh87,

Welcome to the AutoIt forum. :)

As you have discovered, Sleep pauses the script completely. I suggest you look at TimerInit/TimerDiff in the Help file - using them will allow your script stay active and still react after the correct time period. Give it a go yourself - you know where we are if you run into difficulties. ;)

M23

P.S. And I moved your thread into the correct place. ;)

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
yogesh87

:bye: Thx for the fast reply :thumbsup:

i actually dont get how it works, can you please explain how it works

would also like to know how i could incorporate internet explorer to my program so that i can run my program even if it is minimized and is there is a command where I could pause the script and resume it where it was paused

srry if i asked too many questions, since i am new have lots of doubts will try to find answers myself or post here o:)

Share this post


Link to post
Share on other sites
Melba23

yogesh87,

This should explain how to use TimerInit/TimerDiff: :)

#include <GUIConstantsEx.au3>
#include <Constants.au3>

$hGUI = GUICreate("Test", 500, 500)

$cButton = GUICtrlCreateButton("Test", 10, 10, 80, 30)

GUISetState()

; Run the timed function
_Timed_Function()
; Get a timestamp
$nBegin = TimerInit()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            ; The button will still be active while you wait
            MsgBox($MB_SYSTEMMODAL, "Hello", "I work all the time!")
    EndSwitch

    ; Check the timestamp and see if the required time has elapsed
    If TimerDiff($nBegin) > 1000 * 10 Then ; This is a 10 sec delay
        ; Run the timed function
        _Timed_Function()
        ; Reset the timestamp
        $nBegin = TimerInit()
    EndIf
WEnd

Func _Timed_Function()
    MsgBox($MB_SYSTEMMODAL, "Hi!", "Timed function")
EndFunc
As for your other questions:

 

- 1. Look at the IE Management functions in the Help file - they let you control IE from your script. :)

- 2. Pause and Resume - this has been asked (and answered) many, many times on the forum. Use the Search facilty at top right and you will soon see how it is done. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  

×