npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

w-mousekey

v1.0.10

Published

An operator for mouse and keyboard in nodejs.

Readme

w-mousekey

An operator for mouse and keyboard in nodejs.

language npm version license npm download npm download jsdelivr download

Documentation

To view documentation or get support, visit docs.

Core

w-mousekey is basing on OpenCV, @u4/opencv4nodejs and AutoHotkey.

Installation

Using npm(ES6 module):


1.下載OpenCV,下載網址:
  https://github.com/opencv/opencv/releases選opencv-4.12.0-windows.exe
 windows.exe為免安裝版,下載後解壓縮(不要複製本機檔案,可能因編譯導致檔案格式變更,而無法讓對方編譯)至C:\tools
 注意須確保路徑有效:
   C:\tools\opencv\build\include
   C:\tools\opencv\build\x64\vc16\bin
   C:\tools\opencv\build\x64\vc16\lib

2.於package.json內新增opencv4nodejs所需opencv路徑
  "opencv4nodejs": {
    "disableAutoBuild": "1",
    "opencvIncludeDir": "C:\\tools\\opencv\\build\\include",
    "opencvLibDir": "C:\\tools\\opencv\\build\\x64\\vc16\\lib",
    "opencvBinDir": "C:\\tools\\opencv\\build\\x64\\vc16\\bin"
  }

3.於終端機(PowerShell)視窗內輸入設定參數
  $Env:OPENCV4NODEJS_DISABLE_AUTOBUILD = "1"
  $Env:OPENCV_INCLUDE_DIR = "C:\tools\opencv\build\include"
  $Env:OPENCV_LIB_DIR    = "C:\tools\opencv\build\x64\vc16\lib"
  $Env:OPENCV_BIN_DIR    = "C:\tools\opencv\build\x64\vc16\bin"
  $Env:Path = "$Env:OPENCV_BIN_DIR;$Env:Path"

4.輸出變數確認
  echo $Env:OPENCV_INCLUDE_DIR
  echo $Env:OPENCV_LIB_DIR
  echo $Env:OPENCV_BIN_DIR
  要能出現路徑才算完成安裝

4.輸出變數確認
   echo $Env:OPENCV_INCLUDE_DIR
   echo $Env:OPENCV_LIB_DIR
   echo $Env:OPENCV_BIN_DIR
   要能出現路徑才算完成安裝

5.下載與安裝Python3,開啟自訂設定勾選Add Python.exe to PATH
   使用cmd輸入以下指令測試:
   python --version
   where python
   要能出現安裝版本與執行檔路徑才算完成安裝

6.下載安裝Visual Studio Build Tools
   下載網址: https://visualstudio.microsoft.com/zh-hant/downloads/
   下載Community版即可
   安裝時要勾選「使用 C++ 的桌面開發」,其內右側會勾選Windows SDK與MSVC,MSVC內會提供MSBuild

7.執行npm i -g node-gyp

8.執行npm i @u4/opencv4nodejs,若msvs有多版本則須指定npm i @u4/opencv4nodejs --msvs_version=2022

9.執行npm i w-mousekey

Example for collection

Link: [dev source code]

import getSettings from './getSettings.mjs'
import mk from './src/mousekey.mjs'
import sc from './src/screen.mjs'
import cp from './src/compare.mjs'
import ckPic from './src/ckPic.mjs'

setTimeout(async() => {
    let r

    // let st = getSettings()
    // console.log('st', st)

    // //mouseClick
    // await mk.mouseClick(215, 905)
    // await mk.mouseClick(100, 100)
    // await mk.mouseClick(676, 908)

    // //sendString
    // await mk.sendString('Hello World!')
    // await mk.sendString('abc中文')

    // //screenSave
    // await sc.screenSave(0,0,600,1000,'./ztest.png')

    // //calcSimilarity
    // r = await cp.calcSimilarity('./screen/首頁.png',  './zscreen.png', 1)
    // console.log('calcSimilarity',r)

    // //calcSimilarityAndDraw
    // r = await cp.calcSimilarityAndDraw('./screen/掉落.png', './zscreen.png', 1, './ztest.png')
    // console.log('calcSimilarityAndDraw', r)

    r = await ckPic('view', { threshold: 0.95 })
    console.log('ckPic', r)

    // let loc = {
    //     'x': 480,
    //     'y': 0,
    //     'width': 480,
    //     'height': 1080,
    // }
    // r = await ckPic('view', { ...loc, threshold: 0.95 })
    // console.log('ckPic(loc)', r)

}, 2000) //2s內須開啟指定畫面供偵測測試