Jump to content

Dead Loop


Hormiga
 Share

Recommended Posts

So, here is the problem:

I've got some online game. In this game, chat window opens with the Enter button. I wanted to do some hotkeys, such as Ctrl+Enter, Alt+Enter, Shift+Enter, so when I press this combinations, chat window opens and some prefix messages typed into it.

Meanwhile, this hotkeys should not work in other applications.

Thats how I thought to solve this task:

HotKeySet("!{ENTER}","ChatHelper")
HotKeySet("+{ENTER}","ChatHelper")
HotKeySet("^{ENTER}","ChatHelper")

Func ChatHelper()
  If WinActive($FLTitle) Then
    ;If hotkey has been pressed inside of the game
    Switch @HotKeyPressed
    Case "^{ENTER}"
      Send("{ENTER}"&GUICtrlRead($ChatHelperCtrl[0]))
    Case "+{ENTER}"
      Send("{ENTER}"&GUICtrlRead($ChatHelperCtrl[1]))
    Case "!{ENTER}"
      Send("{ENTER}"&GUICtrlRead($ChatHelperCtrl[2]))
    EndSwitch
  Else
    ;If hotkey been pressed outside od the game
    KeyPass(@HotKeyPressed,"ChatHelper")
  EndIf
EndFunc

Func KeyPass($Key,$Func)
  HotKeySet($Key)
  Send($Key)
  HotKeySet($Key,$Func)
EndFunc

So, that's what I have as a result:

1) Outside of the game everything works fine, KeyPass function works perfectly.

2) Inside of the game, when I use the Ctrl+Enter combination, i get 100% CPU load, script isn't working.

3) If i will comment the call of KeyPass function, everything will works fine inside of the game, but, obviously, not outside.

What am I doing wrong?

P.S. Sorry if my English is too bad.

Link to comment
Share on other sites

Ok, fixed:

So, here is the problem:

I've got some *.txt document, opened in the Notepad. I wanted to do some hotkeys, such as Ctrl+Enter, Alt+Enter, Shift+Enter, so when I press this combinations, is's starting a new line and type some text at this new line.

Meanwhile, this hotkeys should not work in other applications.

Thats how I thought to solve this task:

HotKeySet("!{ENTER}","ChatHelper")
HotKeySet("+{ENTER}","ChatHelper")
HotKeySet("^{ENTER}","ChatHelper")

Func ChatHelper()
  If WinActive($FLTitle) Then
    ;If hotkey has been pressed inside of the game
    Switch @HotKeyPressed
    Case "^{ENTER}"
      Send("{ENTER}"&GUICtrlRead($ChatHelperCtrl[0]))
    Case "+{ENTER}"
      Send("{ENTER}"&GUICtrlRead($ChatHelperCtrl[1]))
    Case "!{ENTER}"
      Send("{ENTER}"&GUICtrlRead($ChatHelperCtrl[2]))
    EndSwitch
  Else
    ;If hotkey been pressed outside od the game
    KeyPass(@HotKeyPressed,"ChatHelper")
  EndIf
EndFunc

Func KeyPass($Key,$Func)
  HotKeySet($Key)
  Send($Key)
  HotKeySet($Key,$Func)
EndFunc

So, that's what I have as a result:

1) Outside of this notepad window everything works fine, KeyPass function works perfectly.

2) Inside of this notepad window, when I use the Ctrl+Enter combination, i get 100% CPU load, script isn't working, notepad stops working too.

3) If i will comment the call of KeyPass function, everything will works fine inside of this notepad window game, but, obviously, not in another applications.

What am I doing wrong?

P.S. Sorry if my English is too bad.

Link to comment
Share on other sites

What you have to understand, is that game windows can react differently to notepad windows, on account of a lot of them having bot countermeasures.

So dispite you changing a word in your post and saying its fixed, its actually not fixed, you are automating part of a game, so by just saying "notepad" instead of "game window" anyone trying to help, may infact just be wasting their time, and thats not a great idea when you are after help..

My advice, drop the topic and search for alternative hotkey udfs on the forum, or use unique hotkeys.

Over and out.

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

  • Developers

I'm not just switch the word. There was a test. Notepad have the same reaction - 100% cpu load.

It looks like when happens Send("{ENTER}"), somehow it hooks by autoit.

read the linked announcement and adhere to it.

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