I am trying to execute a windows batch file from within servoy. I cant see anyone doing this on the forum, nut have got the execute in background statement to not come up with an error, but yet the file doesn’t seem to run:
application.executeProgramInBackground( '"C:\\Program Files\\COREX\\Corex Local\\postupdatetest.bat"')
``` (single quotes outside double ones).
this line works fine from the run prompt (obviously without the double backslahes.
Has anyone had experience of running .bat files from within servoy?
Thanks
David
I think that does work. My problem and the reason I am doing this (although a bit wacky!) is to create a servoy offline solution that is capable of updating itself!
On the Mac it work fine. I download the new sybase repository file using ftp, copy the .db into the database folder, delete the old log file and immediately close the solution.
On starting again, it creates a new log file and hey presto, I have just cracked the chestnut of providing updates using servoy for a servoy offline solution.
On good old Windows, none of the Java file functions, to delete or move files onto what is a read only sybase file in use, work.
So my aim her was to create a bat file that ran in the background with a 5 second pause that when the application quit would move the files and replace the servoy_repository file once sybase which closes on application shutdown released the lock!
This does the trick from the command line. The problem i think is that as soon as servoy closes it must stop the bat file running as it is the parent of the process. Or thats what i think.
Many moons ago in Perl, I would have switched the standard input from the requesting web browser! (crashed Demons servers in 1995 doing that when writing a robot the could function without my dial up connecting costing me a fortune.)
So I challenge any windows servoy techies out there:
How can i force delete or move a file from java that will overwrite a windows read only file that is in use or
Is there anyway to sporn a .bat process that will continue after Servoy shuts down until complete. The reason I need a few seconds is for Sybase to close and release the servoy_repository files from being in use.
what do you mean with web-client?
The most recent versions of Servoy only run Titanium Client (TiNG)
Any of the previous client-flavours (smart-client, web-client, NG-client) are deprecated and should be updated to TiNG to allow for future support.
Anyway, any of the web-based clients run their code serverside.
This means that any action or process that requires Java (like the application.executeProgram) will run server-side.
If you need to have interaction with client-side OS, this is only possible using the (Ti)NG-client and the corresponding service-packages that you can install through the Package Manager.
I assume you are currently testing in developer and here’s one big gotcha: in developer your client (browser) and server (java) are running on the same machine.
Therefor, if you’re trying to interact with a file on your desktop, this seems to work in developer as the server-part is able to access your desktop.
Once deployed, the code will still work but can only access a file on the desktop of the server, not your client desktop.
I guess the direction you are trying to go now is impossible, but a little hard to judge as there is no further context on what you want to achieve executing this batch file.
The batch-file is only on the developer-PC so that we can access it during testing. Once ready it will move to the server so that it can be accessed.
The idea is to start the batch file on the server so that it starts a mkdir or robocopy, so nothing the user will interact with.
The problem is, that calling it like this works in the developer, but this way I cannot give any parameters to the batch file: