OK … let me try it this way.
The Accepts
statement at the very top of the shortcut is very specific about what it will accept - it will only accept URLs. So the shortcut will appear in the share sheet only the an app is trying to pass a URL to the share sheet. And that’s good, because Pocket will only accept URLs, so no need to have the shortcut appear in the share sheet when an image is being passed into it.
Put another way, the shortcut says “I only accept Granny Smith apples. I won’t accept Gala, Macoun, or Red Delicious. And don’t even try to send me oranges or any other kind of fruit.”
OK. It might not be as broad as possible, but it shouldn’t fail, so its fine. Not being a Pocket user, I don’t know what other types of content Pocket will accepts, so I can’t comment on what other types might be selected in the Accepts
section. I’d imagine “articles”, “Safari Webpages”, and perhaps “text” or “media” might work, but IDrK.
The next few steps set the shortcut input to a variable named URL
and then checks the type of the variable 'URL` to make sure it is a URL. Its a good process step to make sure the input content is what is expected (“trust but verify”), but in this instance it isn’t strictly necessary, since the shortcut has already said it won’t accept anything other than URL’s.
And then for reasons I can’t yet explain, the checking step (the IF
statement) looks at the variable type and decides it is not, in fact, a URL. Or … the shortcut says it will only accept Granny Smith apples, so its given what appears to be a Granny Smith apple, but then it looks at the Granny Smith apple and decides that it isn’t a Granny Smith apple.
One possible explanation is that there is some sort of type definition thing going on here. The thing to know is that all variables come with (I think) three pieces of information attached: the name of the variable, the type of the variable, and the content of the variable. So the type of the variable could be “Macoun” while the content of the variable is “Macoun that has been painted green to look like a Granny Smith”.
So the shortcut says “GIVE ME ONLY GRANNY SMITH APPLES!”. It gets handed a green apple that looks like a Granny Smith. It looks at the apple and says “Nope. Not Granny Smith. What else ya got?” (All in Wizard of Oz voice, obviously.)
Perhaps somewhere in the conversion from “shortcut input” to “variable URL” the type of the variable got changed to something else? I mentioned before that I’m not a programmer, so I’m dancing very close to the edge of my understanding of all this.
So then since the shortcut checks the type of the variable and decides that the variable is not type=URL, it executes the Otherwise
section of the IF
statement and grabs the clipboard. And that’s good because it makes the shortcut useful it its run from the Shortcuts app directly after copying a URL to the clipboard.
The reason I mentioned that second change to the shortcut was to restore the ability to use the clipboard if the shortcut is run from the Shortcuts app. But I changed it to check whether anything was passed into the shortcut and only if nothing was passed into the input is it to use the Clipboard. I don’t know if this is strictly the best way to do this, but its the way I do it and it seems to work for me.
Sorry for the wall of text. Hopefully that makes sense. Please LMK if it doesn’t. I’m happy to take another swing if you like.