@@ -139,11 +139,13 @@ Drawing into the bitmap context is an important part of the MILA. Simple shapes
Every time you run any smig subcommand smig returns a value. A return value of 0 indicates success and the resulting string is valid output. Any other return value indicates that an error occurred and the value is an error code. When this happens the text returned by smig contains a short error message. A missing command option, an invalid command option value, or that an error occurred performing an action, are typical error values. When an error occurs the return string will be a short error message starting with "Error:".
To output the value returned from running smig, you insert echo $? on the line following the smig command. You can use this value to test if an error occurred and decide how to progress in your script. It is at least necessary to check whether an error occurred when you are using the result in the script. For example, when creating a base object, if an error occurs the result string won't contain the object reference but an error string. The getproperty subcommand returns a string representing the value requested, whilst the getproperties subcommand can return a long json string representing an object structure that captures all the properties returned by the subcommand. The -getstringdrawingsize action returns a string with information about the width and height needed to draw a string. All these operations will have an error string in place of the string with the information you requested, so at least in these cases, you should check the error code before proceeding.
To output the value returned from running smig, you add echo $? on the line following the smig command. You can use this value to test if an error occurred and decide how to progress in your script. It is at least necessary to check whether an error occurred when you are using the result in the script. For example, when creating a base object, if an error occurs the result string won't contain the object reference but an error string. The getproperty subcommand returns a string representing the value requested, whilst the getproperties subcommand can return a long json string representing an object structure that captures all the properties returned by the subcommand. The -getstringdrawingsize action returns a string with information about the width and height needed to draw a string. All these operations will have an error string in place of the string with the information you requested, so at least in these cases, you should check the error code before proceeding.
### Debugging
Particularly during script development, it is necessary to be able to debug your smig commands. Checking error codes as described above is essential, but there are other things you can do. You can run a single smig command on the command line and check the return value by executing the echo $? command on the following line.
Particularly during script development, it is necessary to be able to debug your smig commands. Checking error codes as described above is essential, but there are other things you can do.
MovingImages also has a log file. The log file is in the ~/Library/logs directory and is called "U6TV63RN87.com.yvs.MovingImagesAgent YYYY-MM-DD HH-mm.log" where the "YYYY-MM-DD HH-mm" part of the file name is the date and time when the log file was first created. Output is sent to the log file when something goes wrong whilst creating filter chains, rendering filter chains or drawing shapes and images. There is usually multiple messages sent for each problem, the first message outputs the object where something is missing and then each following message provides greater context within which the problem occurred until finally you get what I call railroad tracks. A line of equal signs like so "======================================" which means the end of messages relating to this particular problem.
Currently the remaining debugging support relates to the bitmap context and draw element commands. You can send a "-showwindow YES" "doaction" message to a bitmap context base object. The displayed window is a palette window that cannot be moved or resized. The only way to get rid of the window is to send a "-showwindow NO" "doaction" message. On a single display computer the window will cover a maximum of the bottom right quarter of the display, and on a computer with multiple displays the window will be displayed on the screen which currently does not have a window which has focus. While the window is displayed all drawing commands sent to the bitmap context will also be displayed in the shown window.