按键精灵啥的 不安全

搞个自己的吧

mega32u4 直接模拟鼠标键盘

再加个qt+lua的 脚本解析,

先凑活用,

下载地址: jar file

下载地址: jar file

lua demo:

local keymap = {}

keymap['KEY_LEFT_CTRL']  ='0x80'
keymap['KEY_LEFT_SHIFT'] ='0x81'
keymap['KEY_LEFT_ALT']   ='0x82'
keymap['KEY_LEFT_GUI']   ='0x83'
keymap['KEY_RIGHT_CTRL'] ='0x84'
keymap['KEY_RIGHT_SHIFT']    ='0x85'
keymap['KEY_RIGHT_ALT']  ='0x86'
keymap['KEY_RIGHT_GUI']  ='0x87'

keymap['KEY_UP_ARROW']   ='0xDA'
keymap['KEY_DOWN_ARROW'] ='0xD9'
keymap['KEY_LEFT_ARROW'] ='0xD8'
keymap['KEY_RIGHT_ARROW']    ='0xD7'
keymap['KEY_BACKSPACE']  ='0xB2'
keymap['KEY_TAB']        ='0xB3'
keymap['KEY_RETURN'] ='0xB0'
keymap['KEY_ESC']        ='0xB1'
keymap['KEY_INSERT'] ='0xD1'
keymap['KEY_DELETE'] ='0xD4'
keymap['KEY_PAGE_UP']    ='0xD3'
keymap['KEY_PAGE_DOWN']  ='0xD6'
keymap['KEY_HOME']   ='0xD2'
keymap['KEY_END']        ='0xD5'
keymap['KEY_CAPS_LOCK']  ='0xC1'
keymap['KEY_F1']     ='0xC2'
keymap['KEY_F2']     ='0xC3'
keymap['KEY_F3']     ='0xC4'
keymap['KEY_F4']     ='0xC5'
keymap['KEY_F5']     ='0xC6'
keymap['KEY_F6']     ='0xC7'
keymap['KEY_F7']     ='0xC8'
keymap['KEY_F8']     ='0xC9'
keymap['KEY_F9']     ='0xCA'
keymap['KEY_F10']        ='0xCB'
keymap['KEY_F11']        ='0xCC'
keymap['KEY_F12']        ='0xCD'

function this.get_keymap(this, k)
  local str = keymap[k]
  local v = tonumber(str)
  return v
  
end  

function this.click(this, i)
    local key = {}
    key[1] = 'left'
    key[2] = 'right'

    this:call('click '..key[i])
end

function this.move(this, x, y, z)
    local i = 0
    local n = 1
    if x < 0 then
        n = -1
    end    
    for x1 = x*n, 100, -100
    do
        this:call('move '..100*n..' 0 0')
        i = x1-100
        --this:delay(100)
    end    
    this:call('move '..i*n..' 0 0')

    local j = 0
    n = 1
    if y < 0 then
        n = -1
    end    
    for y1 = y*n, 100, -100
    do
        this:call('move 0 '..100*n..' 0')
        j = y1-100
        --this:delay(100)
    end    
    this:call('move 0 '..j*n..' 0')
    
    local k = 0
    n = 1
    if z < 0 then
        n = -1
    end    
    for z1 = z*n, 100, -100
    do
        this:call('move 0 0 '..100*n)
        k = z1-100
        --this:delay(100)
    end    
    this:call('move 0 0 '..k*n)
    
end

function this.keywrite(this, c)
    local i = string.byte(c)
    this:call('kwrite '..i)
end
    

function this.alt_tab(this)
    
    this:call('kpress '..this:get_keymap('KEY_LEFT_ALT')) -- alt
    this:call('kwrite '..this:get_keymap('KEY_TAB')) -- tab
    this:call('krelease '..this:get_keymap('KEY_LEFT_ALT')) -- alt

end

function this.main (this)

    this:delay(1000*5)
    for i=10,1,0 do
        this:move(-1000, -500, 0)
        this:delay(200)
    
        -- 1593, 788
        this:move(540, 240+20, 0)
        this:delay(300)
        --this:move(-500, 100, 0) -- -1372, 326
        -- -616, 394
        this:call('press left')
        this:delay(100)
        this:move(-224, 120+20, 0)
        -- if 1 == 2 then
        this:delay(100)
        this:call('release left')
    
        this:delay(500)
        this:call('kwrite '..this:get_keymap('KEY_RETURN'))
    
        this:delay(1000*15)
    
        -- end    
    end

 end