diff --git a/PluginDirectories/1/ascii.bundle/Icon.png b/PluginDirectories/1/ascii.bundle/Icon.png new file mode 100644 index 00000000..1af7d993 Binary files /dev/null and b/PluginDirectories/1/ascii.bundle/Icon.png differ diff --git a/PluginDirectories/1/ascii.bundle/README.markdown b/PluginDirectories/1/ascii.bundle/README.markdown new file mode 100644 index 00000000..2acca78d --- /dev/null +++ b/PluginDirectories/1/ascii.bundle/README.markdown @@ -0,0 +1,5 @@ +This is an auto-generated plugin skeleton. Edit the `examples.txt`, `info.json` and `plugin.py` files to turn it into the plugin you need. + +For more info on how this works, see [the docs](https://github.com/nate-parrott/Flashlight/wiki/Creating-a-Plugin). + +If you're building a search plugin, you may want to base your code off [a search plugin](https://github.com/nate-parrott/Flashlight/tree/master/PluginDirectories/1/googlesearch.bundle) instead. diff --git a/PluginDirectories/1/ascii.bundle/Screenshot.png b/PluginDirectories/1/ascii.bundle/Screenshot.png new file mode 100644 index 00000000..c10cf573 Binary files /dev/null and b/PluginDirectories/1/ascii.bundle/Screenshot.png differ diff --git a/PluginDirectories/1/ascii.bundle/examples.txt b/PluginDirectories/1/ascii.bundle/examples.txt new file mode 100644 index 00000000..e68015dc --- /dev/null +++ b/PluginDirectories/1/ascii.bundle/examples.txt @@ -0,0 +1,5 @@ +chr ~chr(97) +chr ~chr(97 90 100 76 91 93 97 99 101) +asc ~asc(+) +asc ~asc(a b $ ‘ “ \ D % ^) +ascii ~asc(a b $ ‘ “ \ D % ^) diff --git a/PluginDirectories/1/ascii.bundle/info.json b/PluginDirectories/1/ascii.bundle/info.json new file mode 100644 index 00000000..d7ab2564 --- /dev/null +++ b/PluginDirectories/1/ascii.bundle/info.json @@ -0,0 +1,12 @@ +{ + "categories" : [ + "Utilities" + ], + "displayName" : "Utility for ascii", + "name" : "ascii", + "description" : "Show ascii.", + "examples" : [ + "chr a b", + "asc 97 90" + ] +} diff --git a/PluginDirectories/1/ascii.bundle/plugin.py b/PluginDirectories/1/ascii.bundle/plugin.py new file mode 100644 index 00000000..c535fad3 --- /dev/null +++ b/PluginDirectories/1/ascii.bundle/plugin.py @@ -0,0 +1,23 @@ +def results(fields, original_query): + html="" + if("~chr" in fields): + message = fields['~chr'] + title = "char of "+message + for tmp in message.split(): + html=html+" "+chr(int(tmp)) + data = html.lstrip() + else: + message = fields['~asc'] + title = "ascii of "+message + for tmp in message.split(): + html=html+" "+str(ord(tmp)) + data = html.lstrip() + return { + "title": title, + "run_args": [data], + "html": html + } + +def run(message): + import subprocess + subprocess.call(['printf "' + message + '" | LANG=en_US.UTF-8 pbcopy && osascript -e \'display notification "Copied!" with title "Flashlight"\''], shell=True)