Jump to content

_ispressed


Recommended Posts

  • Moderators

myspacee,

Try detecting the key combination you need to get the accented characters - something like this:

#Include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 10 )
    If _IsPressed("11", $dll) And _IsPressed("41", $dll) Then
        MsgBox(0,"_IsPressed", "Ctrl-A Pressed")
        ExitLoop
    EndIf
WEnd

DllClose($dll)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Link to comment
Share on other sites

can't post too much code before be tagged as keylogger :D

so i post part of manual:

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
BA;
BB =
BC ,
BD -
BE .
BF /
C0 `
DB [
DC \
DD ]

I Know that _ispressed() is more 'hardware function' than software one.

But I Can't understant how detect 'ò' and 'à' and 'ù' keypress (è and é is detectable by hex code DB and DD)

feel so stupid,

m.

Link to comment
Share on other sites

thank you for reply m23,

but which combination for ? :

è = 
  é = 
  ì = 
  ò = 
  à = 
  ù =

Isn't possible map key directly ?

m.

Perhaps these codes could be of use to you?

http://www.fileformat.info/info/unicode/char/00e8/index.htm è

http://www.fileformat.info/info/unicode/char/00e9/index.htm é

http://www.fileformat.info/info/unicode/char/00ec/index.htm ì

http://www.fileformat.info/info/unicode/char/00f2/index.htm ò

http://www.fileformat.info/info/unicode/char/00e0/index.htm à

http://www.fileformat.info/info/unicode/char/00f9/index.htm ù

Example using é:

Run("notepad.exe")
Sleep(3000)
Send("{ASC 0x00E9}") ;Replace 0x00E9 with the character's UTF-16 (hex) code.
Exit

Edited by nf67
Link to comment
Share on other sites

For sure my english is so bad that i can't do well my question.

this script never work :

#Include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 10 )
    If _IsPressed("E0", $dll) Then
        MsgBox(0,"_IsPressed", "hex code E0 aka à")
        ExitLoop
    EndIf
WEnd

DllClose($dll)

We say keyboard layout is not so important, so can you post for me

script that return a msgbox when you press letter 'à' ?

sorry for not understand,

m.

Edited by myspacee
Link to comment
Share on other sites

I think there might be a way using a dllcall of the user32.dll function MapVirtualKeyEx.. I tried and now I'm to tiered to further pursuit this :D , maybe someone else wants to pick up?

Cheers

#include<winapi.au3>
;#include<misc.au3>

;while 1
;   if _IsPressed('5a') then ConsoleWrite('z' & @crlf)
;WEnd

Global Const $MAPVK_VK_TO_VSC = 0
Global Const $MAPVK_VSC_TO_VK = 1
Global Const $MAPVK_VK_TO_CHAR = 2
Global Const $MAPVK_VSC_TO_VK_EX = 3
Global Const $MAPVK_VK_TO_VSC_EX = 4

$hWnd_Desktop = _WinAPI_GetDesktopWindow()

;
; Z = 5A

$sHexKey = "5a"

ConsoleWrite(_WinAPI_GetKeyboardLayout($hWnd_Desktop) & @crlf)

$sKbLayout = _WinAPI_GetKeyboardLayout($hWnd_Desktop)
ConsoleWrite(_WinAPI_MapVirtualKeyEx($sHexKey,$sKbLayout) & @crlf)
ConsoleWrite(Chr('0x' & _WinAPI_MapVirtualKeyEx($sHexKey,$sKbLayout)) & @crlf)

; http://msdn.microsoft.com/en-us/library/ms646307(VS.85).aspx
Func _WinAPI_MapVirtualKeyEx($sHexKey,$sKbLayout)
    Local $Ret = DllCall('user32.dll', 'long', 'MapVirtualKeyEx', 'int', '0x' & $sHexKey, 'int', 0, 'int', '0x' & $sKbLayout)
    Return $Ret[0]
EndFunc

; http://www.autoitscript.com/forum/index.php?showtopic=95883&view=findpost&p=690005
; by Yashied

Func _WinAPI_GetKeyboardLayout($hWnd)
    Local $Ret = DllCall('user32.dll', 'long', 'GetWindowThreadProcessId', 'hwnd', $hWnd, 'ptr', 0)
    If (@error) Or ($Ret[0] = 0) Then
        Return SetError(1, 0, 0)
    EndIf
    $Ret = DllCall('user32.dll', 'long', 'GetKeyboardLayout', 'long', $Ret[0])
    If (@error) Or ($Ret[0] = 0) Then
        Return SetError(1, 0, 0)
    EndIf
    Return '0000' & Hex($Ret[0], 4)
    ;Return Hex($Ret[0], 4)
EndFunc   ;==>_WinAPI_GetKeyboardLayout
Edited by KaFu
Link to comment
Share on other sites

For sure my english is so bad that i can't do well my question.

this script never work :

#Include <Misc.au3>
    
    $dll = DllOpen("user32.dll")
    
    While 1
        Sleep ( 10 )
        If _IsPressed("E0", $dll) Then
            MsgBox(0,"_IsPressed", "hex code E0 aka à")
            ExitLoop
        EndIf
    WEnd
    
    DllClose($dll)

We say keyboard layout is not so important, so can you post for me

script that return a msgbox when you press letter 'à' ?

sorry for not understand,

m.

#include <Array.au3>
#include <misc.au3>
$Gui = GUICreate("codes")
$ed = GUICtrlCreateEdit("", 0, 0, 400, 400)
GUISetState()
Dim $arraystate[257], $arraystatenew[257]

opt("winwaitdelay",30)
MsgBox(262144, "Please ensure no key is pressed ...", "...then click OK" & @CRLF & "(press ESC to quit)")

For $i = 1 To 256
     $arraystate[$i] = _IsPressed(Hex($i, 2))
Next

;report the change of key state
;press a key to find it's code
While 1
     For $i = 1 To 256
         if _Ispressed("1B") then exit
         $arraystatenew[$i] = _IsPressed(Hex($i, 2))
        
        
         If $arraystate[$i] <> $arraystatenew[$i] Then
             WinActivate($Gui)
             Send("=" & Hex($i, 2) & "{ENTER}")
         EndIf
        
        
         $arraystate[$i] = $arraystatenew[$i]
     Next
     Sleep(40)
WEnd

EDIT: Modified so you could quit th escript by pressing Escape.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

myspacee,

Be careful, those codes will only work for the keyboard layout that you tested. Other layouts use different key combinations to get the accented characters and so will require different codes - if there are actual key combinations to get accented characters at all (for example, my UK keyboard has none - I have to use a software fix or Alt-keypad).

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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