Worflows can be launched with a "-A" parameter to load and execute a workflows file (.mwf)
Example (on Windows): Let's suppose Worflows is installed using the default paths, and we have our workflows file stored here:
C:\My Workflows\My Workflow.mwf
Then the command that we need is this one:
"C:\Program Files\SGO Apps\Mistika Workflows\bin\workflows.exe -A "C:\My Workflows\My Workflow.mwf"
We can put this command in a scheduled task of the operating system, so that it will force to be always running, if it crashes or if the user logout and login again.
Before we continue, open a cmd console and execute the above command manually. You should see that it will open Mistika Workflows, then it will load the .mwf file and it will execute its workfows automatically.
Once you confirm that the command line does what you want let's create an operating system task that will load it automatically after the user log on, and then if will check every 5 minutes if it still working or if it crashed, and if it crashed (or if somebody closed it) it will launch it again automatically:
1 - In the windows search field type: Task Scheduler (and press enter)
2 - Click Actions -> Create Task (make sure you click on "Create Task" , not "Create basic task" which is not enough or our pursposes). A new dialog "Crete Task" will open:
3 - Type a name for the task, for example: "Relaunch Workflows on login and if it crashes"
4 - Activate "Run only when user is logged on" (this is important, as Workflows can not run without a graphics session).
5 - Click on "Configure for:" and select your Windows version (or the most similar to it)
6 - Select Trigger -> New, and select this options:
* Begin the task -> At log on
* Specific user (your worflows user should be selected)
* Advanced Settings:
Repeat task every -> 5 minutes
For a duration of -> indefinitely
Deactivate "Stop all running tasks at end of repetition duration"
Deactivate "Stop task if it runs longer than"
Deactivate "Activate" and "Expire"
7 - Select Actions -> "New", then select these options (according to the above example):
Action -> Start a program
Program/scrtipt: "C:\Program Files\SGO Apps\Mistika Worklfows\bin\worflows.exe"
Add arguments: -A "C:\My Workflows\My Workflow.mwf"
8 - Now in the "Conditions" tab:
Deactivate "Start the task only if the computer is idle for"
Deactivate "Start the task only if the computer is on AC power"
Activate "Wake the computer to run this task"
9 - In the settings tab:
Activate "If the task fails, restart every" and select "1 minute"
Attempt to restart up to: 10 times (logically if it fails more times in a row it does not make sense to try harder, something else must be wrong...)
Deactivate "Stop the task if it runs longer than"
Deactivate "if the running task does not end..."
Deactivate "if the task is not scheduled to run again, delete it after"
Select "If the task is already running, then the following rule applies:
"Do not start a new instance"
10 - Press Ok to finish task creation.
The scheduled task will appear in the task list, and it is ready to test. To confirm that it works:
- Logout and login. You should see how Workflows will open, load the .mwf file, and execute all the workflows in the .mwf file automatically.
- Now kill the Workflows application using the Task Manager (to simulate a crash)
- After maximum 5 minutes you should see how it is launched again.
Note: There can be a limitation with Watcher nodes: If a new file lands inf the watcher folder after a crash but before it is restarted then the watcher node will not realize the new file until a new one lands in the watcher folder (which is the trigger for this node), at which point it will process both files. This should be enough for most users. If that is not enough for your case you could add an extra workflow with a copy node, to copy a dummy file to the watcher folder (thus forcing it to check the folder content)
Note: If you need to stop the automatic task for a while, remember that you can open the Task Scheduler, select the task and disable it temporally.