Jump to content

_IsPressed _IsEvil


uPod
 Share

Recommended Posts

Yes, just like the title says, it is.

Here is what I'm basically trying to do.

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 250 )
    If _IsPressed("{ENTER}", $dll) Then
        MsgBox(0,"_IsPressed", "End Key Pressed")
        ExitLoop
    EndIf
WEnd
DllClose($dll)

Its basically just the example, but I can't get it to respond, I press the key but nothing happens. Plus I tried the example and I have no clue what key "23" is. Anyone got some tips?

Link to comment
Share on other sites

Here is a list of what the codes are

01 Left mouse button

02 Right mouse button

04 Middle mouse button (three-button mouse)

05 Windows 2000/XP: X1 mouse button

06 Windows 2000/XP: X2 mouse button

08 BACKSPACE key

09 TAB key

0C CLEAR key

0D ENTER key

10 SHIFT key

11 CTRL key

12 ALT key

13 PAUSE key

14 CAPS LOCK key

1B ESC key

20 SPACEBAR

21 PAGE UP key

22 PAGE DOWN key

23 END key

24 HOME key

25 LEFT ARROW key

26 UP ARROW key

27 RIGHT ARROW key

28 DOWN ARROW key

29 SELECT key

2A PRINT key

2B EXECUTE key

2C PRINT SCREEN key

2D INS key

2E DEL key

30 0 key

31 1 key

32 2 key

33 3 key

34 4 key

35 5 key

36 6 key

37 7 key

38 8 key

39 9 key

41 A key

42 B key

43 C key

44 D key

45 E key

46 F key

47 G key

48 H key

49 I key

4A J key

4B K key

4C L key

4D M key

4E N key

4F O key

50 P key

51 Q key

52 R key

53 S key

54 T key

55 U key

56 V key

57 W key

58 X key

59 Y key

5A Z key

5B Left Windows key

5C Right Windows key

60 Numeric keypad 0 key

61 Numeric keypad 1 key

62 Numeric keypad 2 key

63 Numeric keypad 3 key

64 Numeric keypad 4 key

65 Numeric keypad 5 key

66 Numeric keypad 6 key

67 Numeric keypad 7 key

68 Numeric keypad 8 key

69 Numeric keypad 9 key

6A Multiply key

6B Add key

6C Separator key

6D Subtract key

6E Decimal key

6F Divide key

70 F1 key

71 F2 key

72 F3 key

73 F4 key

74 F5 key

75 F6 key

76 F7 key

77 F8 key

78 F9 key

79 F10 key

7A F11 key

7B F12 key

7C-7F F13 key - F16 key

80H-87H F17 key - F24 key

90 NUM LOCK key

91 SCROLL LOCK key

A0 Left SHIFT key

A1 Right SHIFT key

A2 Left CONTROL key

A3 Right CONTROL key

A4 Left MENU key

A5 Right MENU key

Is this what you want

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 50 )
    If _IsPressed("0D", $dll) Then
        MsgBox(0,"_IsPressed", "Enter Pressed")
        ExitLoop
    EndIf
WEnd
DllClose($dll)
Edited by BigDod


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

yeah its in there i promise! go to Start>All Programs>Autoit v3>Help File Click the index tab then find _IsPressed because what is below is quoted from there

And Lighten Up? I'm not angry, just trying to point out there is a help file for a reason.

Every noob goes through it, but I made my first media player without the forums, I learned from the helpfile, and honestly I think every noob should start there. Welcome to the forums though!

Function Reference

_IsPressed

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

Check if key has been pressed

#Include <Misc.au3>

_IsPressed ( $s_hexKey [, $v_dll = 'user32.dll' ] )

Parameters

$s_hexKey key to check for

$v_dll Optional: Handle to dll or default to user32.dll

Return Value

Success: Returns 1 if true.

Failure: Returns 0 if false.

Remarks

01 Left mouse button

02 Right mouse button

04 Middle mouse button (three-button mouse)

05 Windows 2000/XP: X1 mouse button

06 Windows 2000/XP: X2 mouse button

08 BACKSPACE key

09 TAB key

0C CLEAR key

0D ENTER key

10 SHIFT key

11 CTRL key

12 ALT key

13 PAUSE key

14 CAPS LOCK key

1B ESC key

20 SPACEBAR

21 PAGE UP key

22 PAGE DOWN key

23 END key

24 HOME key

25 LEFT ARROW key

26 UP ARROW key

27 RIGHT ARROW key

28 DOWN ARROW key

29 SELECT key

2A PRINT key

2B EXECUTE key

2C PRINT SCREEN key

2D INS key

2E DEL key

30 0 key

31 1 key

32 2 key

33 3 key

34 4 key

35 5 key

36 6 key

37 7 key

38 8 key

39 9 key

41 A key

42 B key

43 C key

44 D key

45 E key

46 F key

47 G key

48 H key

49 I key

4A J key

4B K key

4C L key

4D M key

4E N key

4F O key

50 P key

51 Q key

52 R key

53 S key

54 T key

55 U key

56 V key

57 W key

58 X key

59 Y key

5A Z key

5B Left Windows key

5C Right Windows key

60 Numeric keypad 0 key

61 Numeric keypad 1 key

62 Numeric keypad 2 key

63 Numeric keypad 3 key

64 Numeric keypad 4 key

65 Numeric keypad 5 key

66 Numeric keypad 6 key

67 Numeric keypad 7 key

68 Numeric keypad 8 key

69 Numeric keypad 9 key

6A Multiply key

6B Add key

6C Separator key

6D Subtract key

6E Decimal key

6F Divide key

70 F1 key

71 F2 key

72 F3 key

73 F4 key

74 F5 key

75 F6 key

76 F7 key

77 F8 key

78 F9 key

79 F10 key

7A F11 key

7B F12 key

7C-7F F13 key - F16 key

80H-87H F17 key - F24 key

90 NUM LOCK key

91 SCROLL LOCK key

A0 Left SHIFT key

A1 Right SHIFT key

A2 Left CONTROL key

A3 Right CONTROL key

A4 Left MENU key

A5 Right MENU key

Related

None.

Example

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1

Sleep ( 250 )

If _IsPressed("23", $dll) Then

MsgBox(0,"_IsPressed", "End Key Pressed")

ExitLoop

EndIf

WEnd

DllClose($dll)

[center][/center]

Link to comment
Share on other sites

Sorry, I didn't mean to sound angry. I use the helpfile like crazy, don't think that I just post around here.

And this is all my help file says about _IsPressed.

_IsPressed

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

Check if key has been pressed

#Include <Misc.au3>

_IsPressed($sHexKey[, $vDLL = 'user32.dll'])

Parameters

$sHexKey Key to check for

$vDLL Handle to dll or default to user32.dll

Return Value

True: 1

False: 0

Remarks

If calling this function repeatidly, should open 'user32.dll' and pass in handle.

Make sure to close at end of script

Related

Example

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1

Sleep ( 250 )

If _IsPressed("23", $dll) Then

MsgBox(0,"_IsPressed", "End Key Pressed")

ExitLoop

EndIf

WEnd

DllClose($dll)

Edit: Well, no one ever mentioned that the beta help file and the regular help file were different, lol. I just looked, I guess I'll be using the beta help file from now on.

Edited by uPod
Link to comment
Share on other sites

Sorry, I didn't mean to sound angry. I use the helpfile like crazy, don't think that I just post around here.

And this is all my help file says about _IsPressed.

Edit: Well, no one ever mentioned that the beta help file and the regular help file were different, lol. I just looked, I guess I'll be using the beta help file from now on.

For the sake of clarification (vindication?) - On my system with a clean install of 3.2.10.0, I'm showing the same truncated help file entry.

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

Sorry, I didn't mean to sound angry. I use the helpfile like crazy, don't think that I just post around here.

And this is all my help file says about _IsPressed.

Edit: Well, no one ever mentioned that the beta help file and the regular help file were different, lol. I just looked, I guess I'll be using the beta help file from now on.

You're right up to 3.2.10.0 that's what it says. Starting with 3.2.11.0 the rest was included. You could have found it by going to the Appendix though.

Appendix>>ASCII Characters. In the HEX column.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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