View Single Post
Old 04-17-2021, 01:24 AM   #536
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,236
Karma: 77935877
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Question: I have a 'view' action (bound to V and limited to 1 book to prevent mass-opening accidents) to open a book and populate a few columns:

Code:
{
  "ActionsChainMenus": {
    "Menus": [
      {
        "active": true,
        "chain_settings": {
          "chain_links": [
            {
              "action_name": "Calibre Actions",
              "action_settings": {
                "disable_busy_cursor": false,
                "selection": [
                  {
                    "display": "View",
                    "path": [
                      "View",
                      "View"
                    ],
                    "paths_text": "View"
                  }
                ],
                "wait_jobs": false,
                "wait_progress": false
              },
              "comment": "Open book"
            },
            {
              "action_name": "Single Field Edit",
              "action_settings": {
                "col_name": "#read",
                "template": "program:\n\n\tif and(check_yes_no('#read', '', '', 1),) then \t'No'\n\telse $#read\n\tfi",
                "value_type": "template"
              },
              "comment": "Set #read column (TEMPLATE)"
            },
            {
              "action_name": "Single Field Edit",
              "action_settings": {
                "col_name": "#percentread",
                "template": "program:\n\tif raw_field('#percentread', '1') ==# '0' then '1'\n\telse raw_field('#percentread')\n\tfi",
                "value_type": "template"
              },
              "comment": "Set #percentread to 1 (TEMPLATE)"
            },
            {
              "action_name": "Single Field Edit",
              "action_settings": {
                "col_name": "#lastread",
                "value": [
                  {
                    "__class__": "datetime.datetime",
                    "__value__": "2021-03-30T00:13:43.637933+00:00"
                  },
                  true
                ],
                "value_type": "predefined"
              },
              "comment": "Set #lastread to current time"
            },
            {
              "action_name": "Refresh View",
              "action_settings": {},
              "comment": "Refresh view"
            }
          ],
          "refresh_gui": true
        },
        "condition_settings": {
          "affect_menu": false,
          "cmp_type": "=",
          "datatype": "number",
          "icon": "",
          "template": "program: selection_count()",
          "tooltip": "",
          "value": 1.0
        },
        "image": "",
        "menuText": "View",
        "subMenu": "Invisible"
      }
    ]
  },
  "schemaVersion": 1.5
}
If the only available format is PAPERBOOK (a zero-length file I use to identify physical copies), I'd want to skip the "View" action. What would be the best way to do that?
Attached Files
File Type: zip view.zip (807 Bytes, 495 views)

Last edited by ownedbycats; 04-17-2021 at 01:30 AM.
ownedbycats is online now   Reply With Quote