How Do I Run External Processes Automatically? (Magic xpa 2.x)
When Magic xpa starts up, you can launch a file of command that will execute automatically. These commands can be macro commands that will do things within Magic xpa, such as importing or exporting objects, moving to a certain part of the Studio, or typing text.
To run external processes, you need two things:
The command file has its own syntax and set of commands. These are the same commands that can be used with the Tools Infrastructure in How Do I Add External Tools to the Studio?” for the Pre- and Post- command files. The exact syntax is in the Magic xpa Help, but basically each command replicates what goes on when you do the same operation manually from within Magic xpa. Here is an overview of the commands:
-
Export: Exports an application, or pieces of an application. This is useful if you want to back up all projects at midnight, for example.
-
Import: Imports an application, or pieces of an application
-
ECF: Creates a cabinet file from an application. This is useful if you want to create a cabinet file of all applications in one batch process.
-
Get definition: Imports the definition of an SQL table.
-
Project: Opens a project
-
Simulate: Simulates going to menu items or typing on the keyboard
There are also Global Parameters you can query, to get specific information about an application, such as how many programs or models are in the application.
Once you have the command file in place, you need to set up Magic xpa to automatically execute it. Since the command file can, in fact, create the project you are going to open, the command file cannot be in the project. So it is set up in the Magic.ini file. Adding the following line:
AutomaticProcessingSequenceFile=%Path%Filename.txt
to the [MAGIC_ENV] section will cause the command file Filename.txt in the directory pointed to by %Path% to be executed.
There may be instances where you want the processing to happen in the background, and not open up the application at all. For instance, you might want to simply export an application into a document. In this case, you can set up the Magic.ini so it executes the commands, then quits. You do this by adding the line:
AutomaticProcessingMode= B
to the [MAGIC_ENV] section.