rejetto forum

Exec on button trigger

vbn · 2 · 1620

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]
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. .}

{.comment| Show some information and redirect. .}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<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.}"
<h3>- Application <i>"prog.exe"</i> was executed, redirecting back to location <i>"{.?location.}"</i>...</h3>

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