closed
Public

I am attempting to have a submit button execute an external batch program when it is clicked.  I am sure it’s something simple, and I am missing it in the manual, but is there a simple way to go about this?
 
Thanks in advance,
Matthew

1 answer

Staff February 5, 2015

Hi Matthew, maybe you can use the “Go to URL” action, and specify the URL like “file:///C:/test/test.bat”. The figure below shows an example.
http://oi60.tinypic.com/2yl4vbo.jpg
 

#1
  1. Awesome ViVi! Thanks again, you are the best! Utilizing this method, is it possible to not call a secondary window as the batch file I am calling is simply performing a task in the background to be utilized from a later screen in the plot.
  2. ViVi Staff February 6, 2015
    If you change the target of "Go to URL" to "_self", it will not open new window, but as a result it will replace your simulation, which I guess is not what you want. If you wish to have it done in the background, maybe you should place an invisible (or very small) iFrame element and set its URL to the bat file. Haven't tried that but I hope it will work.
  3. Hi ViVi. I did attempt to try the invisible iFrame technique and it really doesn't do what needs to be done. Do you know of any other way that the calling of an external file could be handled. The batch file is designed to move an image into a drop folder, but it needs to occur completely out of site of the viewer.
  4. ViVi Staff February 12, 2015
    Hi Matthew, the iFrame trick should work. Since iFrame is just an embedded web browser window, if the "Go to URL" action works for you, the iFrame should work as well. Can you tell us the result you got from iFrame?

    Meanwhile, there are other ways to do this, but even more complex. For example, you can run a web server and wrap the bat file as a JSON API, so you can use the "Get JSON Object" action to call the API and trigger that bat file. It needs a web server to run, and I guess it is kind of overkill for your case.
  5. ViVi, does Fore support the usage of VB Scripts or only JavaScripts? My lead developer created a VBS script that would handle the command seamlessly; however, it doesn't appear that Fore is processing the script.
  6. ViVi Staff February 13, 2015
    Hi Matthew, VBScript is not officially supported but we have Html element in ForeUI, which means you can inject any code into the simulation. So I guess you may use Html element to add VBScript code.
  7. Hi ViVi. So I ended up utilizing a web server, and changed the coding of my background application to an .aspx script; however because it is still a "Go to URL" call it is still opening another browser tab. I have embedded a 20x20 pixel hidden iFrame, and am calling it as the target from the "Go to URL", but the simulation is still calling a new browser tab.Any suggestions?
  8. ViVi Staff February 16, 2015
    Hi Matthew, if you take the web server approach, you won't need iFrame any more, also you should not use the "Go to URL" action in this case. Instead you will use "Get JSON Object" or "Get Remote Content" action. If your URL response nothing or plain text string, just take the "Get Remote Content" action; if your URL response JSON object, you should go with "Get JSON Object" action.
  9. Thanks ViVi, I will give both options a try and see what will work best!
  10. ViVi, I attempted to use the "Get Remote Content" action, but nothing is happening. Does this action actually run the .aspx, or is it simply looking for it's result? I have attached the button control to show you what I have done.
  11. Here is the current configuration:For Element Button_3 Element Clicked Get Remote Content from "http://localhost/ICImport.aspx?icimport=M0001285" and Save to {result} Property
  12. ViVi Staff February 16, 2015
    The "Get Remote Content" action will run the .aspx, and grab its response if any. But I forgot to mention that the "Get Remote Content" action uses YQL proxy (http://en.wikipedia.org/wiki/YQL) to retrieve data from different domain, so it will not work if your web server is not running in Internet, since the YQL proxy could not access your web server.

    In your case, it is better to use the "Get JSON Object" action and implemnet your .aspx page as a JSONP API.

    You can take a look at: http://www.foreui.com/foreui/use-jsonp-api-in-foreui-plot/

    Here is an example for PHP, and ASP should be very similar with it: http://www.foreui.com/forum/i_having_problems_with_foreui_and_php_trying_to_get_a_json_variable/

This question is now closed