Added OSA script function. Changed version number
This commit is contained in:
@@ -463,7 +463,6 @@ exports.check_file_cache_and_open_local_file = async function ({host_file_cache_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Kill processes
|
// Kill processes
|
||||||
// Updated 2022-05-06
|
// Updated 2022-05-06
|
||||||
exports.kill_processes = async function ({process_name = null}) {
|
exports.kill_processes = async function ({process_name = null}) {
|
||||||
@@ -498,4 +497,55 @@ exports.kill_processes = async function ({process_name = null}) {
|
|||||||
|
|
||||||
// process.kill(pid, 0); // Special case test if process exists
|
// process.kill(pid, 0); // Special case test if process exists
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Run raw osascript
|
||||||
|
// Updated 2022-05-07
|
||||||
|
exports.run_osascript = async function ({command=null, interactive=false, language=null, flags='h', program_file=null}) {
|
||||||
|
console.log('*** Electron framework export: kill_processes() ***');
|
||||||
|
console.log(command);
|
||||||
|
|
||||||
|
if (os.platform == 'darwin') {
|
||||||
|
} else {
|
||||||
|
console.log('Not available for this platform. macOS (darwin) only.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let osascript_str = '';
|
||||||
|
|
||||||
|
if (Array.isArray(command)) {
|
||||||
|
console.log('List of command strings');
|
||||||
|
let commands_str = '';
|
||||||
|
for (let i = 0; i < command.length; i++) {
|
||||||
|
commands_str += `-e '${command[i]}'`;
|
||||||
|
}
|
||||||
|
osascript_str = `osascript ${commands_str}`
|
||||||
|
|
||||||
|
} else if (typeof command === 'string') {
|
||||||
|
console.log('Single command string');
|
||||||
|
osascript_str = `osascript -e '${command}'`;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (language) {
|
||||||
|
console.log(`Language: ${language}`);
|
||||||
|
osascript_str = `${osascript_str} -l ${language}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags) {
|
||||||
|
console.log(`Flags: ${flags}`);
|
||||||
|
osascript_str = `${osascript_str} -s ${flags}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`OSA Script String: ${osascript_str}`);
|
||||||
|
child_process.exec(osascript_str, (err, stdout, stdin) => {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log(stdout);
|
||||||
|
console.log(stdin);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Finished');
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "aether_app_native",
|
"name": "aether_app_native",
|
||||||
"productName": "Aether App: Native",
|
"productName": "Aether App: Native",
|
||||||
"version": "3.2.1",
|
"version": "3.2.2",
|
||||||
"description": "One Sky IT's Native Aether App",
|
"description": "One Sky IT's Native Aether App",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user