ShareShortcuts

Business Days Until Date

rasmus-lo
„Business Days Until Date“ forken

Hast du auf Basis dieses Kurzbefehls etwas Neues erstellt? Teile ihn als Fork: Er wird zu deinem eigenen Kurzbefehl, den du selbst verwaltest, und beide Seiten verlinken aufeinander, damit rasmus-lo die Anerkennung erhält.

  1. 1Lade den Kurzbefehl und ändere ihn in der Kurzbefehle-App. Gib ihm einen eigenen Namen.
  2. 2Teile ihn in der Kurzbefehle-App und kopiere den iCloud-Link.
  3. 3Komm hierher zurück, füge den Link ein und beschreibe, was sich geändert hat, z. B. „Einen Schritt hinzugefügt, der Apple Intelligence nutzt, um den Text zu personalisieren.“
Downloads
73K
Gesichert
0
Aktionen
24
Kategorie
API
Version
1.0
Sprache
EN

WolframAlpha - # of business days until a future date

Return the number of business days from now until a future date


The shortcut calculates the number of working days until a future date using the WolframAlpha API.

You'll first need to sign up for your own API key before installing the shortcut:

https://products.wolframalpha.com/api/

Neue Funktionen

Version 1.0

First release

Versionsverlauf
1.0 4. Nov 2018

First release

Was er macht

24 Aktionen
  1. Text
  2. Comment
    You will need to sign up for your personal API key at https://products.wolframalpha.com/api/ Enter your API key below:
  3. Text
  4. Set Variable
    api_key
  5. Text
  6. Set Variable
    jsonpath_query
  7. Ask for Input
    What is the future date?
  8. Format Date
  9. Set Variable
    date
  10. Text
  11. URL Encode
  12. Text
  13. Get Contents of URL
  14. Get Text from Input
  15. Set Variable
    json_result
  16. Text
  17. Set Variable
    jsonpath_script
  18. Text
  19. Base64 Encode
  20. URL
    data:text/html;base64,…
  21. Get Contents of Web Page
  22. Get Text from Input
  23. Set Variable
    result
  24. Show Result

Als Code ansehen
Beta

Jede Aktion dieses Kurzbefehls als Cherri ausgeschrieben, eine Programmiersprache für Kurzbefehle. Ideal, um zu lernen, wie er funktioniert.

#include 'actions/web'
#include 'actions/calendar'
#define color red
#define glyph calendar

/*
You will need to sign up for your personal API key at https://products.wolframalpha.com/api/

Enter your API key below:
*/
@api_key = "nil"
@jsonpath_query = "$..pods[?(@.scanner == 'Identity')].subpods[?(@.primary == true)].plaintext"
prompt("What is the future date?", "Date")
formatTimestamp("", "Long", "None")
@date = nil
urlEncode("")
downloadURL("")
getText(nil)
@json_result = nil
@jsonpath_script = "/* JSONPath 0.8.0 - XPath for JSON\n *\n * Copyright (c) 2007 Stefan Goessner (goessner.net)\n * Licensed under the MIT (MIT-LICENSE.txt) licence.\n */\nfunction jsonPath(obj, expr, arg) {\n   var P = {\n      resultType: arg && arg.resultType || \\"VALUE\\",\n      result: [],\n      normalize: function(expr) {\n         var subx = [];\n         return expr.replace(/[\['](\??\(.*?\))[\]']/g, function($0,$1){return \\"[#\\"+(subx.push($1)-1)+\\"]\\";})\n                    .replace(/'?\.'?|\['?/g, \\";\\")\n                    .replace(/;;;|;;/g, \\";..;\\")\n                    .replace(/;$|'?\]|'$/g, \\"\\")\n                    .replace(/#([0-9]+)/g, function($0,$1){return subx[$1];});\n      },\n      asPath: function(path) {\n         var x = path.split(\\";\\"), p = \\"$\\";\n         for (var i=1,n=x.length; i<n; i++)\n            p += /^[0-9*]+$/.test(x[i]) ? (\\"[\\"+x[i]+\\"]\\") : (\\"['\\"+x[i]+\\"']\\");\n         return p;\n      },\n      store: function(p, v) {\n         if (p) P.result[P.result.length] = P.resultType == \\"PATH\\" ? P.asPath(p) : v;\n         return !!p;\n      },\n      trace: function(expr, val, path) {\n         if (expr) {\n            var x = expr.split(\\";\\"), loc = x.shift();\n            x = x.join(\\";\\");\n            if (val && val.hasOwnProperty(loc))\n               P.trace(x, val[loc], path + \\";\\" + loc);\n            else if (loc === \\"*\\")\n               P.walk(loc, x, val, path, function(m,l,x,v,p) { P.trace(m+\\";\\"+x,v,p); });\n            else if (loc === \\"..\\") {\n               P.trace(x, val, path);\n               P.walk(loc, x, val, path, function(m,l,x,v,p) { typeof v[m] === \\"object\\" && P.trace(\\"..;\\"+x,v[m],p+\\";\\"+m); });\n            }\n            else if (/,/.test(loc)) { // [name1,name2,...]\n               for (var s=loc.split(/'?,'?/),i=0,n=s.length; i<n; i++)\n                  P.trace(s[i]+\\";\\"+x, val, path);\n            }\n            else if (/^\(.*?\)$/.test(loc)) // [(expr)]\n               P.trace(P.eval(loc, val, path.substr(path.lastIndexOf(\\";\\")+1))+\\";\\"+x, val, path);\n            else if (/^\?\(.*?\)$/.test(loc)) // [?(expr)]\n               P.walk(loc, x, val, path, function(m,l,x,v,p) { if (P.eval(l.replace(/^\?\((.*?)\)$/,\\"$1\\"),v[m],m)) P.trace(m+\\";\\"+x,v,p); });\n            else if (/^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$/.test(loc)) // [start:end:step]  phyton slice syntax\n               P.slice(loc, x, val, path);\n         }\n         else\n            P.store(path, val);\n      },\n      walk: function(loc, expr, val, path, f) {\n         if (val instanceof Array) {\n            for (var i=0,n=val.length; i<n; i++)\n               if (i in val)\n                  f(i,loc,expr,val,path);\n         }\n         else if (typeof val === \\"object\\") {\n            for (var m in val)\n               if (val.hasOwnProperty(m))\n                  f(m,loc,expr,val,path);\n         }\n      },\n      slice: function(loc, expr, val, path) {\n         if (val instanceof Array) {\n            var len=val.length, start=0, end=len, step=1;\n            loc.replace(/^(-?[0-9]*):(-?[0-9]*):?(-?[0-9]*)$/g, function($0,$1,$2,$3){start=parseInt($1||start);end=parseInt($2||end);step=parseInt($3||step);});\n            start = (start < 0) ? Math.max(0,start+len) : Math.min(len,start);\n            end   = (end < 0)   ? Math.max(0,end+len)   : Math.min(len,end);\n            for (var i=start; i<end; i+=step)\n               P.trace(i+\\";\\"+expr, val, path);\n         }\n      },\n      eval: function(x, _v, _vname) {\n         try { return $ && _v && eval(x.replace(/@/g, \\"_v\\")); }\n         catch(e) { throw new SyntaxError(\\"jsonPath: \\" + e.message + \\": \\" + x.replace(/@/g, \\"_v\\").replace(/\^/g, \\"_a\\")); }\n      }\n   };\n\n   var $ = obj;\n   if (expr && obj && (P.resultType == \\"VALUE\\" || P.resultType == \\"PATH\\")) {\n      P.trace(P.normalize(expr).replace(/^\$;/,\\"\\"), obj, \\"$\\");\n      return P.result.length ? P.result : false;\n   }\n} "
base64Encode(nil)
url("data:text/html;base64,{}")
getWebpageContents("")
getText(nil)
@result = nil
show("There are {@result} until {@date}")
In Cherri Playground öffnen Mit cherri 2.3.0 (GPL-2.0) dekompiliert. Eventuell sind kleine Korrekturen nötig, bevor es kompiliert wird.

Bewertungen und Rezensionen

Rezension schreiben
–
von 5
★★★★★
★★★★
★★★
★★
★
0 ratings

No reviews yet. Be the first to share what you think!

Werbung

Mehr von rasmus-lo

Alle anzeigen

Das gefällt dir vielleicht auch

Alle anzeigen
Werbung