Passing parameters to an exe when reloading via Javascript

webguy22

Member
This is a followup to topic http://www.gdgsoft.info/how-section-f41/can-pass-parameters-the-exe-t2456.html

First, I placed the above PHP code at the top of my PHP file right after session_start();:
<?php print_r(exo_return_hescriptcom("MyScript.GetPassedParameter|1","HESCRIPT_MISSING")); ?>
And added the script to the compile:

function GetPassedParameter(p_iIndex:Integer): String;
begin
Result := ParamStr(p_iIndex);
end;

When running the exec, I receive:

Fatal PHP Error: Script not found: MyScript

This is probably a simple/dumb solution. Not sure what else to do with “MyScript”.

But my real issue is reloading the exec within a form.

Example:

Have abc.php. There’s an HTML form inside with two selection inputs. When you enter the first selection input, the second is auto-filled with values based the the first selection. For example, the first selection is to choose a folder. Once that is chosen, the second selection is filled with list of files from that folder. I use onchange to reload the form and pass it a query.

function reload(form)
{
var val1=form.folder.options[form.folder.options.selectedIndex].value;
self.location=‘abc.php?folder=’ + val1 ;
}

When the form is reloaded, I know the folder name and run code to capture the files from the folder and place them in the second input selection.

I believe this is pretty normal stuff when handling fields that you wish to repopulate based on previous input.

This leads me to why I’m trying to pass parameters to the exec file. See the javascript funtion. If I can get the passing parameters to work, would I change the call to “self.location=‘abc.exe?folder=’ + val1;” ? Or something else? Can I even do this query? Should I pass the parameter a different way?

Thanks
 
Last edited:
The problem may be where you pasted:
Code:
function GetPassedParameter(p_iIndex:Integer): String;
begin
Result := ParamStr(p_iIndex);
end;
If you pasted it into the “UserMain” script, then change your code to:
Code:
<?php
print_r(exo_return_hescriptcom("**UserMain**.GetPassedParameter|1","HESCRIPT_MISSING"));
?>
 
Last edited:
Yes, that fixed that issue. Thank you.

Regarding calling the program, with a query, in javascript, I guess I could set a global variable instead of using the query. But I’m not sure of the syntax to use to call/reload the exe. Can you help? Please see self.location.

function reload(form)
{
self.location=‘abc.exe’ ;
}
 
Last edited:
From what you posted it sounds like you are simply trying to reload the display of the application? You can do that by using the following:

window.location = “ghe://heserver/whatever.php”;

Where whatever.php is the php script you want to load. Since it’s just an internal web server within the application you don’t need to reload the exe (nor can you with javascript), you just reload the script. Hope that helps.
 
Last edited:
Thank you for replying. Wasn’t sure if I could call the exe from Javascript.

I found a workaround using PHP to reload the page (and do what I needed to do without calling javascript).

I now better understand how ExeOutput works too.

You can close this topic.
 
Last edited:
Back
Top