Skip to content

Instantly share code, notes, and snippets.

@JavierJF
Last active March 20, 2018 18:17
Show Gist options
  • Save JavierJF/8bbd66a666807976d750204fc1d468f4 to your computer and use it in GitHub Desktop.
Save JavierJF/8bbd66a666807976d750204fc1d468f4 to your computer and use it in GitHub Desktop.
Bug: Simple function to set the StartMenu layout using Node. Powershell, and edge-ps.
gpii.windows.startMenuLayout.exportLayout = function () {
var promise = fluid.promise();
var psScript = edge.func('ps', function () {
/*
$VerbosePreference = "continue"
$ErrorActionPreference = "Stop"
$GPII_Data_Path = Join-Path $env:LOCALAPPDATA "GPII"
$CurrentLayout = Join-Path $GPII_Data_Path "menuLayouts\current_layout.xml"
function ExportLayout {
Try {
Export-StartLayout -Path $CurrentLayout -ErrorAction Stop
$error = "Success"
$msg = """"
} Catch {
$error = "Error"
$msg = $_.Exception.Message
}
$error
$msg
}
$return = ExportLayout
$return[0]
$return[1]
*/});
psScript('Node.js', function (error, result) {
if (error) {
promise.reject({
isError: true,
message: error.message
});
} else {
if (result[0] === "Error") {
promise.reject({
isError: true,
message: result[1]
});
} else {
promise.resolve();
}
}
});
return promise;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment