A job preset is an XML script stored in the presets database. It is executed in an Execute action as the first action of the job:

  • From the command line option: -pj (e.g. sapio365.exe -j "MainFrame/051-sharedFilesByType.xml" -pj "MainFrame/051-sharedFilesByType-1.xml"")
  • By double-clicking it in the Job Center Configuration.
  • With -pj or from double-click, the preset is loaded as an Execute action and run before all actions from the job (same as -px with -x).

Detailed Description

Presets can be:

1. Imported:


An imported preset is a regular automation script from an XML file. It is validated upon import, just like a regular script. It can be any type of script.



2. Generated by the application:



A generated preset is made from the content of the selected job.

The generation process analyzes the actions in the selected job and processes UserInput actions only.
It recursively loads jobs in Execute actions and processes their UserInputs.

For each UserInput, the process pops up the corresponding dialog and records the entered values as SetVar actions. See the example below...


Example - MsgBox job is:

<ytriaAutomation Application="sapio365">
	<UserInput>
		<Variable name="Taxation" value="theft" Label="Taxation is" Tooltip="BUT WE NEED ROADS!" Type="Text"/>
		<Variable name="Information" value="www.zerocracy.xyz" Label="Information" Tooltip="THE DOC" Type="Text"/>
	</UserInput>
	<MsgBox Title="WHAT WE KNOW" Message="Taxation is {%Taxation%}" MessageExtended="{%Information%}" Type="eXclamation"/>
</ytriaAutomation>
XML


<ytriaAutomation Application="sapio365">
	<UserInput>
		<Variable name="Taxation" value="theft" Label="Taxation is" Tooltip="BUT WE NEED ROADS!" Type="Text"/>
		<Variable name="Information" value="www.zerocracy.xyz" Label="Information" Tooltip="THE DOC" Type="Text"/>
	</UserInput>
	<MsgBox Title="WHAT WE KNOW" Message="Taxation is {%Taxation%}" MessageExtended="{%Information%}" Type="eXclamation"/>
</ytriaAutomation>
XML


When executed without a preset, the application pops-up the UserInput dialog:



In order not to interrupt the job execution (for example when a scheduled task is created, we do not want the script to wait for human input), a preset is created to feed the variables set by the UserInput dialog.


The generated Preset for MsgBox job is:

<ytriaAutomation Application="sapio365" Console="False">
	<SetVar Information="www.zerocracy.xyz"/>
	<SetVar Taxation="theft"/>
	<UsePreset Value="True"/>
</ytriaAutomation>
XML



There is one SetVar per Variable set in the original script UserInput actions. A single UsePreset action is added to shut down the UserInput at run time. UsePreset is a toggle. When set to FALSE, UserInput is brought back from the dead and interrupts the execution again.


Preset generation only:

PreparePreset
This action is a scope for preset generation: UserInput and Execute actions inside PreparePreset are processed at preset generation time. All other actions are executed as a regular automation. The content of PreparePreset is ignored at job run time. For example, the UserInput in the following script is processed to generate a preset containing the corresponding SetVar. But at regular job runtime (whether from command line, double click from the backstage or click from the Job Center), it is ignored.


Example Script

<ytriaAutomation Application="sapio365">
	<PreparePreset>
		<UserInput>
			<Variable name="Taxation" value="theft" Label="Taxation is" Tooltip="BUT WE NEED ROADS!" Type="Text"/>
			<Variable name="Information" value="www.zerocracy.xyz" Label="Information" Tooltip="THE DOC" Type="Text"/>
		</UserInput>
	</PreparePreset>
	<MsgBox Title="WHAT WE KNOW" Message="Taxation is {%Taxation%}" MessageExtended=" {%Information%}" Type="eXclamation"/>
</ytriaAutomation>
XML


Example Script

<ytriaAutomation Application="sapio365" console="false">
	<PreparePreset>
		<SetVarListsFromGridColumns target="ShowUsers" cities="city" positions="jobTitle"/><!--make lists of cities and job titles from user module-->
			<UserInput Title="Select city and position">
					<Variable name="City" Label="Select city" Tooltip="The unique cities from ShowUsers" Type="List">
						<ListItem ListName="cities" value="cities"/>
					</Variable>
					<Variable name="Position" Label="Select position" Tooltip="The unique positions from ShowUsers" Type="List">
						<ListItem ListName="positions" value="positions"/>
					</Variable>
			</UserInput>
		<MsgBox Title="Selection made" Message="City is {%City%}" MessageExtended="Position is {%Position%}" Type="eXclamation"/>
	</PreparePreset>
	<userinput Title="Trace email...">
		<Variable name="state1" label="This job searches for messages that meet the following conditions:" Type="label"/>
		<Variable name="vsender" value="{%City%}" Label="City:" />
	</userinput>
</ytriaAutomation>
XML