Jump to content

Recommended Posts

Posted

Greetings,

Any help is greatly appreciated.  I'm a bit new to AutoIT, I have the help file and some examples and started in on a little project with some success, but also having some ill effects which I'm sure is due to my lack of knowledge of AutoIT.

Trying to send some key presses to another program from a Windowed AutoIT program.  All is fine with the initial send of keys, but then that's it, I can't press my hotkey again, if I do, nothing happens.  I fear that I'm not returning to my main func from the func for my hotkey.  Or I'm just completely mucking up the code.

Could someone please look over my code and give me some hints as to what I'm possibly doing wrong?

Thanks in advance,

~Garrett

#include <GUIConstantsEx.au3>
#include <Constants.au3>
HotKeySet("!{F1}", "SendText1")

_Main()

Func _Main()
        Local $exitbutton
        GUICreate("FATE Hotkeys", 300, 200)
        $exitbutton = GUICtrlCreateButton("Exit", 220, 166, 70, 24)
        GUISetState()

        While 1
            $msg = GUIGetMsg()
            Select
                Case $msg = $GUI_EVENT_CLOSE Or $msg = $exitbutton
                ExitLoop
            EndSelect
        WEnd
    GUIDelete()
    Exit
EndFunc

Func SendText1()
    Local $hWnd = WinWait("[CLASS:FATE]", "", 0)
    If WinExists("[CLASS:FATE]") Then
        WinActivate($hWnd)
        Send("{LCTRL down}")
        Send("{LSHIFT down}")
        Send("{~ down}")
        Send("{LCTRL up}")
        Send("{LSHIFT up}")
        Send("{~ up}")
        Send("fame")
        sleep(10)
        Send("{ENTER down}")
        Send("{ENTER up}")
    EndIf
EndFunc
  • Moderators
Posted

GarrettHylltun,

For someone who has been a member since 2005 you seem remarkably uninterested in following the Forum rules (there is also a link at bottom right of each page). :naughty:

I suggest that you read them before you post again - although since you are averaging about a post a year, perhaps you had best wait until just before you post as they may well have changed from the current set in the intervening period. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...