mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-17 21:16:57 +08:00
增加发送文本到窗口
This commit is contained in:
parent
7745466189
commit
f5f435f085
28
preload.js
28
preload.js
@ -1,10 +1,14 @@
|
||||
const fs = require('fs');
|
||||
const { shell } = require('electron');
|
||||
const { shell, clipboard } = require('electron');
|
||||
const { dialog, BrowserWindow, nativeImage } = require('electron').remote
|
||||
const path = require("path")
|
||||
const { exec } = require('child_process');
|
||||
const robot = require('./robotjs')
|
||||
|
||||
dirname = __dirname;
|
||||
|
||||
isWin = process.platform == 'win32' ? true : false;
|
||||
|
||||
open = url => {
|
||||
shell.openExternal(url);
|
||||
}
|
||||
@ -35,3 +39,25 @@ messageBox = (options, callback) => {
|
||||
exists = path => {
|
||||
return fs.existsSync(path);
|
||||
}
|
||||
|
||||
readDir = (path,callback) => {
|
||||
fs.readdir(path, (err, files) => {
|
||||
callback(err, files);
|
||||
});
|
||||
}
|
||||
|
||||
dash = query => {
|
||||
let cmd = process.platform == 'win32' ? `start dash-plugin://query=${query}` : `open dash://${query}`
|
||||
exec(cmd, (err, stdout, stderr) => {
|
||||
err && console.log(stderr);
|
||||
});
|
||||
}
|
||||
|
||||
copyTo = text => {
|
||||
clipboard.writeText(text)
|
||||
}
|
||||
|
||||
paste = () => {
|
||||
var ctlKey = isWin ? 'control' : 'command';
|
||||
robot.keyTap('v', ctlKey);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user