Last active
August 29, 2015 14:28
-
-
Save mindspank/17ebb8cc1e764eca539f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var qsocks = require('qsocks'); | |
var serializeApp = require('serializeapp'); | |
var fs = require('fs-extra') | |
var Promise = require('promise'); | |
function create() { | |
qsocks.Connect() | |
.then(function(global) { | |
return global.openDoc('Executive Dashboard.qvf') | |
}) | |
.then(function(app) { | |
return serializeApp(app); | |
}) | |
.then(function(data) { | |
return writeJson(data); | |
}) | |
.then(function() { | |
return console.log('Done') | |
}) | |
.catch(function(error) { | |
console.log(error) | |
}).done(function() { | |
process.exit(1); | |
}); | |
}; | |
function writeJson(data) { | |
return new Promise(function(resolve, reject) { | |
fs.writeJson(data.properties.qTitle + '.json', data, function (err) { | |
if(err) { return reject(err); } | |
return resolve(); | |
}) | |
}); | |
}; | |
create(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment