2016-07-24 09:53:34 +02:00
|
|
|
const Launcher = require('../../comp/launcher');
|
|
|
|
const AutoTypeNativeHelper = require('./auto-type-native-helper');
|
2016-04-19 20:03:02 +02:00
|
|
|
|
2019-08-16 23:05:39 +02:00
|
|
|
const AutoTypeHelper = function() {};
|
2016-04-19 20:03:02 +02:00
|
|
|
|
|
|
|
AutoTypeHelper.prototype.getActiveWindowTitle = function(callback) {
|
2016-04-24 14:08:46 +02:00
|
|
|
Launcher.spawn({
|
2016-07-24 09:53:34 +02:00
|
|
|
cmd: AutoTypeNativeHelper.getHelperPath(),
|
2016-04-24 14:08:46 +02:00
|
|
|
args: ['--window-info'],
|
|
|
|
complete: function(err, out) {
|
2019-08-16 23:05:39 +02:00
|
|
|
if (err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
2017-01-31 07:50:28 +01:00
|
|
|
const parts = out.split('\n');
|
2019-08-16 23:05:39 +02:00
|
|
|
return callback(null, (parts[0] || '').trim(), parts[1] ? parts[1].trim() : undefined);
|
2016-04-24 14:08:46 +02:00
|
|
|
}
|
|
|
|
});
|
2016-04-19 20:03:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = AutoTypeHelper;
|