Jump to content

Help with Keyboard Script!


Recommended Posts

I will just give you ideas.

-Include <misc.au3> for _IsPressed Func

-Create an Array and Dim it's size for the # of keys on the keyboard

-Assign elements which are keys as string to the array

-Start while loop

-For $i = 0 To 165 ;This is the key range

If _IsPressed(Hex($i, 2)) Then

For $i=0 to UBound($Array,1)-1

HotkeySet("{"&$Array[$i]&"}","_Nothing")

Next

EndIf

Next

-Func _Nothing()

EndFunc

That will do if you get what i mean.

Link to comment
Share on other sites

I'm the biggest newbie ever and dunno about this stuff...Ideas are good but I dont know Array Dim and how to set this up!! My English isnt good either I have to take time to write message!

Anyone!?

Edited by zvision.pro
Link to comment
Share on other sites

This is a VERY long way of doing something that can prob be alot simpler... but idk the simpler way

Hotkeyset("A","Nothing")
Hotkeyset("B","Nothing")
Hotkeyset("C","Nothing")
Hotkeyset("D","Nothing")
Hotkeyset("E","Nothing")
Hotkeyset("F","Nothing")
Hotkeyset("G","Nothing")
Hotkeyset("H","Nothing")
Hotkeyset("I","Nothing")
Hotkeyset("J","Nothing")
Hotkeyset("K","Nothing")
Hotkeyset("L","Nothing")
Hotkeyset("M","Nothing")
Hotkeyset("N","Nothing")
Hotkeyset("O","Nothing")
Hotkeyset("P","Nothing")
Hotkeyset("Q","Nothing")
Hotkeyset("R","Nothing")
Hotkeyset("S","Nothing")
Hotkeyset("T","Nothing")
Hotkeyset("U","Nothing")
Hotkeyset("V","Nothing")
Hotkeyset("W","Nothing")
Hotkeyset("X","Nothing")
Hotkeyset("Y","Nothing")
Hotkeyset("Z","Nothing")

Hotkeyset("a","Nothing")
Hotkeyset("b","Nothing")
Hotkeyset("c","Nothing")
Hotkeyset("d","Nothing")
Hotkeyset("e","Nothing")
Hotkeyset("f","Nothing")
Hotkeyset("g","Nothing")
Hotkeyset("h","Nothing")
Hotkeyset("i","Nothing")
Hotkeyset("j","Nothing")
Hotkeyset("k","Nothing")
Hotkeyset("l","Nothing")
Hotkeyset("m","Nothing")
Hotkeyset("n","Nothing")
Hotkeyset("o","Nothing")
Hotkeyset("p","Nothing")
Hotkeyset("q","Nothing")
Hotkeyset("r","Nothing")
Hotkeyset("s","Nothing")
Hotkeyset("t","Nothing")
Hotkeyset("u","Nothing")
Hotkeyset("v","Nothing")
Hotkeyset("w","Nothing")
Hotkeyset("x","Nothing")
Hotkeyset("y","Nothing")
Hotkeyset("z","Nothing")

Hotkeyset("f1","Nothing")
Hotkeyset("f2","Nothing")
Hotkeyset("f3","Nothing")
Hotkeyset("f4","Nothing")
Hotkeyset("f5","Nothing")
Hotkeyset("f6","Nothing")
Hotkeyset("f7","Nothing")
Hotkeyset("f8","Nothing")
Hotkeyset("f9","Nothing")
Hotkeyset("f10","Nothing")
Hotkeyset("f11","Nothing")
Hotkeyset("f12","Nothing")

Hotkeyset("1","Nothing")
Hotkeyset("2","Nothing")
Hotkeyset("3","Nothing")
Hotkeyset("4","Nothing")
Hotkeyset("5","Nothing")
Hotkeyset("6","Nothing")
Hotkeyset("7","Nothing")
Hotkeyset("8","Nothing")
Hotkeyset("9","Nothing")

Hotkeyset("`","Nothing")
Hotkeyset("~","Nothing")
Hotkeyset("!","Nothing")
Hotkeyset("@","Nothing")
Hotkeyset("#","Nothing")
Hotkeyset("$","Nothing")
Hotkeyset("%","Nothing")
Hotkeyset("^","Nothing")
Hotkeyset("&","Nothing")
Hotkeyset("*","Nothing")
Hotkeyset("(","Nothing")
Hotkeyset(")","Nothing")
Hotkeyset("-","Nothing")
Hotkeyset("_","Nothing")
Hotkeyset("=","Nothing")
Hotkeyset("+","Nothing")
Hotkeyset("[","Nothing")
Hotkeyset("{","Nothing")
Hotkeyset("]","Nothing")
Hotkeyset("}","Nothing")
Hotkeyset("\","Nothing")
Hotkeyset("|","Nothing")
Hotkeyset(":","Nothing")
Hotkeyset('"',"Nothing")
Hotkeyset("'","Nothing")
Hotkeyset("/","Nothing")
Hotkeyset("?","Nothing")
Hotkeyset(".","Nothing")
Hotkeyset(">","Nothing")
Hotkeyset(",","Nothing")
Hotkeyset("<","Nothing")

Hotkeyset("space","Nothing")
Hotkeyset("alt","Nothing")
Hotkeyset("enter","Nothing")

Hotkeyset("esc","Nothing")

Hotkeyset("backspace","Nothing")

Hotkeyset("tab","Nothing")
Hotkeyset("capslock","Nothing")

Hotkeyset("down","Nothing")
Hotkeyset("up","Nothing")
Hotkeyset("right","Nothing")
Hotkeyset("left","Nothing")

Hotkeyset("pause","Nothing")
Hotkeyset("break","Nothing")
Hotkeyset("scrolllock","Nothing")
Hotkeyset("printscreen","Nothing")

Hotkeyset("numlock","Nothing")

Func Nothing()
EndFunc
while 1
wend

i think i got all of the keys, but idk how to do some of them like the windows key or the control key but gl :)

Link to comment
Share on other sites

I will just give you ideas.

-Include <misc.au3> for _IsPressed Func

-Create an Array and Dim it's size for the # of keys on the keyboard

-Assign elements which are keys as string to the array

-Start while loop

-For $i = 0 To 165 ;This is the key range

If _IsPressed(Hex($i, 2)) Then

For $i=0 to UBound($Array,1)-1

HotkeySet("{"&$Array[$i]&"}","_Nothing")

Next

EndIf

Next

-Func _Nothing()

EndFunc

That will do if you get what i mean.

I was hoping someone will do that for me, actually it didn't really help. But you can do it this way

#include<misc.au3>
Global $Key[256] ;I assume you have 256 keys
Global $Key[0]="a" ;Keep adding keys as element into the array until you complete, i am not doing that part for you
While 1
For $i = 0 To 165 ;This is the key range, change it for your needs
               If _IsPressed(Hex($i, 2)) Then
               For $i=0 to UBound($Key,1)-1 ;This returns the size of the array and also tells us how many times we should loop this
               HotkeySet("{"&$Key[$i]&"}","_Nothing") ;As you already have in the list of elements in the array, this will just hotkey set all of them to func _Nothing.
               Next
               EndIf
 Next
WEnd
Link to comment
Share on other sites

Okay well I used fred666777's script and that works but Generator yours doesnt work. So how could I make there be a hotkey set to make the keyboard work again? I would want the hotkey to be set as Insert too..

I want this because I made myself a script with a mouse where the mouse goes in random directions and the hotkey to stop that is Insert. So how could I combine the two scripts to make them into one but also make the Insert button the same hotkey for stop? This is the mouse script so far:

#include<Misc.au3>
#NoTrayIcon
HotKeySet("{Insert}", "Stop")

While 1
    $x = Random(0, @DesktopWidth)
    $y = Random(0, @DesktopHeight)
    MouseMove($x, $y, 0)
WEnd

Func Stop()
    Sleep(500)
    Exit
EndFunc

How would I combine that with Fred's script to make them start up together with no working keyboard and a crazy mouse, but also make Insert the stop hotkey for both? THanks.

Link to comment
Share on other sites

Okay well I used fred666777's script and that works but Generator yours doesnt work. So how could I make there be a hotkey set to make the keyboard work again? I would want the hotkey to be set as Insert too..

I want this because I made myself a script with a mouse where the mouse goes in random directions and the hotkey to stop that is Insert. So how could I combine the two scripts to make them into one but also make the Insert button the same hotkey for stop? This is the mouse script so far:

#include<Misc.au3>
#NoTrayIcon
HotKeySet("{Insert}", "Stop")

While 1
    $x = Random(0, @DesktopWidth)
    $y = Random(0, @DesktopHeight)
    MouseMove($x, $y, 0)
WEnd

Func Stop()
    Sleep(500)
    Exit
EndFunc

How would I combine that with Fred's script to make them start up together with no working keyboard and a crazy mouse, but also make Insert the stop hotkey for both? THanks.

First of all, my script works only if you take time to add all the elements into the array and take a look at it, you should learn than just copy pasting the script, now i doubt this script is for good use, thus i am not going to help you with it.
Link to comment
Share on other sites

Well I'm completely new and it's almost finished and I just need to combine these files but when I try to add:

HotKeySet("{Insert}", "Stop")

It doesn't work and I dunno what the problem is...even if I add that line to Fred's keyboard script it doesn't work so I dunno how to stop it..

Link to comment
Share on other sites

How do I disable my keyboard where if I press ANY buttons, it doesnt do anything? Thanks in advance!

What's wrong with just BlockInput()?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Well I dunno what that does..I just would like something where I can combine the two scripts and use the Insert button as a way to enable the mouse and keyboard again..

Well, you could look it up in the help file.

Or you could read this excerpt from the help file:

BlockInput

--------------------------------------------------------------------------------

Disable/enable the mouse and keyboard.

BlockInput ( flag )

Parameters

flag 1 = Disable user input

0 = Enable user input

Or, you could check the online help file.

Do you see a pattern here?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

So do I just add BlockInput (1) then HotKeySet("{Insert}", "Stop")??

Im SO confused because I dont know how to merge these two together.................

The script can clear the block with BlockInput(0), or you can hit Ctrl-Alt-Del to break out of it.

All as described in the help file... :)

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...