2023-09-28 13:15:29 +02:00
|
|
|
function Node_Shell(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
2024-03-28 14:18:02 +01:00
|
|
|
name = "Execute Shell";
|
|
|
|
setDimension(96, 32 + 24 * 1);
|
2023-09-28 13:15:29 +02:00
|
|
|
|
2024-08-09 13:30:09 +02:00
|
|
|
inputs[0] = nodeValue_Path("Path", self, "");
|
2023-09-28 13:15:29 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[1] = nodeValue_Text("Script", self, "");
|
2023-09-28 13:15:29 +02:00
|
|
|
|
|
|
|
insp1UpdateTooltip = "Run";
|
|
|
|
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
|
|
|
|
|
2024-02-15 14:23:26 +01:00
|
|
|
trusted = PROGRAM_ARGUMENTS._trusted;
|
2023-10-04 05:52:20 +02:00
|
|
|
|
2024-02-15 14:23:26 +01:00
|
|
|
static onValueUpdate = function() { trusted = false; }
|
2023-10-04 05:52:20 +02:00
|
|
|
|
2023-09-28 13:15:29 +02:00
|
|
|
static onInspector1Update = function() { update(); }
|
|
|
|
|
|
|
|
static update = function() {
|
2023-10-02 08:57:44 +02:00
|
|
|
var _pro = getInputData(0);
|
|
|
|
var _scr = getInputData(1);
|
2024-06-08 06:31:21 +02:00
|
|
|
if(_pro == "" && _scr == "") return;
|
2023-09-28 13:15:29 +02:00
|
|
|
|
2023-10-04 05:52:20 +02:00
|
|
|
if(trusted) {
|
2023-11-03 14:43:28 +01:00
|
|
|
shell_execute_async(_pro, _scr);
|
2023-10-04 05:52:20 +02:00
|
|
|
} else {
|
|
|
|
var dia = dialogCall(o_dialog_run_shell);
|
|
|
|
dia.setData(self, _pro, _scr);
|
|
|
|
}
|
2023-09-28 13:15:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
|
|
|
var bbox = drawGetBbox(xx, yy, _s);
|
2023-10-02 08:57:44 +02:00
|
|
|
var txt = getInputData(0);
|
2023-09-28 13:15:29 +02:00
|
|
|
|
|
|
|
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text);
|
|
|
|
draw_text_bbox(bbox, txt);
|
|
|
|
}
|
|
|
|
}
|