rejetto forum

Exec on button trigger

vbn · 2 · 2118

0 Members and 1 Guest are viewing this topic.

Offline vbn

  • Occasional poster
  • *
    • Posts: 36
    • View Profile
I wanted to have a button next to each file in last column which when clicked is supposed to call an exe with the full file path as argument.

In then [+file] section , I added following in last column :
<form><input type='submit' onClick="{.exec|C:\prog.exe|out=#temp.}"></form>

however, this seems to be getting called for each file that is being 'displayed' and not waiting for any clicks....can someone guide me to a proper way of doing this ... also page needs to refresh once exe is done


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
It is a server side macro, not client side.

You would have to redirect to a 'virtual page' that executes the file you want, then redirects you back... or use AJAX for it to happen without page changing. It is a bit complex to explain... you seem to know the basics so here goes nothing, this will be untested but just a suggestion for how to manually do it.

Send the file name and the page you are on to a 'virtual page' in the HFS template:

Code: [Select]
onclick="window.location('/application.html?location=%encoded-folder%');"
Now for the 'virtual page', this is where it happens:

Code: [Select]
[application = application.html]

{.comment| Execute the file before sending the page and redirecting. .}
{.exec|C:\prog.exe|out=#temp.}

{.comment| Show some information and redirect. .}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Run Application</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="robots" content="noindex,nofollow"/>
<meta http-equiv="REFRESH" content="2;url={.?location.}">
<script type="text/javascript">
// You can use this if meta wont work!
// window.location = "{.?location.}"
</script>
</head>
<body>
<h3>- Application <i>"prog.exe"</i> was executed, redirecting back to location <i>"{.?location.}"</i>...</h3>
</body>
</html>

« Last Edit: August 21, 2010, 01:00:51 PM by TSG »