Sign in to follow this  
Followers 0
AmitPatel

[Help] Want to make timer based automation

24 posts in this topic

Hi,

I want to make a script in which I want to add a countdown timer for 30 secs, after which if there is no user input ( mouse movement or keyboard inputs ) then it automatically loads specified program after 30 seconds!

countdown text should be shown at bottom right corner of my autoit app.

Its a simple script but I m new to autoit so dont know how to do that :D. can anyone help me out?

example:

I want to run following program after 30 seconds if there is no user input

x:\setup.exe

waiting for someone's help :D.

Share this post


Link to post
Share on other sites



To check for no user input (mouse and keyboard) you could use something like:

#Include <Timers.au3>
If _Timer_GetIdleTime() > 30000 Then "<run your exe>"
Else "<show counter>"
EndIf

How to show the counter depends where you want it to be displayed: In your GUI, in the system tray ...


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

thanks so much for fast reply.

@water, I want to display timer in my GUI ( bottom right corner ). can u edit ur example script with showing how to display timer ?

Thanks again.

Share this post


Link to post
Share on other sites

thanks so much for fast reply.

@water, I want to display timer in my GUI ( bottom right corner ). can u edit ur example script with showing how to display timer ?

Thanks again.

Why don't you try it yourself?

Share this post


Link to post
Share on other sites

Okey, I tried following,

If _Timer_GetIdleTime() > 30000 Then Run ("X:\startsetup.cmd" )

else "<show counter>"

EndIf

Its giving me error

ERROR: syntax error

else

I m noob at scripting so sorry for trouble.

Share this post


Link to post
Share on other sites

np, I will try it myself now Mr.MVP. I m among those ppl who are noobs at scripting, you could react better, anyways let others help me out if you dont mind :D.

I have expertise in my own field as u have in ur own, I wouldnt react lyk this with anyone who wants to learn!! :D

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

okey, I m searching forums for my answer. thanks for ur quicky replies :D

Share this post


Link to post
Share on other sites

np, I will try it myself now Mr.MVP. I m among those ppl who are noobs at scripting, you could react better, anyways let others help me out if you dont mind :D.

I have expertise in my own field as u have in ur own, I wouldnt react lyk this with anyone who wants to learn!! :D

AmitPanel, I was once a noob on this forum too, without any expertise in any field at all. You have a head start on me, so to speak. I can remember though, actually I can just look it up, that I made a considerate effort into all the questions I asked on this forum. Efforts that took longer than 3 minutes.

You're not here to learn, you're here just to find someone to write whatever you want for you. You're a leech, and a bad one at it.

Share this post


Link to post
Share on other sites

I m not leecher, I searched google before registering over here. I want someone's help because its a litle script help i want, otherwise rest of the script part I have made myself!! I also have read autoIT help file but didnt find "_Timer_GetIdleTime()" function in help file! you see yourself if you can find this function in help! otherwise I wuldnt disturb anyone. I didnt want to waste time on just little part of my script so I asked for help.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Okey, I tried following,

Its giving me error

ERROR: syntax error

else

I m noob at scripting so sorry for trouble.

I didnt want to waste time on just little part of my script so I asked for help.

You lying. Edited by Yashied

Share this post


Link to post
Share on other sites

If _Timer_GetIdleTime() > 5000 Then

run ("C:\Windows\System32\taskmgr.exe")

EndIf

above worked without error, but it didnt execute "taskgr.exe" :D.

Share this post


Link to post
Share on other sites

I m noob at scripting so sorry for trouble.

You lying.

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

above worked without error, but it didnt execute "taskgr.exe" :D.

Look at

While 1
...
WEnd

EDIT:

If _Timer_GetIdleTime() > 5000 Then
    Run("C:\Windows\System32\taskmgr.exe")
EndIf

Insert this in the loop.

Edited by Yashied

Share this post


Link to post
Share on other sites

Look at

While 1
...
WEnd

EDIT:

If _Timer_GetIdleTime() > 5000 Then
    Run("C:\Windows\System32\taskmgr.exe")
EndIf

Insert this in the loop.

Thanks I did following and worked :D

While 1

If _Timer_GetIdleTime() > 5000 Then

run ("C:\Windows\System32\taskmgr.exe")

EndIf

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Share this post


Link to post
Share on other sites

I still need help displaying timer countdown at bottom-right corner of my GUI, any tips for it plz? :D

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I still need help displaying timer countdown at bottom-right corner of my GUI, any tips for it plz? :D

Look at GUICtrlCreateLabel(), and use the GUICtrlSetData() in the loop.

EDIT:

_Timer_GetIdleTime() returns an integer ticks since last (approx. milliseconds) since last activity.

Edited by Yashied

Share this post


Link to post
Share on other sites

u mean like this?

While 1

GUICtrlSetData($Label2, _Timer_GetIdleTime)

If _Timer_GetIdleTime() > 5000 Then

run ("C:\Windows\System32\taskmgr.exe")

EndIf

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

It didnt work however, syntax error again! ( label2 is what I want to update as countdown time ).

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  
Followers 0