Mac ã使ã£ã¦ãããªãå¿ ã使ãã¹ã2ã¤ã®æ©è½ "Automator" 㨠"ãµã¼ãã¹"
Automator ã£ã¦ãªããè¶
é«æ©è½ãªãã¯ãã¿ãããªã¤ã¡ã¼ã¸ãããã¾ãããã¨ã¦ã便å©ãªã®ã§ãç´¹ä»ã
ãã¨ãã¨ã¯ãä¼ç¤¾ã®ä¸å¸ã Windows ãã Mac ã«ç§»è¡ããã®ã ããã©ã"ç§ä¸¸ã¿ããã«é¸æç¯å²ã ruby 㧠evalã§ããªãã®" ã¨ãã£ããã£ã¦ãããããã Emacs ã¯å¾®å¦ã¨ã®ãã¨ãªã®ã§ãAutomator ã§ã©ãã«ããã¦ã¿ããService ã§ã§ããããããªãããã¨æãã¦ãããååã«æè¬ã
追è¨(2013/02/24)
デバッグ方法ãå¥ã¨ã³ããªã«æ¸ãã¾ãã
ã§ãããã¨
æååé¸æã㦠Ctrl+= ãæ¼ãã¨é¸ææååã ruby ã§å®è¡ããã¾ããç·¨éå¯è½ãªããã¹ãã¨ãªã¢ãªãã ãããä½å¦ã§ãã
ä½ãæ¹
- ã¢ããªã±ã¼ã·ã§ã³ ãã£ã¬ã¯ããªã«ãã Automator ãèµ·åãã¾ãã
- æ°ãããµã¼ãã¹ãä½ãã¾ã
- ã¦ã¼ãã£ãªã㣠> "ã·ã§ã«ã¯ã¹ã¯ãªãããå®è¡"ã¨ããã¢ã¯ã·ã§ã³ãé¸ãã§å³ã®ããã¦ããã¨ãã«ãã©ãã°ã¢ã³ããããã
- "ruby -Ku" ã¨æ¸ã
- ãããããã¦ã³ãªã¹ãã§é¸ã¹ããªãã·ã§ã³ã¯ç»åã®ã¨ããã«ã
- ååãã¤ãã¦ä¿åããããã¨ãã° "doRuby"
- ã·ã§ã¼ãã«ããã¼ãã¼ãè¨å®ãã
- "ã·ã¹ãã ç°å¢è¨å®" ãéãã¦ã"ãã¼ãã¼ã"é ç®ã®ããã¼ãã¼ãã·ã§ã¼ãã«ããã¿ããã¯ãªãã¯
- å·¦ã«ã©ã ã®ãµã¼ãã¹ãé¸ã¶ã¨ããã£ãä¿åããå³ã«ã©ã ã« doRuby ãããã®ã§ããããªã·ã§ã¼ãã«ãããã¼ãè¨å®
- ããã¹ãã¨ãªã¢ã§ãruby ã®ã³ã¼ããé¸æããããã£ã決ããã·ã§ã¼ãã«ãããã¼ãæ¼ããã³ã¼ããå®è¡ãããã
- Ctrl-z ã§åä½ãåãæ¶ãã¦ããã¨ã®ã³ã¼ãã«æ»ããã®ããã¤ã³ãé«ãã§ããã
ãã¤ã³ã
- ã·ã§ã«ã¹ã¯ãªããã®æ¨æºå ¥åã«ãªãã§ã渡ããããã¡ã¤ã«åã渡ããããåºæ¥ããã»ã¨ãã©ãªãã§ãåºæ¥ããããã
- ã¤ãã£ããµã¼ãã¹ã¯ãã³ã³ããã¹ãã¡ãã¥ã¼åºãããã«ãªã!
- ã¤ãã£ããµã¼ãã¹ã¯ãã·ã§ã¼ãã«ãããã¼ãã»ããã§ããã
- Ctrl-z ã§ãããªããã§ããã
ã·ã§ã¼ãã«ãããã¼ãè¨å®ã§ããã®ããã¨ã¦ãéè¦ã§ãç»é¢ããã¯ã®ã·ã§ã¼ãã«ãããã¼ãç°¡åã«ã§ãã¾ãã
ç»é¢ããã¯ã®ä½ãæ¹
- éä¸ã¾ã§ã¯ãã£ãã®ä¾ã¨åã
- ãããªæãã§"ã¹ã¯ãªã¼ã³ã»ã¼ãã¼ã®éå§" ãããã ãã®ãµã¼ãã¹ãä½æ
- ååã¤ãã¦ä¿å
- ä¸ã®ä¾ã¨åæ§ã«ãã·ã§ã¼ãã«ãããã¼ãè¨å®
ã¨ããã°ãç»é¢ããã¯ã®ããã® service ã«ãªãã¾ãã
çºå±å
ã¹ã¯ãªã¼ã³ã·ã§ãããæ®ã£ã¦ãfotolife ã« upload ãããã¨ãã gyazo ã¿ãããªã¹ã¯ãªãããä¸ææã¯ããã¾ãããããããã·ã§ã¼ãã«ãããã¼ããå¼ã¹ãã¨ããªã便å©ã§ãã
use strict; use warnings; use Config::Pit; use WebService::Hatena::Fotolife; use IPC::Run qw(run); my $conf = Config::Pit::get("hatena.ne.jp"); my $file_name = $ARGV[0]; my $tmp_filename = '/tmp/screencapture.png'; if ($file_name || run(['screencapture', '-i', $tmp_filename])) { my $hatena = WebService::Hatena::Fotolife->new; $hatena->username($conf->{user}); $hatena->password($conf->{pass}); my ($date) = $hatena->createEntry( filename => $file_name || $tmp_filename, folder => 'work', ) =~ /(\d{14})$/; my $url = sprintf "http://f.hatena.ne.jp/%s/%s", $conf->{user}, $date; run(['open', $url]); }
ãããªã¹ã¯ãªãããæ¸ãã¦ããã¦ã
ãããã£ã¦ãµã¼ãã¹ãä½ãã¨ãã·ã§ã¼ãã«ãããã¼ä¸çºã§ãã¹ã¯ãªã¼ã³ã·ã§ããåå¾ã¨ fotolife ã¸ã® upload ã¾ã§å®äºã§ãã¾ãã