How to take a snapshot from the command-line

miXscope_xclc
miXscope External Command-Line Control

Overview
Allows other applications to set the functionality within miXscope and take a snapshot. All options will be written to a file in the current directory and then opened by the miXscope application. All command-line variables are optional.

Usage: miXscope_xclc [-option "option_value"]

Options
-app_path full_path_name
The -app_path option indicates where to find the miXscope.app application. If the -app_path option is omitted and miXscope is already running, this instance of miXscope will be used. If the -app_path option is omitted and miXscope is not already running the system will launch the first copy of miXscope it finds.

-averaging number_of_frames
The -averaging option will perform frame averaging for a specific number of frames, specified by number_of_frames value, before taking the snapshot. If an -effect option is specified, this option will be ignored. The minimum value for number_of_frames is 2.

-cmd option_value
Currently, the only option_value supported is "quit". This will cause the miXscope application to close or quit.

-effect special_effects_menu_title
The -effect option will enable the special effect feature using the special_effects_menu_title string. The special_effects_menu_title string needs to match the menu title in the Effects menu. The -effect option will cause the -averaging option to be ignored.

-filename filename_string
The -filename option indicates the name that will be used for the saved snapshot image. The appropriate extension of "png", "tif", or "jpg" will be automatically appended to the filename. If the -filename option is omitted, the default preference filename format will be used.

-filepath full_path
The -filepath option indicates the location where the snapshot image should be saved. If the -filepath option is omitted, the default preference location for snapshot images will be used.

-filetype image_format
The -filetype option will save the snapshot image using the format specified by the image_format value. The image_format value should be png, jpg, jpeg, tif, or tiff. If the -filetype option is omitted, the default preference file type for snapshot images will be used.

-imageclip yes_or_no
The -imageclip option determines if the snapshot will be added to the Clips Control Panel. The only option values supported are "yes" or "no". If the -imageclip option is omitted, the snapshot will automatically be added to the Clips Control Panel.

-iphoto album_name
The -iphoto option will add the snapshot image to the iPhoto library. The album_name needs to represent an existing iPhoto Album name. If you don't want to add the snapshot image to a specific album, but only to the main iPhoto Library, the album_name value should be "". If the -iphoto option is omitted, the snapshot will not be added to the iPhoto Library.

-lamps lamp_state
The -lamps option will turn on a specific lamp or turn both off. The following are the only supported lamp_state variables, "top", "bottom", or "off". "top" will turn the top lamp on and turn off the bottom lamp. "bottom" will turn the bottom lamp on and turn off the top lamp. "off" will turn both the top and bottom lamps off. The -lamps option is only supported by the QX3/QX3+ and QX5 microscopes. Note: A snapshot will not be taken when the -lamps option is used.

-text comment_string
The -text option will display a text comment on the image. If the comment_string is "" (empty quotes) the text comment feature will be disabled.

-textpos text_xy_position
The -textpos option will adjust the x,y coordinates of the text comment string. If either of the x,y coordinates is a negative value, miXscope's current x,y coordinates for the text comment will be used. The value 0,0 is in the bottom left corner of the image.

-timestamp timestamp_xy_position
The -timestamp option will enable or disable the timestamp feature. If timestamp_xy_position is "yes", the timestamp feature will be enabled using miXscope's current timestamp x,y coordinates. If timestamp_xy_position is "no", the timestamp feature will be disabled. If the timestamp_xy_position is an x,y coordinate, the timestamp feature will be enabled using the specified x,y coordinates. The x,y coordinates of 0,0 is in the bottom left corner of the image.

Note: All option_values should be wrapped in quotes if there is a space in the value or the space should be proceeded by a "\" (backslash). If miXscope is not already running when the miXscope_xclc command is executed, miXscope will be launched and all options except for app_path will be ignored.

If the error command not found occurs when trying to run the miXscope_xclc command, then a "./" (dot forward slash) should proceed the command name. See the examples below.

Examples

./miXscope_xclc -app_path "/Users/username/Desktop"
This example will launch the miXscope application found on the users' Desktop

./miXscope_xclc -timestamp "yes" -filename "test_image_1"
This example will enable the timestamp feature using the x,y position currently set in the miXscope application. The snapshot, test_image_1, will be saved in the file format and snapshot image folder indicated by the preference settings of miXscope.

./miXscope_xclc -effects "Negative" -filetype "tif"
This example will enable the Negative special effect feature. The snapshot will be saved as a TIFF image. The unspecified options will use the current preference settings of miXscope.

./miXscope_xclc
This example will use the current version of miXscope that is already running and take a snapshot using the current settings in the miXscope application. If miXscope is not already running, it will launch the first copy of miXscope the system finds. No snapshot will be taken.


Results
- returns a 0 if the command executed
- returns a 1 if the plist file cannot be written
- returns a 2 if the filepath option is an invalid path
- returns a 3 if the plist file fails to open
- returns a 4 if the miXscope application fails to launch