Jump to content

I NEED SOME HELP


Recommended Posts

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

#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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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...