Sign in to follow this  
Followers 0
steventrouble

Block certain keys?

12 posts in this topic

I need to block my capslock key, because I keep on hitting it by accident when running my script... I know there's a block input command, but that also blocks my mouse, and every other key as well. I can't use a hotkey on it, because it does nothing for me... Is there a command or anything that I can use to block certain keys?

Here's my script btw...

;       ==================================================================
;       |               Steventrouble's Gaia Autoposter              |
;       |                       by Steventrouble                        |
;       ==================================================================
;
;       Instructions for use:
;           1. Push F5 to start, the scroll lock to begin the process
;           2. When the start msgbox shows up, push enter
;           3. Wait a bit, allowing the process to get to the last post
;           4. When the inputbox shows up, type in the last bump # plus 1
;           5. Just wait, and the process will do the rest.
;   
;       Hotkeys:
;           *  Pressing Alt+F12 will begin or restart the process
;           *  Pressing Pause/Break will pause the process
;           *  Pressing ESC will end it
;           *  Pressing Print Screen will show a post count
;
;





AutoItSetOption( "TrayIconHide", 1) ;Hides tray icon
AutoItSetOption("WinTitleMatchMode", 2) ;Makes it easier for me to manipulate the gaia window
AutoItSetOption("SendKeyDelay",200)
#include <IE.au3> ;Important for using the IE commands
HotKeySet("{ESC}", "Terminate") ;give yourself an exit by pressing Esc
HotKeySet("{pause}", "Pause") ;give yourself a pause
HotKeySet("!{F12}", "Start") ;push to begin the process
HotKeySet("!{F11}", "PostCount") ;shows the post number that you are on.
$noo = 0   ;   These are just precautions
$num = 0   ;   Delete if you do not plan to use the number feature
$ln = chr("10")
Func Terminate()
    $yes = MsgBox(4, "Exit", "Exit?")  ;asks if they want to exit (yes/no)
    If $yes = 6 Then   ;if they say yes, then exit
        Exit
    EndIf
EndFunc
Func Pause()
    MsgBox(0, "Paused", "Press OK to conitue.");pauses any actions, but any counters continue to count
    WinActivate("Gaia")                     ;time is not wasted by pausing
EndFunc
Func PostCount()
    MsgBox(0, "Post Count:", "Total Posts: " & $num & $ln & "Consecutive Posts: " & $noo, 5)
EndFunc
Func Start()
    MsgBox(0, "Start?", "Click OK to conitue.")  ;just a precaution, personal reasons
    _IECreate ("INSERT YOUR URL (Guild thread only) HERE!",0,1,1)   ;       || Place the url of the guild post inside the quotes ||
    sleep(200)
    WinSetState ( "Gaia", "", @SW_MAXIMIZE )  ;maximizes the window
    sleep(100)
    WinActivate("Gaia") ;activates the window, so that the mouse does not click on another window
    sleep(100)
    $doo = PixelGetColor(1269,150) ;checks the scrollbar color so it can scroll to the top
    sleep(500)
    MouseMove(600,600) ;centers the mouse to allow the MouseWheel function to work
    sleep(100)
    MouseWheel("down",100) ;scroll down the page at superspeed
    sleep(2000)
    MouseMove(1222,742) ;moves onto the arrowa
    MouseClick("left")  ;clicks
    sleep(3000)
    MouseWheel("down",100)  ;scrolls down to the bottom again
    $num = InputBox("Start From", "Choose the number you want to use", $num,"",100, 150)  ;Asks the number to begin with
    If @error = 1 Then  ;if there's a cancel button that is pushed                     ;Just use the number on the bottom +1
        MsgBox(0,"Goodbye","Goodbye")
        Exit            ;then it will end the program
    EndIf
    WinActivate("Gaia")   ;activates window
    MouseWheel("up",100);scrolls to top
    While 1    ;initiate a never-ending loop
        Opt("WinWaitDelay",100)
        Opt("WinTitleMatchMode",4)
        Opt("WinDetectHiddenText",1)
        Opt("MouseCoordMode",0)
        $sit = 0
        $spit = 0
        $split = 0
        Sleep(1000)
        $coord = PixelSearch(61, 431, 955, 471, "0x352f95", 10)
        If @error Then
            MsgBox (0, "Error.", "No pixel found.  ln 87" & $ln & "Posts: " & $noo)
            exit
        EndIf
        $new = PixelGetColor($coord[0],$coord[1])
        MouseMove($coord[0],$coord[1])
        MouseDown("left")
        MouseUp("left")
        While $split = 0
            $pics = PixelGetColor($coord[0],$coord[1])
            If $pics <> $new Then
                $split = 1
            EndIf
            Sleep(100)
        WEnd
        Sleep(3000)
        $teh = 0
            While $teh = 0
                $meh = PixelGetColor(547, 644)
                If $meh = "0x000000" Then
                    $teh = 1
                EndIf
                sleep(500)
            WEnd
        MouseMove(386,700)
        sleep(500)
        MouseClick("left")
        Sleep(200)
        Send("Bump {#}")
        Send($num)
        Sleep(2000)
        $poo = PixelSearch(615, 898, 717, 914, "0xffb400", 10)
        if @error Then
            MsgBox(0,"Error","No pixel found ln 130" & $ln & "Posts: " & $noo)
        endif
        MouseMove($poo[0],$poo[1])
        Sleep(1000)
        MouseClick("left")
        $num = $num + 1
        $noo = $noo + 1
        Sleep(9000)
        $moo = 0
        While $spit = 0
            $picks = PixelGetColor(533,575)
            If $picks <> "0xf0f0f0" Then
                $spit = 1
            EndIf
            Sleep(1000)
        WEnd
        sleep(31000)
        MouseWheel("up",100)

        If mod($noo,100) = 0 Then
            MsgBox(0,"Just wait a bit...","Don't want to get banned, do we?",60)
            sleep(60000)
        EndIf
    WEnd
EndFunc
While 1   ;just keeping the process alive
    sleep (10000)
WEnd

It sux and it's unorganized, I know. But it works really well.

Share this post


Link to post
Share on other sites



Isn't this what you want? Even the lights will turn on but Capslock does absolutely nothing..thats same as block

HotKeySet("{CAPSLOCK}","_Nothing")
While 1
    Sleep(100)
WEnd
Func _Nothing()
EndFunc

Share this post


Link to post
Share on other sites

Ok, thank you!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Isn't this what you want? Even the lights will turn on but Capslock does absolutely nothing..thats same as block

HotKeySet("{CAPSLOCK}","_Nothing")
While 1
    Sleep(100)
WEnd
Func _Nothing()
EndFunc
Strange... Now all my key's are capped... Have to hold Shift to make it stop.

Edit: Nevermind, all better, thx much!

Edited by steventrouble

Share this post


Link to post
Share on other sites

Was it off when you started the script?

No -.-

Works like a charm! tyvm

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

What if you only want to block a key in a particular program ?

Example

HotKeySet("{ENTER}","Detect")
While 1
    Sleep(100)
WEnd
Func Detect()
       If WinActive('Untitled - Notepad') Then
        If _IsPressed ('0D') Then
    ;Nothing
        EndIf
        Else
              ;Do the normal
    EndIf

EndFunc

EDIT

That is a question

Edited by JohnBailey

A decision is a powerful thing

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Aye, you'd put the If WinActive() Then qualifier in there, or put it up in the main GUI loop. Six of one.

While 1 
    $winActive = WinGetTitle("")
    Switch $winActive
        Case "Notepad"
              HotKeySet("{enter}", "_Dummy"
        Case Else
             HotKeySet("{enter}")
    EndSwitch
Wend
Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Aye, you'd put the If WinActive() Then qualifier in there, or put it up in the main GUI loop. Six of one.

While 1 
    $winActive = WinGetTitle("")
    Switch $winActive
        Case "Notepad"
              HotKeySet("{enter}", "_Dummy"
        Case Else
             HotKeySet("{enter}")
    EndSwitch
Wend
Gotcha! Thanks :)

A decision is a powerful thing

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