Jump to content

[Help] Want to make timer based automation


AmitPatel
 Share

Recommended Posts

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.

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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

Link to comment
Share on other sites

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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 ).

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...