- Code: Select all
var field = user_briefing
var fileName = 'c:/temp/servoyFile.pdf'
var success = plugins.file.writeFile(fileName,field);
application.executeProgram('rundll32', 'url.dll,FileProtocolHandler', fileName);
This works great, except if I do it this way, I will have to write 20 different methods, since the field name (user_briefing in this case) is hard coded in. I would rather obtain the desired field name based on what "View" button was clicked. For example, the View button next to the user_briefing field is named btn_user_briefing. I use the following method to get the field name in a variable, then use that variable to hopefully accomplish the same as above.
- Code: Select all
//find the name of the button that triggered the action
var trigger = event.getElementName()
//shorten the name to eliminate the first 4 characters
var strigger = trigger.substring(4)
var fileName = 'c:/temp/servoyFile.pdf'
var success = plugins.file.writeFile(fileName,strigger);
application.executeProgram('rundll32', 'url.dll,FileProtocolHandler', fileName);
This doesn't work, the error I get is:
Can't find method com.servoy.extensions.plugins.file.FileProvider.js_writeFile(string,string)
Thoughts? Servoy 5.2.9, Windows, SmartClients.