1.2) Tools ^^^^^^^^^^ Remember, always import library. .. code-block:: python import easymacro as app **Info from PC** ^^^^^^^^^^^^^^^^ * Operate system .. code-block:: python app.msgbox(app.OS) * Current user .. code-block:: python app.msgbox(app.USER) * Name PC .. code-block:: python app.msgbox(app.PC) * Name desktop, only GNU/Linux .. code-block:: python app.msgbox(app.DESKTOP) * Language .. code-block:: python app.msgbox(app.LANG) * Language with variant .. code-block:: python app.msgbox(app.LANGUAGE) * Application name .. code-block:: python app.msgbox(app.NAME) * Application version .. code-block:: python app.msgbox(app.VERSION) * In Windows .. code-block:: python app.msgbox(app.IS_WIN) **Message box** ^^^^^^^^^^^^^^^ .. code-block:: python app.msgbox(app.IS_WIN, 'My Macro') **Show warning** ^^^^^^^^^^^^^^^^ .. code-block:: python message = 'Caution, this action is dangerous' title = 'My App' app.warning(message, title) **Show error box** ^^^^^^^^^^^^^^^^^^ .. code-block:: python message = 'ERROR: Contact technical support' title = 'My App' app.errorbox(message, title) **Make question** ^^^^^^^^^^^^^^^^^ .. code-block:: python message = 'Is easy Python?' title = 'My App' result = app.question(message, title) app.msgbox(result) **InputBox** ^^^^^^^^^^^^ * Normal data .. code-block:: python message = 'Type your name' default = '' title = 'My App' result = app.inputbox(message, default, title) app.msgbox(result) * Private data .. code-block:: python message = 'Type your password' default = '' title = 'My App' echochar = "*" result = app.inputbox(message, default, title, echochar) app.msgbox(result) **Create instances** ^^^^^^^^^^^^^^^^^^^^ * Instances without context .. code-block:: python toolkit = app.create_instance("com.sun.star.awt.Toolkit") * Instances with context .. code-block:: python service = 'com.sun.star.awt.DialogProvider2' dialog = app.create_instance(service, True) **Paths and files** ^^^^^^^^^^^^^^^^^^^ * Get info path .. code-block:: python path = '/home/mau/myfile.ods' p = app.paths(path) app.debug(p.path) app.debug(p.file_name) app.debug(p.name) app.debug(p.ext) app.debug(p.url) Or get information in a tuple .. code-block:: python path = '/home/mau/myfile.ods' p = app.paths(path) app.debug(p.info) * Get path home .. code-block:: python path = app.paths.home app.debug(path) * Get path documents .. code-block:: python path = app.paths.documents app.debug(path) * Get path temp .. code-block:: python path = app.paths.temp_dir app.debug(path) .. _MRI: https://github.com/hanya/MRI