I'v been using a shortcut from the iOS/ipadOS share sheet in safari for several months now successfully and tried to use/port it to macOS:
The "Run Javascript on Active Safari Tab" (RJOACST) action fails on MacOS if logic based on native shortcut actions is executed before / in front of it.
The same shortcut does work on iOS and iPadOS.
Here's the shortcut:
https://www.icloud.com/shortcuts/613fe9b4464c401380159eb8160eb485
The Error on macOS reads:
'''
DEV Safari Recipee 2 JS Reminders N...
Unable to Run JavaScript on Web Page Make sure Allow JavaScript from Apple Events is enabled in the Develop menu in Safari. The Develop menu can be enabled in the Advanced section of Safari's Preferences.
'''
BUT: simpler shortcuts with just the RJOASF Javascscript (e.g. the default script) DO work on the same machine. All settings are correct.
When refactoring the initial logic from shortcuts action into Javascript code and calling the RJOACST silently lets the shortcut die.
Any lead/hint appreciated.
I did try to retrieve the shortcuts input shortly before the RJOACST is executed.
PS: The file Recipes.json contains a list of sites to scrape recipe ingredients from - find the example here:
'''
{
"deli-berlin.com": {
"selectorType": "xpath",
"selectorExpression": "//div[contains(@class,'wprm-recipe-ingredient-group')]/ul/li",
"extractionType": "text",
"joinArrayString": "\n",
"cleanupRules": [],
"sampleUrl": "https://deli-berlin.com/rezept-vegane-lasagne/",
"cachedHtml": "",
"baselineIngredientsText": "",
"activeVariationId": "row",
"variations": [],
"snapshotNote": "",
"lastTestStatus": "untested",
"lastTestedDate": "",
"lastTestError": "",
"htmlUpdatedAt": "",
"baselineUpdatedAt": "",
"ruleConfigUpdatedAt": "",
"history": []
},
"www.allrecipes.com": {
"selectorType": "xpath",
"selectorExpression": "//ul[contains(@class,'mntl-structured-ingredients__list')]/li",
"extractionType": "text",
"joinArrayString": "\n",
"cleanupRules": [
{
"find": "\n{2,}",
"replace": "\n",
"active": true,
"phase": "beforeJoin"
}
],
"sampleUrl": "https://www.allrecipes.com/recipe/221361/traditional-sauerbraten/",
"cachedHtml": "",
"baselineIngredientsText": "",
"activeVariationId": "row",
"variations": [],
"snapshotNote": "",
"lastTestStatus": "untested",
"lastTestedDate": "",
"lastTestError": "",
"htmlUpdatedAt": "",
"baselineUpdatedAt": "",
"ruleConfigUpdatedAt": "",
"history": []
}
}
'''
0
0
52