Commit 95802887 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent cc9c15dd
const screenshot = require('screenshot-desktop') import { createWorker } from 'tesseract.js';
var robot = require("robotjs");
const pixelmatch = require('pixelmatch'); const worker = createWorker({
var Jimp = require('jimp'); logger: m => console.log(m)
let fs=require('fs') });
screenshot({ filename: 'shot2.png' }).then((imgPath) => { (async () => {
await worker.load();
}) await worker.loadLanguage('eng');
await worker.initialize('eng');
const { data: { text } } = await worker.recognize('shot10.png');
test2() console.log(text);
await worker.terminate();
async function test2() })();
{ \ No newline at end of file
await sleep(4000)
screenshot({ filename: 'shot10.png' }).then((imgPath) => {
})
}
async function test() {
var img = robot.screen.capture(0, 0);
// new Jimp({data: img.image, width:1920, height:1080}, (err, image) => {
// image.write('test.png');
// });
let d= await fs.readFileSync('output.txt')
// console.log(img)
// await sleep(5000)
// var img2 = robot.screen.capture(0, 0);
const numDiffPixels = pixelmatch(img.image, d, null, img.width, img.height, {threshold: 0.1});
console.log(numDiffPixels)
}
async function sleep(millis) {
return new Promise(resolve => setTimeout(resolve, millis));
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment