Can we run a Windows power shell or DOS batch script file through Filemaker application?
Sure, there's probably many demo files floating around, I did a session on this at Devcon more than 10 years ago.
Different ways to do it, it can certainly be done with plugins. Without plugins it comes down to this:
1- store the syntax is a field
2- output it (after adding anything to it that is data drive from your solution) through the Export Field Contents script step
3- run it with the Send Event script step
4- clean up with a one-line "cmd /c del ..." line through the Send Event script step
If the batch file or ps file already exists outside of FM you can do just step 3.
Know that if you are thinking a batch file: you don't actually need to create the batch file outside of FM, you can run multiple command line commands by stringing them together:
"cmd /c command1 && comand2 && comand3..."
We use this to get users to log off the server when they are done:
But you can also call other programs:
"C:\<somepath>\Somefile.exe " & $$SomeVariable
You can also call powershell or apple script. If you write files to the temp directory - you can use scripts like these to clean up after yourself.
wimdecorte and mattel is entry correct. However, I find it a lot easier to run shell scripts using the free Base Elements plugin.
hellberg wrote: wimdecorte and mattel is entry correct. However, I find it a lot easier to run shell scripts using the free Base Elements plugin.
That can be done as well - however - I try to not use plugins whenever possible. I might have to cave in and use Base Elements, but I haven't had to yet. It does however add a lot of functions that should be native in FM.
Can you give me the exact script syntax for the batch script to call from Filemaker application?
Does it run .exe files extension also in Filemaker application?
Using the Send Event it would be a s simple as "cmd /c c:\somewhere\myfile.bat"
And yes, the Send Event can execute anything that Windows can open. If you feed it a word document for instance, the OS will tell Word to open it.
Retrieving data ...