mojzekinohokker Posted October 18, 2014 Share Posted October 18, 2014 (edited) I'm pretty new in writing scripts so I need help. ( Also sorry for my bad grammar. English isn't my native language) So I would like to accomplish the following : * Automated pressing of a certain button ( key "F5" in my case ) in a certain time. * The pressing of the button must be random between 2 values (4-5 sec in my case ) So far I've come this far and it's even working but the problem is that when I hit the button "F5" to start the loop it begings with 4-5 sec delay. BreakLoop = 0 F5:: If BreakLoop := Not BreakLoop { SetTimer TheLoop, 5000 } Else SetTimer TheLoop, Off Return wheeldown:: BreakLoop = 0 SetTimer TheLoop, Off Send {wheeldown} Return TheLoop: RandomSleep(4500,5000) Send {F5} Return RandomSleep(min,max) { Random, random, %min%, %max% Sleep %random% } How do I get the script to start with the pressing of the button as I hit F5 and only after then the delayed automated pressing ? Edited October 18, 2014 by mojzekinohokker Link to comment Share on other sites More sharing options...
water Posted October 18, 2014 Share Posted October 18, 2014 Welcome to Autoit and the forum! Can you please tell us which program you try to automate? Most of the time there are more reliable ways to automate an application than to press keys. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mojzekinohokker Posted October 18, 2014 Author Share Posted October 18, 2014 It's a program at work used to handle our inventory. It lacks the feature auto refresh. Automated pressing of F5 will do fine for me. Link to comment Share on other sites More sharing options...
water Posted October 18, 2014 Share Posted October 18, 2014 Does this application have a "Refresh" button? Sending a key always goes to the active application. So pressing F5 when there is another application active can lead to undesired results. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mojzekinohokker Posted October 18, 2014 Author Share Posted October 18, 2014 F5 is the Refresh button. This is supposed to be pressed every 4-5 second. My problem is that the cycle begins with the delay not the refresh ! It's nothing major it's just bugs me. How do I fix the scipt ? Link to comment Share on other sites More sharing options...
water Posted October 18, 2014 Share Posted October 18, 2014 The code you posted is not written for AutoIt. I assume it is written for AHK. Do you want to translate your AHK script to AutoIt? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mojzekinohokker Posted October 18, 2014 Author Share Posted October 18, 2014 Damn wrong forum my mistake. I guess I should post there right ? Link to comment Share on other sites More sharing options...
water Posted October 18, 2014 Share Posted October 18, 2014 Correct. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Bert Posted October 18, 2014 Share Posted October 18, 2014 JTLYK - you can use AutoIt to do it though. Several things: 1. Why is an inventory script worried about having the F5 key be random? That is extreamly odd. What happens if it is NOT random? 2. What is the NAME of this "Inventory" program you use at work? I would like to google it and see what it does for my knowledge purposes. 3. Why do you have a mousewheel command in your script? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now