Jump to content

I'm trying to do a Macro script


Recommended Posts

This is not a keylogger attempt, What I intended this program to do is to detect if a key is pressed and the script would simulate keyboard presses(in example: "Y" button is set simulate this keyboard combo "[f1]+[1]+[2]". Anyone knows which functions/commands I needed to make my script.

I intended to make this script to help those who don't have a G15 keyboard with programmable macros, to have the same advantage with those who have G15 Keyboards. Yes, this is for a game.

I hope you can help me. Thanks.

- Nave47

Link to comment
Share on other sites

Welcome to the Forums!

You need to take a look in the help file for HotKeySet() and Send()

you will also need to look at creating a loop for your script to keep it running waiting for the keypress.

While 1

sleep(100)

Wend

Link to comment
Share on other sites

  • Moderators

Hmm... Thanks for the welcome note.

On Topic : Ah, Maybe you can provide a simple template to just to have an idea on how I'll make my script? I'm still learing, Sorry about that.

Take a look at what he suggested, at the bottom of the description, you'll see your "template".

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Anyone mind to check this? I'm still a newbie and learning, So I don't if anything is wrong or missing. Actually this is my first script.

Thanks

;========================================== 
;========================================== 
;               
;               
;   MacroScript by : Nave47         
;   
;   Current State : Unfinished
;   
;   
;   
;   
;==========================================
;==========================================

;=== Start ===

#No TrayIcon 
;#include <GuiConstants.au3>    

;=== Gui ===

;GuiCreate("MacroScript", 475, 325)
;$F9 = GUICtrlCreateInput("W", 32, 25, 209, 21)
;$F10 = GUICtrlCreateInput("E", 32, 50, 209, 21)
;$F11 = GUICtrlCreateInput("R", 32, 75, 209, 21)
;$F12 = GUICtrlCreateInput("T", 32, 100, 209, 21)
;$Label1 = GUICtrlCreateLabel("W", 10, 28, 16, 17)
;$Label2 = GUICtrlCreateLabel("E", 5, 53, 22, 17)
;$Label3 = GUICtrlCreateLabel("R", 7, 77, 22, 17)
;$Label4 = GUICtrlCreateLabel("T", 6, 104, 22, 17)
;$Label5 = GUICtrlCreateLabel("Made by Nave47", 24, 0, 157, 17)

;=== Scipt Controls ===     
        MsgBox(64, "MacroScript", "Script Loaded") 
        HotKeySet("{/}","TogglePause")
        HotKeySet("{*}","Terminate")

    Func TogglePause()
            $Paused = NOT $Paused
        While $Paused
            sleep(100)
            ToolTip('Script is "Paused"',0,0)
        WEnd
            ToolTip("")
    EndFunc
    
    Func Terminate()
        Exit 0
    EndFunc

;=== Variables ===

;$Macro[0]="Q"
;$Macro[1]="W"
;$Macro[2]="E"
;$Macro[3]="R"
;$Macro[4]="T"
;$Macro[5]="Y"

;=== Key Detection ===
    
    Func CheckKeyPress()
        While $Paused = Not $Paused
        HotKeySet("Q"[,"Macro1"])
        HotKeySet("W"[,"Macro2"])
;HotKeySet("E"[,"Macro3"])
;HotKeySet("R"[,"Macro4"])
;HotKeySet("T"[,"Macro5"])
;HotKeySet("Y[,"Macro6"])
        Sleep(50)
        WEnd
    EndFunc
    
;=== Macro Sets ===

    Func Macro1()
        Send("{F1}{8}"[,1])
        Sleep(50)
        Send("{F1}{8}"[,1])
    EndFunc
    
    Func Macro2()
        Send("{F2}{9}{0}"[,1])
        Sleep(50)
        Send("{F2}{9}{0}"[,1])
    EndFunc
    
;Func Macro3()
;Send("{F3}{0}"[,1])
;Sleep(50)
;Send("{F3}"[,1])
;EndFunc
    
;=== To Be Continued If Sucessful ==

I'm sure no one would steal my work, because I'm not yet sure if its working. (Can't test it now, Server too crowded)

Edited by Nave47
Link to comment
Share on other sites

The right way to do is with _IsPressed function (I think only in beta) it receives only hex of the keys but it checks if it is pressed actually and the fact that your program doesnt have a connection to CheckKeyPress function..basicly rewrite it ._.

Link to comment
Share on other sites

you don't want to do that..... you weren't even off the first page yet... have you tried your script? does it work? it doesn't look like there's anything in it that would HAVE to be done in game to test...

I'm sure no one would steal my work, because I'm not yet sure if its working. (Can't test it now, Server too crowded)

Sorry About the bump thing.

The right way to do is with _IsPressed function (I think only in beta) it receives only hex of the keys but it checks if it is pressed actually and the fact that your program doesnt have a connection to CheckKeyPress function..basicly rewrite it ._.

o.O my functions are not synchronized. Thanks for that.

Link to comment
Share on other sites

  • 2 weeks later...

This is not a keylogger attempt, What I intended this program to do is to detect if a key is pressed and the script would simulate keyboard presses(in example: "Y" button is set simulate this keyboard combo "[f1]+[1]+[2]". Anyone knows which functions/commands I needed to make my script.

I intended to make this script to help those who don't have a G15 keyboard with programmable macros, to have the same advantage with those who have G15 Keyboards. Yes, this is for a game.

I hope you can help me. Thanks.

- Nave47

Hey I have already done this. watch this youtube video of me using it. MacroGamer Beta Video

If you are interested in how I did it, Ill be happy to show you.

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

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