时间戳转化工具
原先找了个别人写的 Timestamp, 但是用着不方便,转换结果需要粘贴出来才能看到,一般情况下其实只要瞄一眼就好了。于是想让结果直接显示在列表里。
XML
查了下文档 Alfred 只支持 xml 格式的数据来列表展示。发现原来的工具无法兼容。自己写一个:
- 创建新的 Workflow
- 右键添加
Inputs -> Script Filter
选择语言:Language - php
with input as {query}
Script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| $query = '{query}'; $result = '';
if ($query == 'now' || $query == '') { $result = @time(); }
else if (is_numeric($query)) { $result = @date('Y-m-d h:i:s', $query); }
else { $result = @strtotime($query); }
echo '<?xml version="1.0"?>'; echo '<items>'; echo '<item uid="timestamp" arg="'.$result.'">'; echo '<title>结果为: ' .$result. '</title>'; echo '<subtitle>Press Enter to paste</subtitle>'; echo '<icon>icon.png</icon>'; echo '</item>'; echo '</items>';
|