Skip to main content
Skip table of contents

Job Center Presets and PreparePreset

A job preset is an XML script stored in the presets table. 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.

Exception to this rule: SetVarForUsageReport: creating a job preset for ShowUsageReport


It recursively loads jobs in Execute actions and processes their UserInputs. The UserInput may be inside or outside a PreparePreset block.

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

When a UserInput should be ignored during a preset, set the attribute IgnoreInPreset to "True".


Example - MsgBox job is:

XML
<ytriaAutomation Application="sapio365">
	<UserInput>
		<Variable name="Tutorial" value="Documentation" Label="Tutorial is" Tooltip="This is a tooltip" Type="Text"/>
		<Variable name="Information" value="www.ytria.com" Label="Information" Tooltip="THE DOC" Type="Text"/>
	</UserInput>
	<MsgBox Title="The documentation is available" Message="Tutorial is {%Tutorial%}" MessageExtended="{%Information%}" Type="eXclamation"/>
</ytriaAutomation>

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:

XML
<ytriaAutomation Application="sapio365" Console="False">
	<SetVar Information="www.ytria.com"/>
	<SetVar Tutorial="Documentation"/>
	<UsePreset Value="True"/>
</ytriaAutomation>


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

XML
<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>



JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.