Sign in to follow this  
Followers 0
lamc

HotKeySet and Windows 7

3 posts in this topic

I have a script that worked fine on Windows XP, but when I use it on Windows 7 the "HotKeySet" doesn't work. I inserted some "ToolTips" to test the commands sequence and it seems to be ok (even the return value = 1 to HotKeySet function). But it looks like "HotKeySet" is not intercepting the keyboard.

Sorry my english.

Here is the script:

====================================================

WinWaitActive("Mortal Online Beta")

Opt("PixelCoordMode", 0)

Opt("SendCapslockMode", 0)

Global $Paused

$AbilitaHotKys = True

$Cavoca = False

$JanChat = False

HotKeySet("/", "Termina")

HotKeySet(".", "PegaPedra")

HotKeySet(",", "PegaMadeira")

HotKeySet("{F1}", "CallGuard")

HotKeySet("{F5}", "ProtectMe")

HotKeySet("{F6}", "followMe")

While 1

If WinActive("Mortal Online Beta") Then

sleep(1000)

EndIf

WEnd

Func ToggleHotkys()

if $AbilitaHotKys Then

$AbilitaHotKys = False

DesabilitaHotkeys()

ToolTip('Hotkeys Disabled',0,0)

Else

$AbilitaHotKys = True

HabilitaHotkeys()

ToolTip("")

EndIf

EndFunc

Func HabilitaHotkeys()

HotKeySet(".", "PegaPedra")

HotKeySet(",", "PegaMadeira")

EndFunc

Func DesabilitaHotkeys()

HotKeySet(",")

HotKeySet(".")

EndFunc

Func CallGuard()

If WinActive("Mortal Online Beta") Then

DesabilitaHotkeys()

ControlSend ("Mortal Online Beta", "", "", "{Enter}")

sleep(50)

ControlSend ("Mortal Online Beta", "", "", "guard")

sleep(250)

ControlSend ("Mortal Online Beta", "", "", "{Enter}")

HabilitaHotkeys()

EndIf

EndFunc

Func ProtectMe()

If WinActive("Mortal Online Beta") Then

DesabilitaHotkeys()

ControlSend ("Mortal Online Beta", "", "", "{Enter}")

sleep(50)

ControlSend ("Mortal Online Beta", "", "", "protect me")

sleep(250)

ControlSend ("Mortal Online Beta", "", "", "{Enter}")

HabilitaHotkeys()

EndIf

EndFunc

Func FollowMe()

If WinActive("Mortal Online Beta") Then

DesabilitaHotkeys()

ControlSend ("Mortal Online Beta", "", "", "{Enter}")

sleep(50)

ControlSend ("Mortal Online Beta", "", "", "follow Me")

sleep(250)

ControlSend ("Mortal Online Beta", "", "", "{Enter}")

HabilitaHotkeys()

EndIf

EndFunc

Func PegaPedra()

ToolTip('Pegando pedra!',0,0)

TestaChat()

If WinActive("Mortal Online Beta") and not $JanChat Then

if $Cavoca Then

$Cavoca = False

Else

$Cavoca = True

EndIf

While $Cavoca

ControlSend ("Mortal Online Beta", "", "", "9")

sleep (3500)

WEnd

Else

; ToolTip('Erro!',0,0)

DesabilitaHotkeys()

Send (".")

HabilitaHotkeys()

EndIf

EndFunc

Func PegaMadeira()

TestaChat()

If WinActive("Mortal Online Beta") and not $JanChat Then

if $Cavoca Then

$Cavoca = False

Else

$Cavoca = True

EndIf

While $Cavoca

ControlSend ("Mortal Online Beta", "", "", "8")

sleep (3500)

WEnd

Else

DesabilitaHotkeys()

Send (",")

HabilitaHotkeys()

EndIf

EndFunc

Func TestaChat()

if Hex (PixelGetColor(21,726),6) = "0D0E0D" then

$JanChat = True

Else

$JanChat = False

EndIf

EndFunc

Func Termina()

exit 0

EndFunc

Share this post


Link to post
Share on other sites



Is this bot-related?

Your While loop doesn't make much sense to me. I suggest you edit that, although it won't fix your specific issue.

As for the problem you describe, HotKeySet() works fine in Windows 7 :(. Not sure what you're doing wrong but your script readability leaves a lot to be desired (use [ autoit ] tags [ /autoit ] ).

Share this post


Link to post
Share on other sites

Is this bot-related?

Your While loop doesn't make much sense to me. I suggest you edit that, although it won't fix your specific issue.

As for the problem you describe, HotKeySet() works fine in Windows 7 :(. Not sure what you're doing wrong but your script readability leaves a lot to be desired (use [ autoit ] tags [ /autoit ] ).

You are right about the IF statement. It is out of context, but doesn't injures the logic of script. It should be just:

While 1

sleep(100)

WEnd

I think the problem is a "Mortal Online Beta" protection against keyboard hooks, because in others softwares the "HotKeySet" is working fine.

Thanks anyway, friend.

Share this post


Link to post
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
Sign in to follow this  
Followers 0