Jump to content

Send Multiple Commands with A single HotKeySet if Window IS Active


Recommended Posts

Okay ive been googling and looking through here site:autoitscript.com and I cant find the answers not sure if im just not using the right keywords or what (im new to autoit).

 

What I am trying to do is set a HotkeySet and when that key is pressed to send 3 separate commands, First (ctrl+alt+shift+e) / 2nd, THEN send Mouseclick(181, 305, 1)/  3rd, THEN send('2') /

So with a single key would like it to function 3 separate commands/scripts.
 

teh script i have works for the first command, I just dont know how to append the 2nd and 3rd to it.

 

#include <AutoItConstants.au3>

HotKeySet("{ESC}", "AltF5")

Func AltF5()
    If WinActive('Program X')   Then Send('^!+e') MouseClick($MOUSE_CLICK_LEFT, 181, 305, 1) Send('2')
    EndFunc

 

Edited by JuanLopez
Link to comment
Share on other sites

  • Moderators

Look at the example for If...Then in the help file. You just need to perform the actions one after another:

If WinActive("My Program") Then
   ;Perform Step 1
   ;Perform Step 2
   ;Perform Step 3
EndIf

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

#include <AutoItConstants.au3>

HotKeySet("{ESC}", "AltF5")

Func AltF5()
    If WinActive('Program X') Then
        Send('^!+e')
        MouseClick($MOUSE_CLICK_LEFT, 181, 305, 1)
        Send('2')
    EndIf    
EndFunc

 

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
Share on other sites

1 hour ago, JLogan3o13 said:

Look at the example for If...Then in the help file. You just need to perform the actions one after another:

If WinActive("My Program") Then
   ;Perform Step 1
   ;Perform Step 2
   ;Perform Step 3
EndIf

 

Thanks I tried that and it didnt work cause i left out the Endif, but I have other if winactive hotkeysset that are without and they worked but they also arent double commands. So thanks.

 

 

46 minutes ago, zone97 said:
#include <AutoItConstants.au3>

HotKeySet("{ESC}", "AltF5")

Func AltF5()
    If WinActive('Program X') Then
        Send('^!+e')
        MouseClick($MOUSE_CLICK_LEFT, 181, 305, 1)
        Send('2')
    EndIf    
EndFunc

 

 

Thanks also, that worked my issue was I left out and if. Also do you know why the hotkeyset key I chose for instance is the letter "E" locks up meaning that I cant use it for anything else but that hotkeyset.

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