Jump to content
Tommy Chang

I NEED SOME HELP

Recommended Posts

Tommy Chang

I write a script by the AutoIt3 as below, but I can't run it. Anyone who can help me to solve it and correct it? THX!

#RequireAdmin
#NoTrayIcon
HotKeySet("a", "Action")
HotKeySet("{Esc}", "_Exit")

Func _Exit()
    Exit
EndFunc

Func Action()
    Send("4")
    If MouseClick("left") Then 
         Send("q")
         MouseClick("left")
    EndIf
EndFunc

Edited by Tommy Chang

Share this post


Link to post
Share on other sites
Tommy Chang

You're going to have to do better than that.

EDIT: meanwhile, add a while loop.

but add it in where? Can you add it for me, I am a new hand so I really need some help..

Edited by Tommy Chang

Share this post


Link to post
Share on other sites
JohnOne
#RequireAdmin
#NoTrayIcon
HotKeySet("a", "Action")
HotKeySet("{Esc}", "_Exit")

While 3
    Sleep(333)
WEnd

Func _Exit()
    Exit
EndFunc

Func Action()
    Send("4")
    If MouseClick("left") Then 
         Send("q")
         MouseClick("left")
    EndIf
EndFunc

 


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
InunoTaishou

It's running, in fact I wager that it's working EXACTLY how it's been written to run, it's just not working how you want it to.

Breaking it down, line by line.

Set a hot key

Set a hot key

Create a Function, calling this function exits the script

Create a Function, calling this function sends and clicks

No where in your script do you define a loop that prevents the script from closing. An infinite while loop, or a loop with a condition that causes the loop to not exit until a condition is met, will prevent the script from closing.

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

Could you please give meaningful titles to your threads? Everyone on this forum is looking for help ;)
The better you describe your problem in the title the more people will read the thread and the more help you will get.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - 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

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

×