I’ve been asked to help solve a browser issue that I think Watir and
Ruby2Exe may be able to solve. However, I ask the group for a quick
reality check before proposing a solution and heading into the deep
unknown (at least for me).
There is a browser based application written in Flash Action Script that
needs to write an XML file to the local disk. Picture a salesman with a
USB flash drive that he can use at a customer’s site. All the files are
on the flash drive and a remote server is never contacted so the
application is completely client side. To start the application, a
browser is fired up and the local file opened from the flash drive which
is a form with several list boxes that the customer can choose various
options and then submit the form. What should happen is a XML file is
then written to disk which the application uses in several ways further
downstream including applying an XSLT transformation to display the
The specification targets IE6, IE7 and Firefox running on XP and Vista.
The catch is that none of these browsers allows files to be written to
ECMAScript, etc. are used. So the problem is once the form is submitted
and the Flash Action Script has the output XML ready, how to circumvent
security and get the XML file written to preferably the same drive and
directory the application was launched from.
Having never programmed in Flash Action Script, my first hopefully
correct assumption is that Flash will be able to call an executable
created by Ruby2Exe from the browser to execute it. If so, the
executable could be Watir programmed to open a new browser window,
Action Script sending the XML output to the browser window, and then
Watir doing a “Save Page As…”, and then Watir closing the browser
window and returning control to the Flash application to do its thing
A key assumption in this sequence is that once Watir opens the browser
window, Action Script can communicate with the new window to pipe the
XML output (standard UTF-8) to it. Perhaps a simpler scenario is if
Action Script can open the executable and pass through ARGV either the
XML output or the form parameters (if the XML is too big for ARGV), Ruby
can do all the lifting without Watir and simply create and/or write the
Is what I described possible? Are there other solutions for
accomplishing this? The application is nearing completion and this piece
is becoming trickier than expected.
Thanks in advance!