Jump to content

New, needs help


 Share

Recommended Posts

Well, what I'm trying to do may seem very simple but I'm stuck on 1 issue. I've read a few tutorials on AutoIt but I think I need help through this little roadblock.

Basically, I want my script as when I press a key on my keyboard (F9) It sends a string or message after pressing Enter.

For example, I press F9 in notepad, it presses enter, then types out the message.

Most of it works, however, when I open notepad and press F9.. It sends the message over and over.. I would like it to send it only once.

What I have so far:

Global $LoLKeySet
HotKeySet("{F9}", "Msg1")
HotKeySet("{F10}", "Msg2")
HotKeySet("{F11}", "Msg3")

While 1
    Sleep (100)
WEnd

WinWaitActive("Notepad")

Func Msg1()
    $LoLKeySet = NOT $LoLKeySet
    While $LoLKeySet
            
$string1 = "Test1"
    
        Send ("{ENTER}")
        Send ($string1)
WEnd

EndFunc

Any help at all is appreciated :x

Edited by blinkwing
Link to comment
Share on other sites

  • Developers

That is what you tell it to do in the while..wend loop...right?:

While $LoLKeySet
        $string1 = "Test1"
        Send("{ENTER}")
        Send($string1)
    WEnd
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Well I got that working. New issue is that when I start up my process that I need this message to be sent to (It's a full screen application) it does not send it? It sends it on notepad or any non-full screen program, but not the one I need it to.

I press the key, nothing.

I've tried using ControlSend instead of Send but still no cigar. Okay, to be honest, all I'm trying to do is make it to where instead of typing out in my League of Legends game something, I could just hit a button and it types it out for me. There's no rule against that and there is no "hacking prevention" system.

Any help?

What I have:

Global $LoLKeySet
HotKeySet("{F9}", "Msg1")
HotKeySet("{F10}", "Msg2")
HotKeySet("{F11}", "Msg3")

WinWaitActive("League of Legends")

While 1
    Sleep (100)
WEnd



Func Msg1()
    $LoLKeySet = NOT $LoLKeySet
    
            
$string1 = "Test1"
    
        Send ("{ENTER}")
        Send ($string1)

EndFunc


Func Msg2()
    $LoLKeySet = NOT $LoLKeySet
    
            
$string2 = "Test2"
    
        Send ("{ENTER}")
        Send ($string2)


EndFunc



Func Msg3()
    $LoLKeySet = NOT $LoLKeySet
    
            
$string3 = "Test3"
    
        Send ("{ENTER}")
        Send ($string3)


EndFunc
Edited by blinkwing
Link to comment
Share on other sites

  • Developers

WinWaitActive("League of Legends")

Read the announcement at the top of the forum and adhere to it.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...