Why macro for SafariURL not work with condition "ends with"
I'm building macros for easy modification of dokuwiki pages and want to run macro only in "edit" mode, what in practice means that %SafariURL% is ended with do=edit
If I set condition ends with, it doesn't work, but if I set contain - works correctly.
Could you "test" what it contains by adding a token inside your second Notification action, in order to display %SafariURL%. I highly recommend that you display %SafariURL% in parentheses within your notification so you can see if the are any trailing spaces.
I was simply saying that you could use it as a way to test to make sure the concept works. If the regex fails, then there's something else going on with the token.
As for exaggeration or not, when I'm solving a problem, I use the tools available. If one doesn't work, but another one does, I'll use the other every time rather than try to figure out why the first one doesn't work—I just want my problem solved :).
Excellent troubleshooting. It looks to me that the line doesn't end with "do=edit", rather it ends with "do=edit}" so all you have to do is add "}" to your string.
I'm so stupid and embarrassed. Sorry. Let me re-think. (The whole purpose of me asking for those braces was to make sure we spotted the correct end of the string, and my braces fooled me!)
Hmm. Right now, it works for me, as you can see in this image:
So try doing what I did above (just paste both values into an IF action like shown above) and see if you get "true" or "false".
Another thing to try, for testing purposes, is to assign that string %SafariURL% into a variable first, then do your test on that variable. I'm not saying that's the final fix, it's just for diagnostic purposes.
I've checked variant with variable first - worked.
Next I once more put condition with text and %SafariURL% - also works.
So I've started thinking what was wrong - and added space after %SafariURL% - this time of course not work.
So probably I had space in the end of the text, but because space has the same background color as the rest of entry area, I didn't see that, but result of evaluation of course was false.
I'm not sure but there is no option to set different color for background of entered text than rest of entry area, so I have to be careful in modifying text fields.
Thanks a lot and sorry for this meaningless question/topic.
That would have been my first thought, but I just checked the If Then Else.kmactions you posted and there does not seem to be any spaces or other invisible characters in there.
At the moment your macro will run in any mode but (presumably) exit if not in edit mode.
If your DokuWiki behaves the same as the Playground you'll have a "pencil" character -- ✎ -- in the document's title, and therefore in the window name:
So you can put your macros in a Group that is only available when the focused window is a DokuWiki editor:
...and avoid the URL test altogether.
That doesn't work if you want to run the macro when in Edit mode but with another app/window frontmost, of course...
BTW
I'm very "young" user of Mac, I've begun three years ago, coming here after using Unix/Linux above 25 years.
I bought KM after two hours of testing (YES ) and first I had many problems to understand KM concepts. But now I have very big "internal pressure" to learn it and create new macros because KM directs me in so many different and new areas of using MacOS. It is fantastic! (BTW as programmer in C, Java, Python and other Unix languages I had also very hard start to understand how to write in Apple Script - it was terrible ).
Thanks a lot to @peternlewis for KM and others for support here!