Minimize window with Javascript

Hi im looking for a way to minimize the main windows with javascript like: exeoutput.RunHEScriptCode(‘ExitPublication;’);

How can I accomplish this? I looked for in the forum, but i couldn’t find a clear response.
Thanks!

I add some code into the script file UserMain, that i found on the forum:

procedure showMainWindow;
begin
SetUIProp(“fview”,“Visible”,“TRUE”);
end;

procedure hideMainWindow;
begin
SetUIProp(“fview”,“Visible”,“FALSE”);
end;

and then in javascript i run it like: exeoutput.RunHEScriptCode(‘UserMain.hideMainWindow;’); but the app throws an error: Unknown Identifier or variable ‘UserMain’. What Am I doing wrong?

Try “UserMain.hideMainWindow” using double quote marks.

Hi, I change the javascript code with double quote marks, but still getting error: “Unknown Identifier or Variable”

image

My code is:

exeoutput.RunHEScriptCode(“UserMain.hideMainWindow;”);

and the script:

procedure showMainWindow;
begin
SetUIProp(“fview”,“Visible”,“TRUE”);
end;

procedure hideMainWindow;
begin
SetUIProp(“fview”,“Visible”,“FALSE”);
end;

It’s because you invoke the wrong function: you must use exeoutput.RunHEScriptCom(“UserMain.hideMainWindow;”);

and not RunHEScriptCode

Differences:

RunHEScriptCom function exeoutput.RunHEScriptCom(ComLine) This function lets you execute an HEScript function or procedure and returns its result (in case of a function). It is similar to the hescript:// protocol, except that you specify the command line via ComLine and a default value in DefValue if the function is not found.

RunHEScriptCode function exeoutput.RunHEScriptCode(Code) This function lets you compile and execute HEScript code specified by Code directly.

Basically, this code should also work directly in JavaScript (not tested):

exeoutput.RunHEScriptCode('SetUIProp("fview","Visible","TRUE");');

RunHEScriptCode is useful for quick HEScript commands. For longer scripts, the old invoking way is recommended.

Hi, thanks for the reply. I tried what you mentioned and now I don’t get any error, however, nothing happens. I need that the main window go minimize, when I click a button. How can I achieve this?

Hopefully you’ll find a solution. I mentioned the double quotes only because that’s all I see in the examples and ExeOutput, at times, can be very specific with its syntax.

FYI.

In another post, this is what I did for a call, and it works:

In the PHP program (jQuery script):

$(document).ready(function() {
exeoutput.RunHEScriptCom(“UserMain.DisableBack”)
});

In UserMain:

procedure DisableBack;
begin
 SetUIProp("Toolbar1bbackward", "Enabled", "FALSE");
end;  

I tried again, but it didn’t work. Maybe im explaining myself wrong. The app is setup without title bar and runs as kiosk mode. I create buttons to close and minimize the app. Close works without problems, and I need a way to minimize the app to the windows taskbar, as any window in windows O.S. but i can’t find a way

Any news about this? Maybe a different approach? Is there a way to “on-off” the kiosk mode by script? With this, i would have a chance to show the native buttons (close, minimize, maximize) or hide it. This, because the app will work in both modes (digital signage = Kiosk mode and Normal mode = editor)

Try:

procedure hideMainWindow;
begin
TrayHideMainForm;
end;

procedure showMainWindow;
begin
TrayShowMainForm;
end;

I did this and it doesn’t work :frowning:



image
I try both ways: RunHEScriptcom and RUNHEScriptcode
What Am I doing wrong?